From 20175a3f350cf6c632dedf61cd8bf344c67f9a32 Mon Sep 17 00:00:00 2001 From: AlexandreSi <32449369+AlexandreSi@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:26:07 +0200 Subject: [PATCH 1/2] Do not display callout if user saving quick customization --- .../src/QuickCustomization/QuickPublish.js | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/newIDE/app/src/QuickCustomization/QuickPublish.js b/newIDE/app/src/QuickCustomization/QuickPublish.js index 32f8605a1fb5..12e2acefc1c1 100644 --- a/newIDE/app/src/QuickCustomization/QuickPublish.js +++ b/newIDE/app/src/QuickCustomization/QuickPublish.js @@ -68,6 +68,10 @@ export const QuickPublish = ({ const eventsFunctionsExtensionsState = React.useContext( EventsFunctionsExtensionsContext ); + const [ + numberOfCloudProjectsBeforeSavingCustomizedGame, + setNumberOfCloudProjectsBeforeSavingCustomizedGame, + ] = React.useState(null); const [exportState, setExportState] = React.useState< '' | 'started' | 'succeeded' | 'errored' >(''); @@ -94,12 +98,29 @@ export const QuickPublish = ({ /> ); + React.useEffect( + () => { + if (!cloudProjects) { + setNumberOfCloudProjectsBeforeSavingCustomizedGame(null); + } else if (numberOfCloudProjectsBeforeSavingCustomizedGame === null) { + setNumberOfCloudProjectsBeforeSavingCustomizedGame( + cloudProjects.filter(cloudProject => !cloudProject.deletedAt).length + ); + } + }, + // Store the number of cloud projects **before** the user saved this quick-customized + // game. Otherwise, they might reach the max number saving it, and the callout would + // be displayed instead of the game link. + [cloudProjects, numberOfCloudProjectsBeforeSavingCustomizedGame] + ); + const isLoadingCloudProjects = !!profile && !cloudProjects; const isCloudProjectsMaximumReached = !!limits && !!cloudProjects && limits.capabilities.cloudProjects.maximumCount > 0 && - cloudProjects.filter(cloudProject => !cloudProject.deletedAt).length >= + numberOfCloudProjectsBeforeSavingCustomizedGame !== null && + numberOfCloudProjectsBeforeSavingCustomizedGame >= limits.capabilities.cloudProjects.maximumCount; const shouldSaveAndLaunchExport = !!profile && From 491dda858630be4416fff8b2bb4c2dd23769dc72 Mon Sep 17 00:00:00 2001 From: AlexandreSi <32449369+AlexandreSi@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:27:08 +0200 Subject: [PATCH 2/2] Display max project reached callout at the end of the projects list on mobile --- .../HomePage/BuildSection/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/newIDE/app/src/MainFrame/EditorContainers/HomePage/BuildSection/index.js b/newIDE/app/src/MainFrame/EditorContainers/HomePage/BuildSection/index.js index 22e29cb7ca04..f5ead751e995 100644 --- a/newIDE/app/src/MainFrame/EditorContainers/HomePage/BuildSection/index.js +++ b/newIDE/app/src/MainFrame/EditorContainers/HomePage/BuildSection/index.js @@ -449,7 +449,7 @@ const BuildSection = ({ ( @@ -618,6 +618,19 @@ const BuildSection = ({ } /> ))} + {isMobile && limits && hasTooManyCloudProjects && ( + + openSubscriptionDialog({ + analyticsMetadata: { + reason: 'Cloud Project limit reached', + }, + }) + } + /> + )}