Client: Added a banner when room and storage limits have been reached.

This commit is contained in:
Tatiana Lopaeva 2024-08-16 10:59:47 +03:00
parent 470ee21171
commit e70099c09c
5 changed files with 35 additions and 7 deletions

View File

@ -14,9 +14,10 @@
"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.",
"RemoveFilesOrContactToUpgradeQuota": "Remove the unnecessary files or contact the {{productName}} administrator to increase the storage quota.",
"StorageAndRoomHeader": "The limit for storage space and the number of rooms is about to be exceeded.",
"StorageAndRoomHeader": "The limit for storage space and the number of rooms is about to be exceeded",
"StorageAndRoomLimitHeader": "The limit is reached for storage space and the number of rooms",
"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 ",
"StorageAndUserTariffLimitHeader": "The limit is reached for storage space and the number of admins/power users",
"StorageQuotaHeader": "Storage space amount is about to be exceeded: {{currentValue}} / {{maxValue}}",
"StorageLimitHeader": "The limit is reached for storage space: {{currentValue}} / {{maxValue}}",
"TenantCustomQuotaDescription": "You can remove the unnecessary files or change quota in the <1>Storage management settings.</1>",

View File

@ -82,6 +82,7 @@ const Bar = (props) => {
isStorageQuotaAlmostLimit,
isStorageQuotaLimit,
isRoomTariffAlmostLimit,
isRoomsTariffLimit,
} = props;
const navigate = useNavigate();
@ -97,6 +98,7 @@ const Bar = (props) => {
storageAndUserTariff: false,
storageAndUserTariffLimit: false,
roomsAndStorageTariff: false,
roomsAndStorageTariffLimit: false,
storageAndRoomQuota: false,
confirmEmail: false,
personalUserQuota: false,
@ -147,6 +149,9 @@ const Bar = (props) => {
roomsAndStorageTariff: closed.includes(
QuotaBarTypes.RoomsAndStorageTariff,
),
roomsAndStorageTariffLimit: closed.includes(
QuotaBarTypes.RoomsAndStorageTariffLimit,
),
storageAndUserTariffLimit: !closed.includes(
QuotaBarTypes.UserAndStorageTariffLimit,
),
@ -183,6 +188,7 @@ const Bar = (props) => {
usersTariffLimit: isAdmin | isRoomAdmin,
storageAndUserTariff: isAdmin | isRoomAdmin,
roomsAndStorageTariff: isAdmin | isRoomAdmin,
roomsAndStorageTariffLimit: isAdmin | isRoomAdmin,
storageAndUserTariffLimit: isAdmin | isRoomAdmin,
storageAndRoomQuota: isAdmin,
confirmEmail: true,
@ -298,6 +304,12 @@ const Bar = (props) => {
case QuotaBarTypes.RoomsAndStorageTariff:
setBarVisible((value) => ({ ...value, roomsAndStorageTariff: false }));
break;
case QuotaBarTypes.RoomsAndStorageTariffLimit:
setBarVisible((value) => ({
...value,
roomsAndStorageTariffLimit: false,
}));
break;
case QuotaBarTypes.PersonalUserQuota:
setBarVisible((value) => ({ ...value, personalUserQuota: false }));
break;
@ -344,6 +356,18 @@ const Bar = (props) => {
};
}
if (
isRoomsTariffLimit &&
isStorageTariffLimit &&
barVisible.roomsAndStorageTariffLimit
) {
return {
type: QuotaBarTypes.RoomsAndStorageTariffLimit,
maxValue: null,
currentValue: null,
};
}
if (
isUserTariffAlmostLimit &&
isStorageTariffAlmostLimit &&
@ -510,6 +534,7 @@ export default inject(
isStorageQuotaAlmostLimit,
isStorageQuotaLimit,
isRoomTariffAlmostLimit,
isRoomsTariffLimit,
} = currentQuotaStore;
const { currentColorScheme, setMainBarVisible } = settingsStore;
@ -547,6 +572,7 @@ export default inject(
isStorageQuotaAlmostLimit,
isStorageQuotaLimit,
isRoomTariffAlmostLimit,
isRoomsTariffLimit,
};
},
)(withTranslation(["Profile", "Common"])(observer(Bar)));

View File

@ -269,6 +269,11 @@ const QuotasBar = ({
header: t("StorageAndRoomHeader"),
description: getUpgradeTariffDescription(),
};
case QuotaBarTypes.RoomsAndStorageTariffLimit:
return {
header: t("StorageAndRoomLimitHeader"),
description: getUpgradeTariffDescription(),
};
case QuotaBarTypes.PersonalUserQuota:
return {
header: getPersonalQuotaHeader(),

View File

@ -104,6 +104,7 @@ export const QuotaBarTypes = Object.freeze({
UserAndStorageTariff: "user-storage-quota",
UserAndStorageTariffLimit: "user-storage-quota-limit",
RoomsAndStorageTariff: "room-storage-quota",
RoomsAndStorageTariffLimit: "room-storage-quota-limit",
PersonalUserQuota: "personal-user-quota",
StorageQuota: "tenant-custom-quota",
StorageQuotaLimit: "tenant-custom-quota-limit",

View File

@ -335,11 +335,6 @@ class CurrentQuotasStore {
};
get isWarningRoomsDialog() {
console.log(
"isRoomsTariffLimit",
this.currentTariffStatusStore?.isGracePeriod,
this.isRoomsTariffLimit,
);
return (
this.currentTariffStatusStore?.isGracePeriod || this.isRoomsTariffLimit
);