Skip to content

Commit

Permalink
Remove dashboard from profile dialog (#6113)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSi authored Dec 21, 2023
1 parent 0a6b0dc commit 5a2a389
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 97 deletions.
22 changes: 9 additions & 13 deletions newIDE/app/src/AssetStore/AssetPackInstallDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,10 @@ const AssetPackInstallDialog = ({
onApply: () => {},
content: (
<AlertMessage kind="warning">
<Text>
<Trans>
You need to save this project as a cloud project to install
premium assets. Please save your project and try again.
</Trans>
</Text>
<Trans>
You need to save this project as a cloud project to install
premium assets. Please save your project and try again.
</Trans>
</AlertMessage>
),
}
Expand All @@ -270,13 +268,11 @@ const AssetPackInstallDialog = ({
onApply: () => {},
content: (
<AlertMessage kind="warning">
<Text>
<Trans>
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.
</Trans>
</Text>
<Trans>
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.
</Trans>
</AlertMessage>
),
}
Expand Down
8 changes: 3 additions & 5 deletions newIDE/app/src/Profile/CurrentUsageDisplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ const CurrentUsageDisplayer = ({
return (
<ColumnStackLayout noMargin>
<AlertMessage kind="info">
<Text>
{remainingBuilds === 1
? remainingSingleMessage
: remainingMultipleMessage}
</Text>
{remainingBuilds === 1
? remainingSingleMessage
: remainingMultipleMessage}
</AlertMessage>
{hasSubscription && quota.limitReached && (
<GetSubscriptionCard subscriptionDialogOpeningReason="Build limit reached">
Expand Down
81 changes: 8 additions & 73 deletions newIDE/app/src/Profile/ProfileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand All @@ -40,20 +34,10 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => {
const badgesSeenNotificationTimeoutRef = React.useRef<?TimeoutID>(null);
const badgesSeenNotificationSentRef = React.useRef<boolean>(false);

const [openedGame, setOpenedGame] = React.useState<?Game>(null);
const [currentTab, setCurrentTab] = React.useState<ProfileTab>('profile');
const authenticatedUser = React.useContext(AuthenticatedUserContext);
const isUserLoading = authenticatedUser.loginState !== 'done';
const userAchievementsContainerRef = React.useRef<?HTMLDivElement>(null);
const {
games,
gamesFetchingError,
onGameUpdated,
fetchGames,
} = useGamesList();

const projectUuid = currentProject ? currentProject.getProjectUuid() : null;

const markBadgesAsSeen = React.useCallback(
(entries: IntersectionObserverEntry[]) => {
if (!(authenticatedUser.authenticated && authenticatedUser.profile)) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -242,33 +216,16 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => {
</Column>
</Line>
)}
{currentTab === 'games-dashboard' &&
(games ? (
<ColumnStackLayout>
<AlertMessage kind="info">
<Trans>
You can find the Games Dashboard on the home page under the
Manage tab.
</Trans>
</AlertMessage>
<GamesList
project={currentProject}
onRefreshGames={fetchGames}
games={games}
onGameUpdated={onGameUpdated}
onOpenGame={setOpenedGame}
/>
</ColumnStackLayout>
) : gamesFetchingError ? (
<PlaceholderError onRetry={fetchGames}>
{currentTab === 'games-dashboard' && (
<Column expand justifyContent="center" alignItems="center">
<AlertMessage kind="info">
<Trans>
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.
</Trans>
</PlaceholderError>
) : (
<PlaceholderLoader />
))}
</AlertMessage>
</Column>
)}
</>
) : (
<Column noMargin expand justifyContent="center">
Expand All @@ -287,28 +244,6 @@ const ProfileDialog = ({ currentProject, open, onClose }: Props) => {
/>
</Column>
)}
{openedGame && (
<GameDetailsDialog
game={openedGame}
project={
!!projectUuid && openedGame.id === projectUuid
? currentProject
: null
}
onClose={() => {
setOpenedGame(null);
}}
onGameUpdated={updatedGame => {
onGameUpdated(updatedGame);
setOpenedGame(updatedGame);
}}
onGameDeleted={() => {
setOpenedGame(null);
fetchGames();
}}
analyticsSource="profile"
/>
)}
</Dialog>
);
};
Expand Down
10 changes: 4 additions & 6 deletions newIDE/app/src/UI/ErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,10 @@ export const ErrorFallbackComponent = ({
<Divider />
<ColumnStackLayout>
<AlertMessage kind={isCriticalError ? 'error' : 'warning'}>
<Text>
<Trans>
Please <b>backup your game file</b> and save your game to ensure
that you don't lose anything.
</Trans>
</Text>
<Trans>
Please <b>backup your game file</b> and save your game to ensure
that you don't lose anything.
</Trans>
</AlertMessage>
<Text>
<Trans>
Expand Down

0 comments on commit 5a2a389

Please sign in to comment.