diff --git a/apps/admin-x-settings/src/components/settings/site/ThemeModal.tsx b/apps/admin-x-settings/src/components/settings/site/ThemeModal.tsx index b754e7558c..c6aedea908 100644 --- a/apps/admin-x-settings/src/components/settings/site/ThemeModal.tsx +++ b/apps/admin-x-settings/src/components/settings/site/ThemeModal.tsx @@ -47,6 +47,8 @@ const ThemeToolbar: React.FC = ({ const [uploadConfig, setUploadConfig] = useState<{enabled: boolean; error?: string}>(); + const [isUploading, setUploading] = useState(false); + useEffect(() => { if (limiter) { // Sending a bad string to make sure it fails (empty string isn't valid) @@ -76,8 +78,11 @@ const ThemeToolbar: React.FC = ({ let data: ThemesInstallResponseType | undefined; try { + setUploading(true); data = await uploadTheme({file}); + setUploading(false); } catch (e) { + setUploading(false); handleError(e); } @@ -170,7 +175,9 @@ const ThemeToolbar: React.FC = ({ okRunningLabel: 'Overwriting...', okColor: 'red', onOk: async (confirmModal) => { + setUploading(true); await handleThemeUpload({file, onActivate: onClose}); + setUploading(false); setCurrentTab('installed'); confirmModal?.remove(); } @@ -180,7 +187,7 @@ const ThemeToolbar: React.FC = ({ handleThemeUpload({file, onActivate: onClose}); } }}> -