Skip to content

Commit

Permalink
[WIP] Unified Create tab
Browse files Browse the repository at this point in the history
- [ ] Display recent local files as games
- [ ] Display "Open project" button (with arrow if multiples)
- [x] Display cloud/local projects in game dashboard for a game
  - [ ] Probably merge also projects without game id but with the same name.
  - [ ] Ensure we always save the game id
  - [ ] Adapt the wording if nothing is found.
- [ ] Add button to Create a game or Import in the Manage tab
- [ ] Create a new "new project dialog" showing templates/AI/from scratch
- [ ] Remove Build tab
- [ ] Rename Manage tab
- [ ] ???
  • Loading branch information
4ian committed Nov 15, 2024
1 parent dda85cf commit 000a6b2
Show file tree
Hide file tree
Showing 17 changed files with 504 additions and 21 deletions.
36 changes: 36 additions & 0 deletions newIDE/app/src/GameDashboard/Widgets/ProjectsWidget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// @flow
import * as React from 'react';
import { I18n } from '@lingui/react';
import { Trans } from '@lingui/macro';
import { type Game } from '../../Utils/GDevelopServices/Game';
import {
type FileMetadataAndStorageProviderName,
type FileMetadata,
type StorageProvider,
} from '../../ProjectsStorage';
import DashboardWidget from './DashboardWidget';
import ProjectFileList from '../../MainFrame/EditorContainers/HomePage/CreateSection/ProjectFileList';

type Props = {|
game: Game,
onOpenRecentFile: (file: FileMetadataAndStorageProviderName) => Promise<void>,
storageProviders: Array<StorageProvider>,

project: ?gdProject,
currentFileMetadata: ?FileMetadata,
closeProject: () => Promise<void>,
|};

const ProjectsWidget = (props: Props) => {
return (
<I18n>
{({ i18n }) => (
<DashboardWidget gridSize={3} title={<Trans>Projects</Trans>}>
<ProjectFileList {...props} i18n={i18n} />
</DashboardWidget>
)}
</I18n>
);
};

export default ProjectsWidget;
45 changes: 38 additions & 7 deletions newIDE/app/src/GameDashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ import {
getAclsFromUserIds,
setGameUserAcls,
} from '../Utils/GDevelopServices/Game';
import {
type FileMetadataAndStorageProviderName,
type FileMetadata,
type StorageProvider,
} from '../ProjectsStorage';
import { ColumnStackLayout } from '../UI/Layout';
import GameHeader from './GameHeader';
import FeedbackWidget from './Widgets/FeedbackWidget';
Expand Down Expand Up @@ -51,6 +56,7 @@ import PublicGamePropertiesDialog, {
} from './PublicGamePropertiesDialog';
import useAlertDialog from '../UI/Alert/useAlertDialog';
import { showErrorBox } from '../UI/Messages/MessageBox';
import ProjectsWidget from './Widgets/ProjectsWidget';

export type GameDetailsTab =
| 'details'
Expand All @@ -61,26 +67,43 @@ export type GameDetailsTab =
| 'leaderboards';

type Props = {|
// Project handling:
project?: ?gdProject,
currentFileMetadata: ?FileMetadata,
onOpenRecentFile: (file: FileMetadataAndStorageProviderName) => Promise<void>,
storageProviders: Array<StorageProvider>,
closeProject: () => Promise<void>,

// Current game:
game: Game,
analyticsSource: 'profile' | 'homepage' | 'projectManager',
currentView: GameDetailsTab,
setCurrentView: GameDetailsTab => void,
onBack: () => void,
onGameUpdated: (game: Game) => void,
onUnregisterGame: (i18n: I18nType) => Promise<void>,
gameUnregisterErrorText: ?React.Node,

// Navigation:
currentView: GameDetailsTab,
setCurrentView: GameDetailsTab => void,
onBack: () => void,
|};

const GameDashboard = ({
// Project handling:
project,
currentFileMetadata,
onOpenRecentFile,
storageProviders,
closeProject,

// Current game:
game,
currentView,
setCurrentView,
onBack,
onGameUpdated,
onUnregisterGame,
gameUnregisterErrorText,

// Navigation:
currentView,
setCurrentView,
onBack,
}: Props) => {
const [
gameDetailsDialogOpen,
Expand Down Expand Up @@ -534,6 +557,14 @@ const GameDashboard = ({
displayUnlockMoreLeaderboardsCallout
}
/>
<ProjectsWidget
project={project}
currentFileMetadata={currentFileMetadata}
game={game}
onOpenRecentFile={onOpenRecentFile}
storageProviders={storageProviders}
closeProject={closeProject}
/>
<BuildsWidget
builds={builds}
onSeeAllBuilds={() => setCurrentView('builds')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import SectionContainer, { SectionRow } from '../SectionContainer';
import {
checkIfHasTooManyCloudProjects,
MaxProjectCountAlertMessage,
} from './MaxProjectCountAlertMessage';
} from '../CreateSection/MaxProjectCountAlertMessage';
import { ExampleStoreContext } from '../../../../AssetStore/ExampleStore/ExampleStoreContext';
import { SubscriptionSuggestionContext } from '../../../../Profile/Subscription/SubscriptionSuggestionContext';
import { type ExampleShortHeader } from '../../../../Utils/GDevelopServices/Example';
Expand All @@ -41,15 +41,15 @@ import { type PrivateGameTemplateListingData } from '../../../../Utils/GDevelopS
import { PrivateGameTemplateStoreContext } from '../../../../AssetStore/PrivateGameTemplates/PrivateGameTemplateStoreContext';
import ChevronArrowRight from '../../../../UI/CustomSvgIcons/ChevronArrowRight';
import Refresh from '../../../../UI/CustomSvgIcons/Refresh';
import ProjectFileListItem from './ProjectFileListItem';
import ProjectFileListItem from '../CreateSection/ProjectFileListItem';
import { type MenuItemTemplate } from '../../../../UI/Menu/Menu.flow';
import {
getAllGameTemplatesAndExamplesFlaggedAsGameCount,
getExampleAndTemplateItemsForBuildSection,
getLastModifiedInfoByProjectId,
getProjectLineHeight,
transformCloudProjectsIntoFileMetadataWithStorageProviderName,
} from './utils';
} from '../CreateSection/utils';
import ErrorBoundary from '../../../../UI/ErrorBoundary';
import InfoBar from '../../../../UI/Messages/InfoBar';
import GridList from '@material-ui/core/GridList';
Expand Down
Loading

0 comments on commit 000a6b2

Please sign in to comment.