Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge project manager & burger menu #7289

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newIDE/app/src/MainFrame/EditorContainers/BaseEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export type RenderEditorContainerProps = {|
onSelectExampleShortHeader: ExampleShortHeader => void,
onSelectPrivateGameTemplateListingData: PrivateGameTemplateListingData => void,
onOpenLanguageDialog: () => void,
onOpenVersionHistory: () => void,
selectInAppTutorial: (tutorialId: string) => void,
onOpenProfile: () => void,
onOpenPreferences: () => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import FlatButton from '../../../UI/FlatButton';
import { Column, Line } from '../../../UI/Grid';
import { LineStackLayout } from '../../../UI/Layout';
import UserChip from '../../../UI/User/UserChip';
import ProjectManagerIcon from '../../../UI/CustomSvgIcons/ProjectManager';
import Window from '../../../Utils/Window';
import optionalRequire from '../../../Utils/OptionalRequire';
import TextButton from '../../../UI/TextButton';
Expand All @@ -18,12 +17,13 @@ import { useResponsiveWindowSize } from '../../../UI/Responsive/ResponsiveWindow
import SaveProjectIcon from '../../SaveProjectIcon';
import Mobile from '../../../UI/CustomSvgIcons/Mobile';
import Desktop from '../../../UI/CustomSvgIcons/Desktop';
import HistoryIcon from '../../../UI/CustomSvgIcons/History';
import AuthenticatedUserContext from '../../../Profile/AuthenticatedUserContext';
const electron = optionalRequire('electron');

type Props = {|
hasProject: boolean,
onOpenProjectManager: () => void,
onOpenVersionHistory: () => void,
onOpenProfile: () => void,
onOpenLanguageDialog: () => void,
onSave: () => Promise<void>,
Expand All @@ -32,7 +32,7 @@ type Props = {|

export const HomePageHeader = ({
hasProject,
onOpenProjectManager,
onOpenVersionHistory,
onOpenProfile,
onOpenLanguageDialog,
onSave,
Expand All @@ -52,22 +52,23 @@ export const HomePageHeader = ({
>
<Column noMargin>
<Line noMargin>
<IconButton
size="small"
id="main-toolbar-project-manager-button"
onClick={onOpenProjectManager}
tooltip={t`Project Manager`}
color="default"
disabled={!hasProject}
>
<ProjectManagerIcon />
</IconButton>
{!!hasProject && (
<SaveProjectIcon
id="main-toolbar-save-button"
onSave={onSave}
canSave={canSave}
/>
<>
<IconButton
size="small"
id="main-toolbar-history-button"
onClick={onOpenVersionHistory}
tooltip={t`Open version history`}
color="default"
>
<HistoryIcon />
</IconButton>
<SaveProjectIcon
id="main-toolbar-save-button"
onSave={onSave}
canSave={canSave}
/>
</>
)}
</Line>
</Column>
Expand Down
10 changes: 5 additions & 5 deletions newIDE/app/src/MainFrame/EditorContainers/HomePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type Props = {|
onOpenPrivateGameTemplateListingData: (
privateGameTemplateListingData: PrivateGameTemplateListingData
) => void,
onOpenProjectManager: () => void,
onOpenVersionHistory: () => void,
askToCloseProject: () => Promise<boolean>,
closeProject: () => Promise<void>,

Expand Down Expand Up @@ -177,7 +177,7 @@ export const HomePage = React.memo<Props>(
onSelectExampleShortHeader,
onSelectPrivateGameTemplateListingData,
onOpenPrivateGameTemplateListingData,
onOpenProjectManager,
onOpenVersionHistory,
onOpenLanguageDialog,
onOpenProfile,
onCreateProjectFromExample,
Expand Down Expand Up @@ -399,7 +399,7 @@ export const HomePage = React.memo<Props>(
hasProject={!!project}
onOpenLanguageDialog={onOpenLanguageDialog}
onOpenProfile={onOpenProfile}
onOpenProjectManager={onOpenProjectManager}
onOpenVersionHistory={onOpenVersionHistory}
onSave={onSave}
canSave={canSave}
/>
Expand All @@ -410,7 +410,7 @@ export const HomePage = React.memo<Props>(
setToolbar,
onOpenLanguageDialog,
onOpenProfile,
onOpenProjectManager,
onOpenVersionHistory,
project,
onSave,
canSave,
Expand Down Expand Up @@ -615,7 +615,7 @@ export const renderHomePageContainer = (
props.onOpenPrivateGameTemplateListingData
}
onOpenNewProjectSetupDialog={props.onOpenNewProjectSetupDialog}
onOpenProjectManager={props.onOpenProjectManager}
onOpenVersionHistory={props.onOpenVersionHistory}
onOpenTemplateFromTutorial={props.onOpenTemplateFromTutorial}
onOpenTemplateFromCourseChapter={props.onOpenTemplateFromCourseChapter}
onOpenLanguageDialog={props.onOpenLanguageDialog}
Expand Down
62 changes: 18 additions & 44 deletions newIDE/app/src/MainFrame/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,36 +179,6 @@ export const buildMainMenuDeclarativeTemplate = ({
onClickSendEvent: 'main-menu-close',
enabled: !!project,
},
...(!isMacLike() || !isApplicationTopLevelMenu
? [
{ type: 'separator' },
{
label: i18n._(t`My Profile`),
onClickSendEvent: 'main-menu-open-profile',
},
{
label: i18n._(t`Preferences`),
onClickSendEvent: 'main-menu-open-preferences',
},
{
label: i18n._(t`Language`),
onClickSendEvent: 'main-menu-open-language',
},
// Leaving the app can only be done on the desktop app.
...(!!electron
? [
{ type: 'separator' },
{
label: i18n._(t`Exit GDevelop`),
accelerator: getElectronAccelerator(
shortcutMap['QUIT_APP']
),
onClickSendEvent: 'main-menu-close-app',
},
]
: []),
]
: []),
],
};

Expand All @@ -231,18 +201,22 @@ export const buildMainMenuDeclarativeTemplate = ({
const viewTemplate: MenuDeclarativeItemTemplate = {
label: i18n._(t`View`),
submenu: [
{
label: i18n._(t`Show Project Manager`),
accelerator: getElectronAccelerator(
shortcutMap['OPEN_PROJECT_MANAGER']
),
onClickSendEvent: 'main-menu-open-project-manager',
enabled: !!project,
},
{
label: i18n._(t`Show Home`),
onClickSendEvent: 'main-menu-open-home-page',
},
...(isApplicationTopLevelMenu
? [
{
label: i18n._(t`Show Project Manager`),
accelerator: getElectronAccelerator(
shortcutMap['OPEN_PROJECT_MANAGER']
),
onClickSendEvent: 'main-menu-open-project-manager',
enabled: !!project,
},
{
label: i18n._(t`Show Home`),
onClickSendEvent: 'main-menu-open-home-page',
},
]
: []),
{
label: i18n._(t`Open Debugger`),
onClickSendEvent: 'main-menu-open-debugger',
Expand Down Expand Up @@ -360,9 +334,9 @@ export const buildMainMenuDeclarativeTemplate = ({
// on the web-app, because they would not work and make sense at all.
const template: Array<MenuDeclarativeItemTemplate> = [
fileTemplate,
...(!!electron ? [editTemplate] : []),
...(!!electron && isApplicationTopLevelMenu ? [editTemplate] : []),
viewTemplate,
...(!!electron ? [windowTemplate] : []),
...(!!electron && isApplicationTopLevelMenu ? [windowTemplate] : []),
helpTemplate,
];

Expand Down
31 changes: 14 additions & 17 deletions newIDE/app/src/MainFrame/TabsTitlebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
import * as React from 'react';
import MenuIcon from '../UI/CustomSvgIcons/Menu';
import IconButton from '../UI/IconButton';
import ElementWithMenu from '../UI/Menu/ElementWithMenu';
import GDevelopThemeContext from '../UI/Theme/GDevelopThemeContext';
import optionalRequire from '../Utils/OptionalRequire';
import { isMacLike } from '../Utils/Platform';
import Window, { useWindowControlsOverlayWatcher } from '../Utils/Window';
import { type MenuItemTemplate } from '../UI/Menu/Menu.flow';
import useForceUpdate from '../Utils/UseForceUpdate';
const electron = optionalRequire('electron');

type Props = {|
onBuildMenuTemplate: () => Array<MenuItemTemplate>,
children: React.Node,
toggleProjectManager: () => void,
|};

const DRAGGABLE_PART_CLASS_NAME = 'title-bar-draggable-part';
Expand All @@ -28,7 +26,10 @@ const styles = {
/**
* The titlebar containing a menu, the tabs and giving space for window controls.
*/
export default function TabsTitlebar({ children, onBuildMenuTemplate }: Props) {
export default function TabsTitlebar({
children,
toggleProjectManager,
}: Props) {
const forceUpdate = useForceUpdate();
const gdevelopTheme = React.useContext(GDevelopThemeContext);
const backgroundColor = gdevelopTheme.titlebar.backgroundColor;
Expand Down Expand Up @@ -74,19 +75,15 @@ export default function TabsTitlebar({ children, onBuildMenuTemplate }: Props) {
}}
className={DRAGGABLE_PART_CLASS_NAME}
/>
<ElementWithMenu
element={
<IconButton
size="small"
id="gdevelop-main-menu"
style={styles.menuIcon}
color="default"
>
<MenuIcon />
</IconButton>
}
buildMenuTemplate={onBuildMenuTemplate}
/>
<IconButton
size="small"
id="gdevelop-main-menu"
style={styles.menuIcon}
color="default"
onClick={toggleProjectManager}
>
<MenuIcon />
</IconButton>
{children}
<div
style={{
Expand Down
14 changes: 0 additions & 14 deletions newIDE/app/src/MainFrame/Toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Toolbar, ToolbarGroup } from '../../UI/Toolbar';
import PreviewAndShareButtons, {
type PreviewAndShareButtonsProps,
} from './PreviewAndShareButtons';
import ProjectManagerIcon from '../../UI/CustomSvgIcons/ProjectManager';
import IconButton from '../../UI/IconButton';
import { Spacer } from '../../UI/Grid';
import HistoryIcon from '../../UI/CustomSvgIcons/History';
Expand All @@ -17,7 +16,6 @@ import SaveProjectIcon from '../SaveProjectIcon';

export type MainFrameToolbarProps = {|
showProjectButtons: boolean,
toggleProjectManager: () => void,
openShareDialog: () => void,
onSave: () => Promise<void>,
canSave: boolean,
Expand All @@ -34,7 +32,6 @@ export type ToolbarInterface = {|
|};

type LeftButtonsToolbarGroupProps = {|
toggleProjectManager: () => void,
onSave: () => Promise<void>,
onOpenVersionHistory: () => void,
checkedOutVersionStatus?: ?OpenedVersionStatus,
Expand All @@ -47,22 +44,12 @@ const LeftButtonsToolbarGroup = React.memo<LeftButtonsToolbarGroupProps>(
function LeftButtonsToolbarGroup(props) {
return (
<ToolbarGroup firstChild>
<IconButton
size="small"
id="main-toolbar-project-manager-button"
onClick={props.toggleProjectManager}
tooltip={t`Project Manager`}
color="default"
>
<ProjectManagerIcon />
</IconButton>
<IconButton
size="small"
id="toolbar-history-button"
onClick={props.onOpenVersionHistory}
tooltip={t`Open version history`}
color="default"
disabled={false}
>
<HistoryIcon />
</IconButton>
Expand Down Expand Up @@ -116,7 +103,6 @@ export default React.forwardRef<MainFrameToolbarProps, ToolbarInterface>(
{props.showProjectButtons ? (
<>
<LeftButtonsToolbarGroup
toggleProjectManager={props.toggleProjectManager}
onSave={props.onSave}
canSave={props.canSave}
onOpenVersionHistory={props.onOpenVersionHistory}
Expand Down
Loading
Loading