fix: storage quota not shown with Stalwart #577
This commit is contained in:
@@ -91,7 +91,8 @@ function StorageQuotaCircle({ quota, usagePercent }: { quota: { used: number; to
|
||||
return () => document.removeEventListener("mousedown", handleClick);
|
||||
}, [open, updatePosition]);
|
||||
|
||||
const free = quota.total - quota.used;
|
||||
// Usage can legitimately exceed the quota (e.g. limit lowered after the fact)
|
||||
const free = Math.max(0, quota.total - quota.used);
|
||||
const strokeColor = usagePercent > 90
|
||||
? "stroke-destructive"
|
||||
: usagePercent > 70
|
||||
|
||||
@@ -53,7 +53,7 @@ export function AccountSettings() {
|
||||
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
|
||||
const draggedIndexRef = useRef<number | null>(null);
|
||||
|
||||
const quotaPercentage = quota ? Math.round((quota.used / quota.total) * 100) : 0;
|
||||
const quotaPercentage = quota && quota.total > 0 ? Math.min(Math.round((quota.used / quota.total) * 100), 100) : 0;
|
||||
const displayName = primaryIdentity?.name || account?.displayName || (isDemoMode ? 'Demo User' : undefined);
|
||||
const email = primaryIdentity?.email || account?.email || username;
|
||||
const max = getMaxAccounts();
|
||||
|
||||
Reference in New Issue
Block a user