From 93dd41ff7edf4c8a9027fb906cecfca63bf81506 Mon Sep 17 00:00:00 2001 From: Tatiana Lopaeva Date: Wed, 14 Aug 2024 14:46:06 +0300 Subject: [PATCH] Client: Changed translation for personal quota. --- .../client/public/locales/en/MainBar.json | 4 +- packages/client/src/components/MainBar/Bar.js | 37 ++++++-------- .../src/components/MainBar/QuotasBar.js | 49 ++++++++++++------- packages/shared/store/CurrentQuotaStore.ts | 2 +- 4 files changed, 50 insertions(+), 42 deletions(-) diff --git a/packages/client/public/locales/en/MainBar.json b/packages/client/public/locales/en/MainBar.json index f43f6444c0..a94d079d43 100644 --- a/packages/client/public/locales/en/MainBar.json +++ b/packages/client/public/locales/en/MainBar.json @@ -22,5 +22,7 @@ "UserTariffLimit": "The limit is reached for the number of admins/power users: {{currentValue}} / {{maxValue}}", "StorageTariffLimit": "The limit is reached for storage space: {{currentValue}} / {{maxValue}}", "RemoveFilesOrClickToUpgrade": "Remove the unnecessary files or <1>click here to upgrade your tariff plan.", - "RemoveFilesOrContactToUpgrade": "Remove the unnecessary files or contact the {{productName}} administrator to upgrade the tariff plan." + "RemoveFilesOrContactToUpgrade": "Remove the unnecessary files or contact the {{productName}} administrator to upgrade the tariff plan.", + "StorageQuotaPerUserExceeded": "Storage quota per user exceeded", + "PersonalStorageQuotaExceed": "Your personal storage quota exceeded" } diff --git a/packages/client/src/components/MainBar/Bar.js b/packages/client/src/components/MainBar/Bar.js index 21721eb7b6..a21a94cb26 100644 --- a/packages/client/src/components/MainBar/Bar.js +++ b/packages/client/src/components/MainBar/Bar.js @@ -74,7 +74,7 @@ const Bar = (props) => { currentColorScheme, setMainBarVisible, - showUserPersonalQuotaBar, + isPersonalQuotaLimit, tenantCustomQuota, isStorageTariffLimit, @@ -140,10 +140,7 @@ const Bar = (props) => { usersTariff: !closed.includes(QuotaBarTypes.UsersTariff), })); } - console.log( - "!closed.includes(QuotaBarTypes.StorageTariff)", - !closed.includes(QuotaBarTypes.StorageTariff), - ); + if (isAdmin || isPowerUser || isRoomAdmin) { setBarVisible((value) => ({ ...value, @@ -151,7 +148,9 @@ const Bar = (props) => { storageTariffLimit: !closed.includes( QuotaBarTypes.StorageTariffLimit, ), + tenantCustomQuota: !closed.includes(QuotaBarTypes.TenantCustomQuota), + personalUserQuota: !closed.includes(QuotaBarTypes.PersonalUserQuota), })); } @@ -172,7 +171,7 @@ const Bar = (props) => { storageAndUserQuota: isAdmin, storageAndRoomQuota: isAdmin, confirmEmail: true, - personalUserQuota: true, + personalUserQuota: isAdmin || isPowerUser || isRoomAdmin, }); } @@ -275,9 +274,9 @@ const Bar = (props) => { // case QuotaBarTypes.RoomAndStorageQuota: // setBarVisible((value) => ({ ...value, storageAndRoomQuota: false })); // break; - // case QuotaBarTypes.PersonalUserQuota: - // setBarVisible((value) => ({ ...value, personalUserQuota: false })); - // break; + case QuotaBarTypes.PersonalUserQuota: + setBarVisible((value) => ({ ...value, personalUserQuota: false })); + break; } setMaintenanceExist(false); @@ -336,11 +335,6 @@ const Bar = (props) => { // }; // } - console.log( - "isStorageTariffAlmostLimit", - isStorageTariffAlmostLimit, - barVisible.storageTariff, - ); if (isStorageTariffAlmostLimit && barVisible.storageTariff) { return { type: QuotaBarTypes.StorageTariff, @@ -372,12 +366,13 @@ const Bar = (props) => { currentValue: addedManagersCount, }; } + console.log("isPersonalQuotaLimit", isPersonalQuotaLimit); + if (isPersonalQuotaLimit && barVisible.personalUserQuota) { + return { + type: QuotaBarTypes.PersonalUserQuota, + }; + } - // if (showUserPersonalQuotaBar && barVisible.personalUserQuota) { - // return { - // type: QuotaBarTypes.PersonalUserQuota, - // }; - // } return null; }; @@ -452,7 +447,7 @@ export default inject( showRoomQuotaBar, isStorageTariffAlmostLimit, isUserTariffAlmostLimit, - showUserPersonalQuotaBar, + isPersonalQuotaLimit, tenantCustomQuota, isStorageTariffLimit, isUserTariffLimit, @@ -486,7 +481,7 @@ export default inject( currentColorScheme, setMainBarVisible, - showUserPersonalQuotaBar, + isPersonalQuotaLimit, tenantCustomQuota, isStorageTariffLimit, isUserTariffLimit, diff --git a/packages/client/src/components/MainBar/QuotasBar.js b/packages/client/src/components/MainBar/QuotasBar.js index ac4590f779..3a0dab8335 100644 --- a/packages/client/src/components/MainBar/QuotasBar.js +++ b/packages/client/src/components/MainBar/QuotasBar.js @@ -193,6 +193,33 @@ const QuotasBar = ({ /> ); }; + + const getPersonalQuotaDescription = () => { + if (!isAdmin) return t("PersonalUserQuotaDescription"); + + return ( + + ), + }} + /> + ); + }; + + const getPersonalQuotaHeader = () => { + if (!isAdmin) return t("PersonalStorageQuotaExceed"); + return t("StorageQuotaPerUserExceeded"); + }; const getQuotaInfo = () => { switch (type) { case QuotaBarTypes.RoomQuota: @@ -237,7 +264,7 @@ const QuotasBar = ({ header: t("UserQuotaHeader", { currentValue, maxValue }), description: getUserTariffAlmostLimit(), }; - case QuotaBarTypes.TariffLimitPerUser: + case QuotaBarTypes.UsersTariffLimit: return { header: t("UserTariffLimit", { currentValue, maxValue }), description: getUserTariffLimit(), @@ -253,25 +280,9 @@ const QuotasBar = ({ description: getUserQuotaDescription(), }; case QuotaBarTypes.PersonalUserQuota: - const description = !isAdmin ? ( - t("PersonalUserQuotaDescription") - ) : ( - - To upload and create new files and folders, please free up disk - space, or manage quota per user in the - - Storage management settings. - - - ); return { - header: t("StorageQuotaExceeded"), - description, + header: getPersonalQuotaHeader(), + description: getPersonalQuotaDescription(), }; default: diff --git a/packages/shared/store/CurrentQuotaStore.ts b/packages/shared/store/CurrentQuotaStore.ts index f3d87984dd..9542a4224f 100644 --- a/packages/shared/store/CurrentQuotaStore.ts +++ b/packages/shared/store/CurrentQuotaStore.ts @@ -304,7 +304,7 @@ class CurrentQuotasStore { return this.currentTariffStatusStore?.isGracePeriod; }; - get showUserPersonalQuotaBar() { + get isPersonalQuotaLimit() { const personalQuotaLimitReached = this.userStore?.personalQuotaLimitReached; if (!this.isDefaultUsersQuotaSet) return false;