Skip to content

Commit

Permalink
fix: set max 100 as value in the quota component in general settings
Browse files Browse the repository at this point in the history
refs: SHELL-123 (#282)
  • Loading branch information
rodleyorosa authored Jul 18, 2023
1 parent 52e8730 commit 67854dd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/settings/components/general-settings/user-quota.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ const UserQuota: FC<UserQuotaProps> = ({ mobileView }) => {
return -1;
}, [settings?.attrs?.zimbraMailQuota, used]);

const filledQuota = useMemo(() => {
if (quota === -1 || quota >= 100) {
return 100;
}
return quota;
}, [quota]);

const description = useMemo(() => {
switch (true) {
case !quota || quota < 0:
Expand Down Expand Up @@ -60,7 +67,7 @@ const UserQuota: FC<UserQuotaProps> = ({ mobileView }) => {
return mobileView ? (
<Container width="fit" padding={{ right: 'medium' }}>
<Tooltip label={description} placement="bottom">
<Quota fill={quota > 0 ? quota : 0} fillBackground={fillBackground} />
<Quota fill={filledQuota} fillBackground={fillBackground} />
</Tooltip>
</Container>
) : (
Expand All @@ -78,7 +85,7 @@ const UserQuota: FC<UserQuotaProps> = ({ mobileView }) => {
>
<Text>{description}</Text>
</Container>
<Quota fill={quota === -1 ? 100 : quota} fillBackground={fillBackground} />
<Quota fill={filledQuota} fillBackground={fillBackground} />
</Container>
</FormSubSection>
);
Expand Down

0 comments on commit 67854dd

Please sign in to comment.