diff --git a/packages/client/public/locales/en/MainBar.json b/packages/client/public/locales/en/MainBar.json index 2627e7627d..55ce471cc6 100644 --- a/packages/client/public/locales/en/MainBar.json +++ b/packages/client/public/locales/en/MainBar.json @@ -14,7 +14,10 @@ "StorageQuotaHeader": "Storage space amount is about to be exceeded: {{currentValue}} / {{maxValue}}", "StorageQuotaUserDescription": "You can remove the unnecessary files to free up disk space.", "TenantCustomQuotaDescription": "You can remove the unnecessary files or change quota in the <1>Storage management settings.", - "UserTariffAlmostReachedForAdmins": "Once the limit is reached, all users will be added with user permissions only. To be able to add further admins/power users, <1>click here to upgrade your tariff plan.", - "UserTariffAlmostReached": "Once the limit is reached, all users will be added with user permissions only. To be able to add further admins/power users, contact the DocSpace administrator to upgrade the tariff plan.", - "UserQuotaHeader": "The number of admins/power users is about to be exceeded: {{currentValue}} / {{maxValue}}." + "UserTariffAlmostReachedForAdmins": "Once the limit is reached, all users will be added with User permissions only. To be able to add further admins/power users, <1>click here to upgrade your tariff plan.", + "UserTariffAlmostReached": "Once the limit is reached, all users will be added with User permissions only. To be able to add further admins/power users, contact the DocSpace administrator to upgrade the tariff plan.", + "UserTariffReachedForAdmins": "All users will be added with User permissions only. To be able to add further admins/power users, <1>click here to upgrade your tariff plan.", + "UserTariffReached": "All users will be added with User permissions only. To be able to add further admins/power users, contact the DocSpace administrator to upgrade the tariff plan.", + "UserQuotaHeader": "The number of admins/power users is about to be exceeded: {{currentValue}} / {{maxValue}}.", + "UserTariffLimit": "The limit is reached for the number of admins/power users: {{currentValue}} / {{maxValue}}" } diff --git a/packages/client/src/components/MainBar/Bar.js b/packages/client/src/components/MainBar/Bar.js index 2cc0eae20a..e71c886f12 100644 --- a/packages/client/src/components/MainBar/Bar.js +++ b/packages/client/src/components/MainBar/Bar.js @@ -78,6 +78,7 @@ const Bar = (props) => { tenantCustomQuota, showTenantCustomQuotaBar, + isUserTariffLimit, } = props; const navigate = useNavigate(); @@ -87,6 +88,7 @@ const Bar = (props) => { storageQuota: false, tenantCustomQuota: false, almostTariffLimitPerUser: false, + tariffLimitPerUser: false, storageAndUserQuota: false, storageAndRoomQuota: false, confirmEmail: false, @@ -129,10 +131,13 @@ const Bar = (props) => { ), })); } + if (isAdmin || isRoomAdmin) { setBarVisible((value) => ({ ...value, - + tariffLimitPerUser: !closed.includes( + QuotaBarTypes.TariffLimitPerUser, + ), almostTariffLimitPerUser: !closed.includes( QuotaBarTypes.AlmostTariffLimitPerUser, ), @@ -158,6 +163,7 @@ const Bar = (props) => { storageQuota: isAdmin || isPowerUser || isRoomAdmin, tenantCustomQuota: isAdmin || isPowerUser || isRoomAdmin, almostTariffLimitPerUser: isAdmin | isRoomAdmin, + tariffLimitPerUser: isAdmin | isRoomAdmin, storageAndUserQuota: isAdmin, storageAndRoomQuota: isAdmin, confirmEmail: true, @@ -249,6 +255,12 @@ const Bar = (props) => { almostTariffLimitPerUser: false, })); break; + case QuotaBarTypes.TariffLimitPerUser: + setBarVisible((value) => ({ + ...value, + tariffLimitPerUser: false, + })); + break; case QuotaBarTypes.UserAndStorageQuota: setBarVisible((value) => ({ ...value, storageAndUserQuota: false })); break; @@ -322,6 +334,14 @@ const Bar = (props) => { }; } + if (isUserTariffLimit && barVisible.tariffLimitPerUser) { + return { + type: QuotaBarTypes.TariffLimitPerUser, + maxValue: maxCountManagersByQuota, + currentValue: addedManagersCount, + }; + } + if ( showAlmostReachedUserTariffLimit && barVisible.almostTariffLimitPerUser @@ -415,6 +435,7 @@ export default inject( showUserPersonalQuotaBar, tenantCustomQuota, showTenantCustomQuotaBar, + isUserTariffLimit, } = currentQuotaStore; const { currentColorScheme, setMainBarVisible } = settingsStore; @@ -448,6 +469,7 @@ export default inject( showUserPersonalQuotaBar, tenantCustomQuota, showTenantCustomQuotaBar, + isUserTariffLimit, }; }, )(withTranslation(["Profile", "Common"])(observer(Bar))); diff --git a/packages/client/src/components/MainBar/QuotasBar.js b/packages/client/src/components/MainBar/QuotasBar.js index c327b9127c..3933c8d1f1 100644 --- a/packages/client/src/components/MainBar/QuotasBar.js +++ b/packages/client/src/components/MainBar/QuotasBar.js @@ -116,7 +116,55 @@ const QuotasBar = ({ /> ); }; + const getUserTariffAlmostLimit = () => { + if (!isAdmin) return t("UserTariffAlmostReached"); + return ( + + ), + }} + /> + ); + }; + + const getUserTariffLimit = () => { + if (!isAdmin) return t("UserTariffReached"); + + return ( + + ), + }} + /> + ); + }; const getQuotaInfo = () => { switch (type) { case QuotaBarTypes.RoomQuota: @@ -154,9 +202,13 @@ const QuotasBar = ({ case QuotaBarTypes.AlmostTariffLimitPerUser: return { header: t("UserQuotaHeader", { currentValue, maxValue }), - description: getUserQuotaDescription(), + description: getUserTariffAlmostLimit(), + }; + case QuotaBarTypes.TariffLimitPerUser: + return { + header: t("UserTariffLimit", { currentValue, maxValue }), + description: getUserTariffLimit(), }; - case QuotaBarTypes.UserAndStorageQuota: return { header: t("StorageAndUserHeader", { currentValue, maxValue }), diff --git a/packages/client/src/helpers/constants.js b/packages/client/src/helpers/constants.js index 690e518378..4769beed84 100644 --- a/packages/client/src/helpers/constants.js +++ b/packages/client/src/helpers/constants.js @@ -99,6 +99,7 @@ export const QuotaBarTypes = Object.freeze({ RoomQuota: "room-quota", StorageQuota: "storage-quota", AlmostTariffLimitPerUser: "user-quota", + TariffLimitPerUser: "user-quota-limit", UserAndStorageQuota: "user-storage-quota", RoomAndStorageQuota: "room-storage-quota", PersonalUserQuota: "personal-user-quota", diff --git a/packages/shared/store/CurrentQuotaStore.ts b/packages/shared/store/CurrentQuotaStore.ts index 94488251c9..f6b56b75b7 100644 --- a/packages/shared/store/CurrentQuotaStore.ts +++ b/packages/shared/store/CurrentQuotaStore.ts @@ -276,12 +276,12 @@ class CurrentQuotasStore { this.addedManagersCount > 1 && this.maxCountManagersByQuota - this.addedManagersCount <= COUNT_FOR_SHOWING_BAR && - this.maxCountManagersByQuota >= this.addedManagersCount + this.maxCountManagersByQuota > this.addedManagersCount ); } - get showReachedUserTariffLimit() { - return null; + get isUserTariffLimit() { + return this.isPaidUserLimit; } get isPaidUserLimit() {