Client: Updated bar for user and storage.

This commit is contained in:
Tatiana Lopaeva 2024-08-14 16:37:10 +03:00
parent f2997597fe
commit 76c47dcedb
5 changed files with 101 additions and 35 deletions

View File

@ -8,7 +8,8 @@
"RoomQuotaDescription": "You can archive the unnecessary rooms or <1>{{clickHere}}</1> to find a more suitable pricing plan for your {{productName}}.", "RoomQuotaDescription": "You can archive the unnecessary rooms or <1>{{clickHere}}</1> to find a more suitable pricing plan for your {{productName}}.",
"RoomQuotaHeader": "The number of rooms is about to be exceeded: {{currentValue}} / {{maxValue}}", "RoomQuotaHeader": "The number of rooms is about to be exceeded: {{currentValue}} / {{maxValue}}",
"StorageAndRoomHeader": "Storage and rooms limits are about to be exceeded.", "StorageAndRoomHeader": "Storage and rooms limits are about to be exceeded.",
"StorageAndUserHeader": "Storage and admins/power users limits are about to be exceeded.", "StorageAndUserHeader": "The limit for storage space and the number of admins/power users is about to be exceeded.",
"StorageAndUserTariffLimitHeader": "The limit is reached for storage space and the number of admins/power users ",
"StorageQuotaDescription": "You can remove the unnecessary files or <1>{{clickHere}}</1> to find a more suitable pricing plan for your {{productName}}.", "StorageQuotaDescription": "You can remove the unnecessary files or <1>{{clickHere}}</1> to find a more suitable pricing plan for your {{productName}}.",
"StorageQuotaExceeded": "Storage quota exceeded", "StorageQuotaExceeded": "Storage quota exceeded",
"StorageQuotaHeader": "Storage space amount is about to be exceeded: {{currentValue}} / {{maxValue}}", "StorageQuotaHeader": "Storage space amount is about to be exceeded: {{currentValue}} / {{maxValue}}",
@ -19,11 +20,13 @@
"UserTariffReachedForAdmins": "All users will be added with User permissions only. To be able to add further admins/power users, <1>click here</1> to upgrade your tariff plan.", "UserTariffReachedForAdmins": "All users will be added with User permissions only. To be able to add further admins/power users, <1>click here</1> 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 {{productName}} administrator to upgrade the tariff plan.", "UserTariffReached": "All users will be added with User permissions only. To be able to add further admins/power users, contact the {{productName}} administrator to upgrade the tariff plan.",
"UserQuotaHeader": "The number of admins/power users is about to be exceeded: {{currentValue}} / {{maxValue}}.", "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}}", "UserTariffLimitHeader": "The limit is reached for the number of admins/power users: {{currentValue}} / {{maxValue}}",
"StorageTariffLimit": "The limit is reached for storage space: {{currentValue}} / {{maxValue}}", "StorageLimitHeader": "The limit is reached for storage space: {{currentValue}} / {{maxValue}}",
"RemoveFilesOrClickToUpgrade": "Remove the unnecessary files or <1>click here</1> to upgrade your tariff plan.", "RemoveFilesOrClickToUpgrade": "Remove the unnecessary files or <1>click here</1> 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.",
"RemoveFilesOrContactToUpgradeQuota": "Remove the unnecessary files or contact the {{productName}} administrator to increase the storage quota.", "RemoveFilesOrContactToUpgradeQuota": "Remove the unnecessary files or contact the {{productName}} administrator to increase the storage quota.",
"StorageQuotaPerUserExceeded": "Storage quota per user exceeded", "PersonalQuotaHeaderForAdmins": "Storage quota per user exceeded",
"PersonalStorageQuotaExceed": "Your personal storage quota exceeded" "PersonalQuotaHeader": "Your personal storage quota exceeded",
"ClickToUpgradeTariff": "<1>Click here</1> to upgrade your tariff plan.",
"ContactToUpgradeTariff": "Contact the {{productName}} administrator to upgrade the tariff plan."
} }

View File

@ -93,7 +93,8 @@ const Bar = (props) => {
storageQuotaLimit: false, storageQuotaLimit: false,
usersTariff: false, usersTariff: false,
usersTariffLimit: false, usersTariffLimit: false,
storageAndUserQuota: false, storageAndUserTariff: false,
storageAndUserTariffLimit: false,
storageAndRoomQuota: false, storageAndRoomQuota: false,
confirmEmail: false, confirmEmail: false,
personalUserQuota: false, personalUserQuota: false,
@ -128,10 +129,7 @@ const Bar = (props) => {
roomQuota: !closed.includes(QuotaBarTypes.RoomQuota), roomQuota: !closed.includes(QuotaBarTypes.RoomQuota),
storageAndRoomQuota: !closed.includes( storageAndRoomQuota: !closed.includes(
QuotaBarTypes.UserAndStorageQuota, QuotaBarTypes.UserAndStorageTariff,
),
storageAndUserQuota: !closed.includes(
QuotaBarTypes.RoomAndStorageQuota,
), ),
})); }));
} }
@ -141,6 +139,12 @@ const Bar = (props) => {
...value, ...value,
usersTariffLimit: !closed.includes(QuotaBarTypes.UsersTariffLimit), usersTariffLimit: !closed.includes(QuotaBarTypes.UsersTariffLimit),
usersTariff: !closed.includes(QuotaBarTypes.UsersTariff), usersTariff: !closed.includes(QuotaBarTypes.UsersTariff),
storageAndUserTariff: !closed.includes(
QuotaBarTypes.UserAndStorageTariff,
),
storageAndUserTariffLimit: !closed.includes(
QuotaBarTypes.UserAndStorageTariffLimit,
),
})); }));
} }
@ -172,7 +176,8 @@ const Bar = (props) => {
storageQuotaLimit: isAdmin || isPowerUser || isRoomAdmin, storageQuotaLimit: isAdmin || isPowerUser || isRoomAdmin,
usersTariff: isAdmin | isRoomAdmin, usersTariff: isAdmin | isRoomAdmin,
usersTariffLimit: isAdmin | isRoomAdmin, usersTariffLimit: isAdmin | isRoomAdmin,
storageAndUserQuota: isAdmin, storageAndUserTariff: isAdmin | isRoomAdmin,
storageAndUserTariffLimit: isAdmin | isRoomAdmin,
storageAndRoomQuota: isAdmin, storageAndRoomQuota: isAdmin,
confirmEmail: true, confirmEmail: true,
personalUserQuota: isAdmin || isPowerUser || isRoomAdmin, personalUserQuota: isAdmin || isPowerUser || isRoomAdmin,
@ -275,9 +280,15 @@ const Bar = (props) => {
usersTariffLimit: false, usersTariffLimit: false,
})); }));
break; break;
// case QuotaBarTypes.UserAndStorageQuota: case QuotaBarTypes.UserAndStorageTariff:
// setBarVisible((value) => ({ ...value, storageAndUserQuota: false })); setBarVisible((value) => ({ ...value, storageAndUserTariff: false }));
// break; break;
case QuotaBarTypes.UserAndStorageTariffLimit:
setBarVisible((value) => ({
...value,
storageAndUserTariffLimit: false,
}));
break;
// case QuotaBarTypes.RoomAndStorageQuota: // case QuotaBarTypes.RoomAndStorageQuota:
// setBarVisible((value) => ({ ...value, storageAndRoomQuota: false })); // setBarVisible((value) => ({ ...value, storageAndRoomQuota: false }));
// break; // break;
@ -314,18 +325,34 @@ const Bar = (props) => {
// currentValue: null, // currentValue: null,
// }; // };
// } // }
// if ( console.log(
// isUserTariffAlmostLimit && "isUserTariffAlmostLimit",
// isStorageTariffAlmostLimit && isUserTariffAlmostLimit,
// barVisible.storageAndUserQuota isStorageTariffAlmostLimit,
// ) { barVisible.storageAndUserTariff,
// return { );
// type: QuotaBarTypes.UserAndStorageQuota, if (
// maxValue: null, isUserTariffAlmostLimit &&
// currentValue: null, isStorageTariffAlmostLimit &&
// }; barVisible.storageAndUserTariff
// } ) {
return {
type: QuotaBarTypes.UserAndStorageTariff,
maxValue: null,
currentValue: null,
};
}
if (
isUserTariffLimit &&
isStorageTariffLimit &&
barVisible.storageAndUserTariffLimit
) {
return {
type: QuotaBarTypes.UserAndStorageTariffLimit,
maxValue: null,
currentValue: null,
};
}
// if (showRoomQuotaBar && barVisible.roomQuota) { // if (showRoomQuotaBar && barVisible.roomQuota) {
// return { // return {
// type: QuotaBarTypes.RoomQuota, // type: QuotaBarTypes.RoomQuota,

View File

@ -217,8 +217,33 @@ const QuotasBar = ({
}; };
const getPersonalQuotaHeader = () => { const getPersonalQuotaHeader = () => {
if (!isAdmin) return t("PersonalStorageQuotaExceed"); if (!isAdmin) return t("PersonalQuotaHeader");
return t("StorageQuotaPerUserExceeded"); return t("PersonalQuotaHeaderForAdmins");
};
const getUpgradeTariffDescription = () => {
if (!isAdmin)
return t("ContactToUpgradeTariff", {
productName: t("Common:ProductName"),
});
return (
<Trans
t={t}
i18nKey="ClickToUpgradeTariff"
components={{
1: (
<Link
fontSize="12px"
fontWeight="400"
color={currentColorScheme?.main?.accent}
className="error_description_link"
onClick={onClickAction}
/>
),
}}
/>
);
}; };
const getQuotaInfo = () => { const getQuotaInfo = () => {
switch (type) { switch (type) {
@ -251,7 +276,7 @@ const QuotasBar = ({
}; };
case QuotaBarTypes.StorageTariffLimit: case QuotaBarTypes.StorageTariffLimit:
return { return {
header: t("StorageTariffLimit", { currentValue, maxValue }), header: t("StorageLimitHeader", { currentValue, maxValue }),
description: getStorageTariffDescription(), description: getStorageTariffDescription(),
}; };
case QuotaBarTypes.StorageQuota: case QuotaBarTypes.StorageQuota:
@ -261,7 +286,7 @@ const QuotasBar = ({
}; };
case QuotaBarTypes.StorageQuotaLimit: case QuotaBarTypes.StorageQuotaLimit:
return { return {
header: t("StorageTariffLimit", { currentValue, maxValue }), header: t("StorageLimitHeader", { currentValue, maxValue }),
description: getTenantCustomQuota(), description: getTenantCustomQuota(),
}; };
case QuotaBarTypes.UsersTariff: case QuotaBarTypes.UsersTariff:
@ -271,13 +296,18 @@ const QuotasBar = ({
}; };
case QuotaBarTypes.UsersTariffLimit: case QuotaBarTypes.UsersTariffLimit:
return { return {
header: t("UserTariffLimit", { currentValue, maxValue }), header: t("UserTariffLimitHeader", { currentValue, maxValue }),
description: getUserTariffLimit(), description: getUserTariffLimit(),
}; };
case QuotaBarTypes.UserAndStorageQuota: case QuotaBarTypes.UserAndStorageTariff:
return { return {
header: t("StorageAndUserHeader", { currentValue, maxValue }), header: t("StorageAndUserHeader"),
description: getUserQuotaDescription(), description: getUpgradeTariffDescription(),
};
case QuotaBarTypes.UserAndStorageTariffLimit:
return {
header: t("StorageAndUserTariffLimitHeader"),
description: getUpgradeTariffDescription(),
}; };
case QuotaBarTypes.RoomAndStorageQuota: case QuotaBarTypes.RoomAndStorageQuota:
return { return {

View File

@ -101,7 +101,8 @@ export const QuotaBarTypes = Object.freeze({
StorageTariffLimit: "storage-quota-limit", StorageTariffLimit: "storage-quota-limit",
UsersTariff: "user-quota", UsersTariff: "user-quota",
UsersTariffLimit: "user-quota-limit", UsersTariffLimit: "user-quota-limit",
UserAndStorageQuota: "user-storage-quota", UserAndStorageTariff: "user-storage-quota",
UserAndStorageTariffLimit: "user-storage-quota-limit",
RoomAndStorageQuota: "room-storage-quota", RoomAndStorageQuota: "room-storage-quota",
PersonalUserQuota: "personal-user-quota", PersonalUserQuota: "personal-user-quota",
StorageQuota: "tenant-custom-quota", StorageQuota: "tenant-custom-quota",

View File

@ -296,6 +296,11 @@ class CurrentQuotasStore {
} }
get isUserTariffAlmostLimit() { get isUserTariffAlmostLimit() {
console.log(
"isUserTariffAlmostLimit",
this.addedManagersCount,
this.maxCountManagersByQuota,
);
return ( return (
this.addedManagersCount > 1 && this.addedManagersCount > 1 &&
this.maxCountManagersByQuota - this.addedManagersCount <= this.maxCountManagersByQuota - this.addedManagersCount <=