diff --git a/src/app/drive/components/ReachedPlanLimitDialog/ReachedPlanLimitDialog.tsx b/src/app/drive/components/ReachedPlanLimitDialog/ReachedPlanLimitDialog.tsx index de90f8c2b..7d60532e2 100644 --- a/src/app/drive/components/ReachedPlanLimitDialog/ReachedPlanLimitDialog.tsx +++ b/src/app/drive/components/ReachedPlanLimitDialog/ReachedPlanLimitDialog.tsx @@ -9,17 +9,26 @@ import workspacesSelectors from 'app/store/slices/workspaces/workspaces.selector const ReachedPlanLimitDialog = (): JSX.Element => { const { translate } = useTranslationContext(); const isOpen = useAppSelector((state) => state.ui.isReachedPlanLimitDialogOpen); + const reachedPlanLimitInfo = useAppSelector((state) => state.ui.reachedPlanLimitDialogInfo); const selectedWorkspace = useAppSelector(workspacesSelectors.getSelectedWorkspace); const dispatch = useAppDispatch(); const onClose = (): void => { - dispatch(uiActions.setIsReachedPlanLimitDialogOpen(false)); + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: false, + }), + ); }; const onAccept = async (): Promise => { try { - dispatch(uiActions.setIsReachedPlanLimitDialogOpen(false)); + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: false, + }), + ); navigationService.openPreferencesDialog({ section: 'account', subsection: 'plans', @@ -34,21 +43,25 @@ const ReachedPlanLimitDialog = (): JSX.Element => { return (
- + Drive storage error

- {translate('error.storageIsFull')} + {reachedPlanLimitInfo?.title ?? translate('error.storageIsFull')}

-

{translate('error.storageIsFullDescription')}

+

+ {reachedPlanLimitInfo?.description ?? translate('error.storageIsFullDescription')} +

- + {!reachedPlanLimitInfo?.hidePrimaryAction && ( + + )}
diff --git a/src/app/drive/types/index.ts b/src/app/drive/types/index.ts index 1beb2c251..3d50fea36 100644 --- a/src/app/drive/types/index.ts +++ b/src/app/drive/types/index.ts @@ -102,6 +102,12 @@ export interface DriveItemPatch { shares?: ShareLink[]; } +export interface ReachedPlanLimitDialogInfo { + title: string; + description: string; + hidePrimaryAction?: boolean; +} + export interface UpgradePlanDialogInfo { title: string; description: string; diff --git a/src/app/i18n/locales/de.json b/src/app/i18n/locales/de.json index 5d8202a6e..621c5fb84 100644 --- a/src/app/i18n/locales/de.json +++ b/src/app/i18n/locales/de.json @@ -1111,7 +1111,9 @@ "renamingItem": "Fehler beim Umbenennen von Elementen", "linkExpired": "Dieser sichere Link ist abgelaufen", "teamInvitation": "Die Einladungs-E-Mail konnte nicht gesendet werden", + "ownerStorageIsFull": "Der Speicher des Eigentümers ist voll", "storageIsFull": "Dein Speicher ist voll", + "ownerStorageIsFullDescription": "Du kannst in diesem geteilten Ordner keine Dateien hochladen.", "storageIsFullDescription": "Sie können keine Dateien hochladen, synchronisieren oder sichern.", "noSpaceAvailable": "Du hast die Grenzen deines aktuellen Plans erreicht und die Synchronisierung wurde gestoppt. Führe jetzt ein Upgrade durch, damit deine Dateien sicher synchronisiert bleiben.", "sharedFolderTooBig": "Internxt Drive unterstützt das Teilen von Ordnern mit mehr als 1 GB nicht.", diff --git a/src/app/i18n/locales/en.json b/src/app/i18n/locales/en.json index 88138249a..0fe2edfda 100644 --- a/src/app/i18n/locales/en.json +++ b/src/app/i18n/locales/en.json @@ -1185,7 +1185,9 @@ "renamingItem": "Error when renaming item/s", "linkExpired": "This secure link has expired", "teamInvitation": "The invitation email could not be sent", + "ownerStorageIsFull": "Owner storage is full", "storageIsFull": "Your storage is full", + "ownerStorageIsFullDescription": "You can’t upload files in this shared folder.", "storageIsFullDescription": "You can’t upload, sync or backup files.", "noSpaceAvailable": "You’ve reached the limits of your current plan and sync has stopped. Upgrade now to keep your files synced securely.", "sharedFolderTooBig": "Internxt Drive does not support sharing folders of more than 1GB.", diff --git a/src/app/i18n/locales/es.json b/src/app/i18n/locales/es.json index fb61b59a7..f2252d813 100644 --- a/src/app/i18n/locales/es.json +++ b/src/app/i18n/locales/es.json @@ -1162,7 +1162,9 @@ "renamingItem": "Error al renombrar ítem/s", "linkExpired": "Este enlace seguro ha caducado", "teamInvitation": "No se ha podido enviar el correo electrónico de invitación", + "ownerStorageIsFull": "El almacenamiento del propietario está lleno", "storageIsFull": "Tu almacenamiento está lleno", + "ownerStorageIsFullDescription": "No puedes subir archivos en esta carpeta compartida.", "storageIsFullDescription": "No puedes subir, sincronizar ni respaldar archivos.", "noSpaceAvailable": "Has alcanzado el límite y la sincronización se ha pausado. Mejora tu plan para mantener tus archivos sincronizados y seguros.", "sharedFolderTooBig": "Internxt Drive no admite compartir carpetas de más de 1 GB", diff --git a/src/app/i18n/locales/fr.json b/src/app/i18n/locales/fr.json index bca35a092..edd4d9bfa 100644 --- a/src/app/i18n/locales/fr.json +++ b/src/app/i18n/locales/fr.json @@ -1114,7 +1114,9 @@ "renamingItem": "Erreur lors du renommage d'éléments", "linkExpired": "Ce lien sécurisé a expiré", "teamInvitation": "Le courriel d'invitation n'a pas pu être envoyé", + "ownerStorageIsFull": "Le stockage du propriétaire est plein", "storageIsFull": "Votre espace de stockage est plein", + "ownerStorageIsFullDescription": "Vous ne pouvez pas téléverser de fichiers dans ce dossier partagé.", "storageIsFullDescription": "Vous ne pouvez pas télécharger, synchroniser ou sauvegarder des fichiers.", "noSpaceAvailable": "Vous avez atteint les limites de votre plan actuel et la synchronisation s'est arrêtée. Mettez-le à jour maintenant pour continuer à synchroniser vos fichiers en toute sécurité.", "sharedFolderTooBig": "Internxt Drive ne prend pas en charge le partage de dossiers de plus de 1 Go.", diff --git a/src/app/i18n/locales/it.json b/src/app/i18n/locales/it.json index 44595ea6b..4207b9802 100644 --- a/src/app/i18n/locales/it.json +++ b/src/app/i18n/locales/it.json @@ -1220,7 +1220,9 @@ "renamingItem": "Errore quando si rinominano gli elementi", "linkExpired": "Questo link sicuro è scaduto", "teamInvitation": "Non è stato possibile inviare l'e-mail di invito", + "ownerStorageIsFull": "Lo spazio di archiviazione del proprietario è pieno", "storageIsFull": "Lo spazio di archiviazione è pieno", + "ownerStorageIsFullDescription": "Non puoi caricare file in questa cartella condivisa.", "storageIsFullDescription": "Non puoi caricare, sincronizzare o eseguire il backup dei file", "noSpaceAvailable": "Avete raggiunto i limiti del vostro piano attuale e la sincronizzazione si è interrotta. Effettuate subito l'aggiornamento per continuare a sincronizzare i vostri file in modo sicuro.", "sharedFolderTooBig": "Internxt Drive non supporta la condivisione di cartelle di dimensioni superiori a 1 GB.", diff --git a/src/app/i18n/locales/ru.json b/src/app/i18n/locales/ru.json index ed1c1f90e..f5276db56 100644 --- a/src/app/i18n/locales/ru.json +++ b/src/app/i18n/locales/ru.json @@ -1128,7 +1128,9 @@ "renamingItem": "Ошибка при переименовании элементов", "linkExpired": "Срок действия этой безопасной ссылки истек", "teamInvitation": "Не удалось отправить письмо с приглашением", + "ownerStorageIsFull": "Хранилище владельца заполнено", "storageIsFull": "Ваше хранилище заполнено", + "ownerStorageIsFullDescription": "Вы не можете загружать файлы в эту общую папку.", "storageIsFullDescription": "Вы не можете загружать, синхронизировать или создавать резервные копии файлов.", "noSpaceAvailable": "Вы исчерпали лимит текущего тарифного плана, и синхронизация прекратилась. Перейдите на новый тарифный план, чтобы сохранить синхронизацию файлов в безопасности.", "sharedFolderTooBig": "Internxt Drive не поддерживает общий доступ к папкам объемом более 1 ГБ.", diff --git a/src/app/i18n/locales/tw.json b/src/app/i18n/locales/tw.json index 6b4eb7134..2b076749e 100644 --- a/src/app/i18n/locales/tw.json +++ b/src/app/i18n/locales/tw.json @@ -1115,7 +1115,9 @@ "renamingItem": "重命名項目時出錯", "linkExpired": "此安全鏈接已過期", "teamInvitation": "無法發送邀請郵件", + "ownerStorageIsFull": "擁有者的儲存空間已滿", "storageIsFull": "您的存儲空間已滿", + "ownerStorageIsFullDescription": "您無法在此共享資料夾中上傳檔案。", "storageIsFullDescription": "您無法上傳、同步或備份文件。", "noSpaceAvailable": "您已達到當前計劃的限制,同步已停止。立即升級以保持文件的安全同步。", "sharedFolderTooBig": "Internxt Drive不支持共享超過1GB的文件夾。", diff --git a/src/app/i18n/locales/zh.json b/src/app/i18n/locales/zh.json index c6c1c69b0..242cfdcdb 100644 --- a/src/app/i18n/locales/zh.json +++ b/src/app/i18n/locales/zh.json @@ -1150,7 +1150,9 @@ "renamingItem": "重命名项目时出错", "linkExpired": "此安全链接已过期", "teamInvitation": "邀请邮件无法发送", + "ownerStorageIsFull": "所有者的存储空间已满", "storageIsFull": "您的存储空间已满", + "ownerStorageIsFullDescription": "您无法在此共享文件夹中上传文件。", "storageIsFullDescription": "无法上传同步或备份文件", "noSpaceAvailable": "您已达到当前计划的限制,同步已停止。立即升级以确保您的文件安全同步。", "sharedFolderTooBig": "Internxt Drive 不支持共享超过 1GB 的文件夹。", diff --git a/src/app/store/slices/storage/storage.thunks/uploadItemsThunk.ts b/src/app/store/slices/storage/storage.thunks/uploadItemsThunk.ts index 91e58869e..c8f207112 100644 --- a/src/app/store/slices/storage/storage.thunks/uploadItemsThunk.ts +++ b/src/app/store/slices/storage/storage.thunks/uploadItemsThunk.ts @@ -76,7 +76,11 @@ const isUploadAllowed = ({ const isPlanSizeLimitExceeded = planLimit && totalItemsSize >= planLimit; if (isPlanSizeLimitExceeded) { - dispatch(uiActions.setIsReachedPlanLimitDialogOpen(true)); + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: true, + }), + ); return false; } } catch (err: unknown) { @@ -165,7 +169,12 @@ export const uploadItemsThunk = createAsyncThunk dispatch(uiActions.setIsReachedPlanLimitDialogOpen(true)); + const openMaxSpaceOccupiedDialog = () => + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: true, + }), + ); try { await uploadFileWithManager( @@ -249,15 +258,11 @@ export const uploadSharedItemsThunk = createAsyncThunk dispatch(uiActions.setIsReachedPlanLimitDialogOpen(true)); + const openMaxSpaceOccupiedDialog = () => + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: true, + info: { + title: t('error.ownerStorageIsFull'), + description: t('error.ownerStorageIsFullDescription'), + hidePrimaryAction: true, + }, + }), + ); try { await uploadFileWithManager( @@ -439,7 +454,12 @@ export const uploadItemsParallelThunk = createAsyncThunk dispatch(uiActions.setIsReachedPlanLimitDialogOpen(true)); + const openMaxSpaceOccupiedDialog = () => + dispatch( + uiActions.setOpenReachedPlanLimitDialog({ + open: true, + }), + ); try { await uploadFileWithManager( diff --git a/src/app/store/slices/ui/index.ts b/src/app/store/slices/ui/index.ts index 74c96de28..ec26fd8bb 100644 --- a/src/app/store/slices/ui/index.ts +++ b/src/app/store/slices/ui/index.ts @@ -1,5 +1,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { DriveItemData, DriveItemDetails, FileInfoMenuItem, UpgradePlanDialogInfo } from 'app/drive/types'; +import { + DriveItemData, + DriveItemDetails, + FileInfoMenuItem, + ReachedPlanLimitDialogInfo, + UpgradePlanDialogInfo, +} from 'app/drive/types'; import { PreviewFileItem } from '../../../share/types'; import { FileVersion } from '@internxt/sdk/dist/drive/storage/types'; @@ -20,6 +26,7 @@ interface UISliceState { isEditFolderNameDialog: boolean; isPreferencesDialogOpen: boolean; isReachedPlanLimitDialogOpen: boolean; + reachedPlanLimitDialogInfo?: ReachedPlanLimitDialogInfo; isUpgradePlanDialogOpen: boolean; currentUpgradePlanDialogInfo: UpgradePlanDialogInfo | null; isShareItemDialogOpen: boolean; @@ -137,8 +144,15 @@ export const uiSlice = createSlice({ setIsPreferencesDialogOpen: (state: UISliceState, action: PayloadAction) => { state.isPreferencesDialogOpen = action.payload; }, - setIsReachedPlanLimitDialogOpen: (state: UISliceState, action: PayloadAction) => { - state.isReachedPlanLimitDialogOpen = action.payload; + setOpenReachedPlanLimitDialog: ( + state: UISliceState, + action: PayloadAction<{ + open: boolean; + info?: ReachedPlanLimitDialogInfo; + }>, + ) => { + state.isReachedPlanLimitDialogOpen = action.payload.open; + state.reachedPlanLimitDialogInfo = action.payload.info; }, setIsUpgradePlanDialogOpen: (state: UISliceState, action: PayloadAction) => { state.isUpgradePlanDialogOpen = action.payload; @@ -206,7 +220,7 @@ export const { setIsMoveItemsDialogOpen, setIsPreferencesDialogOpen, setIsFileLoggerOpen, - setIsReachedPlanLimitDialogOpen, + setOpenReachedPlanLimitDialog, setIsUpgradePlanDialogOpen, setCurrentUpgradePlanDialogInfo, setIsShareItemDialogOpen, diff --git a/src/services/error.service.ts b/src/services/error.service.ts index 2d55027d1..6898f6a08 100644 --- a/src/services/error.service.ts +++ b/src/services/error.service.ts @@ -43,6 +43,7 @@ const errorService = { castedError = new AppError(err); } else if (err instanceof Error) { const headers = (err as ErrorWithStatus).headers; + castedError = new AppError(err.message || 'Unknown error', (err as ErrorWithStatus).status, undefined, headers); } else { const map = err as Record; diff --git a/src/upload.worker.ts b/src/upload.worker.ts index 3b96fd3c9..13c6c91a2 100644 --- a/src/upload.worker.ts +++ b/src/upload.worker.ts @@ -37,7 +37,7 @@ self.addEventListener('message', async (event) => { postMessage({ result: 'success', fileId }); } catch (err) { console.log('[WORKER] ERROR -->', err); - const errorCloned = JSON.parse(JSON.stringify(err)); + const errorCloned = { ...JSON.parse(JSON.stringify(err)), message: (err as { message?: string })?.message }; postMessage({ result: 'error', error: errorCloned }); } } else {