From 5a2a3893f99d3b7ce79261af57ccbc058fe6499a Mon Sep 17 00:00:00 2001 From: AlexandreS <32449369+AlexandreSi@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:08:23 +0100 Subject: [PATCH] Remove dashboard from profile dialog (#6113) --- .../src/AssetStore/AssetPackInstallDialog.js | 22 +++-- .../app/src/Profile/CurrentUsageDisplayer.js | 8 +- newIDE/app/src/Profile/ProfileDialog.js | 81 ++----------------- newIDE/app/src/UI/ErrorBoundary.js | 10 +-- 4 files changed, 24 insertions(+), 97 deletions(-) diff --git a/newIDE/app/src/AssetStore/AssetPackInstallDialog.js b/newIDE/app/src/AssetStore/AssetPackInstallDialog.js index 28e458199d80..24048d9d5e57 100644 --- a/newIDE/app/src/AssetStore/AssetPackInstallDialog.js +++ b/newIDE/app/src/AssetStore/AssetPackInstallDialog.js @@ -247,12 +247,10 @@ const AssetPackInstallDialog = ({ onApply: () => {}, content: ( - - - You need to save this project as a cloud project to install - premium assets. Please save your project and try again. - - + + You need to save this project as a cloud project to install + premium assets. Please save your project and try again. + ), } @@ -270,13 +268,11 @@ const AssetPackInstallDialog = ({ onApply: () => {}, content: ( - - - You can only install up to {MAX_ASSETS_TO_INSTALL} assets at - once. Try filtering the assets you would like to install, or - install them one by one. - - + + You can only install up to {MAX_ASSETS_TO_INSTALL} assets at + once. Try filtering the assets you would like to install, or + install them one by one. + ), } diff --git a/newIDE/app/src/Profile/CurrentUsageDisplayer.js b/newIDE/app/src/Profile/CurrentUsageDisplayer.js index c2c77979d6ed..9975c1a66a37 100644 --- a/newIDE/app/src/Profile/CurrentUsageDisplayer.js +++ b/newIDE/app/src/Profile/CurrentUsageDisplayer.js @@ -45,11 +45,9 @@ const CurrentUsageDisplayer = ({ return ( - - {remainingBuilds === 1 - ? remainingSingleMessage - : remainingMultipleMessage} - + {remainingBuilds === 1 + ? remainingSingleMessage + : remainingMultipleMessage} {hasSubscription && quota.limitReached && ( diff --git a/newIDE/app/src/Profile/ProfileDialog.js b/newIDE/app/src/Profile/ProfileDialog.js index 7bbdeef1ca47..a877ae3f36c4 100644 --- a/newIDE/app/src/Profile/ProfileDialog.js +++ b/newIDE/app/src/Profile/ProfileDialog.js @@ -12,7 +12,6 @@ import SubscriptionDetails from './Subscription/SubscriptionDetails'; import ContributionsDetails from './ContributionsDetails'; import UserAchievements from './Achievement/UserAchievements'; import AuthenticatedUserContext from './AuthenticatedUserContext'; -import GamesList from '../GameDashboard/GamesList'; import { getRedirectToSubscriptionPortalUrl } from '../Utils/GDevelopServices/Usage'; import Window from '../Utils/Window'; import { showErrorBox } from '../UI/Messages/MessageBox'; @@ -21,11 +20,6 @@ import PlaceholderLoader from '../UI/PlaceholderLoader'; import useIsElementVisibleInScroll from '../Utils/UseIsElementVisibleInScroll'; import { markBadgesAsSeen as doMarkBadgesAsSeen } from '../Utils/GDevelopServices/Badge'; import ErrorBoundary from '../UI/ErrorBoundary'; -import PlaceholderError from '../UI/PlaceholderError'; -import useGamesList from '../GameDashboard/UseGamesList'; -import { type Game } from '../Utils/GDevelopServices/Game'; -import { GameDetailsDialog } from '../GameDashboard/GameDetailsDialog'; -import { ColumnStackLayout } from '../UI/Layout'; import AlertMessage from '../UI/AlertMessage'; export type ProfileTab = 'profile' | 'games-dashboard'; @@ -40,20 +34,10 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => { const badgesSeenNotificationTimeoutRef = React.useRef(null); const badgesSeenNotificationSentRef = React.useRef(false); - const [openedGame, setOpenedGame] = React.useState(null); const [currentTab, setCurrentTab] = React.useState('profile'); const authenticatedUser = React.useContext(AuthenticatedUserContext); const isUserLoading = authenticatedUser.loginState !== 'done'; const userAchievementsContainerRef = React.useRef(null); - const { - games, - gamesFetchingError, - onGameUpdated, - fetchGames, - } = useGamesList(); - - const projectUuid = currentProject ? currentProject.getProjectUuid() : null; - const markBadgesAsSeen = React.useCallback( (entries: IntersectionObserverEntry[]) => { if (!(authenticatedUser.authenticated && authenticatedUser.profile)) { @@ -134,16 +118,6 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => { [authenticatedUser.onRefreshUserProfile, open] // eslint-disable-line react-hooks/exhaustive-deps ); - // Only fetch games if the user decides to open the games dashboard tab. - React.useEffect( - () => { - if (currentTab === 'games-dashboard' && !games) { - fetchGames(); - } - }, - [fetchGames, currentTab, games] - ); - const onLogout = React.useCallback( async () => { await authenticatedUser.onLogout(); @@ -242,33 +216,16 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => { )} - {currentTab === 'games-dashboard' && - (games ? ( - - - - You can find the Games Dashboard on the home page under the - Manage tab. - - - - - ) : gamesFetchingError ? ( - + {currentTab === 'games-dashboard' && ( + + - Can't load the games. Verify your internet connection or retry - later. + You can now find the Games Dashboard on the home page under + the Manage tab. - - ) : ( - - ))} + + + )} ) : ( @@ -287,28 +244,6 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => { /> )} - {openedGame && ( - { - setOpenedGame(null); - }} - onGameUpdated={updatedGame => { - onGameUpdated(updatedGame); - setOpenedGame(updatedGame); - }} - onGameDeleted={() => { - setOpenedGame(null); - fetchGames(); - }} - analyticsSource="profile" - /> - )} ); }; diff --git a/newIDE/app/src/UI/ErrorBoundary.js b/newIDE/app/src/UI/ErrorBoundary.js index a10beaa0f0e9..a3646a163d7b 100644 --- a/newIDE/app/src/UI/ErrorBoundary.js +++ b/newIDE/app/src/UI/ErrorBoundary.js @@ -207,12 +207,10 @@ export const ErrorFallbackComponent = ({ - - - Please backup your game file and save your game to ensure - that you don't lose anything. - - + + Please backup your game file and save your game to ensure + that you don't lose anything. +