email box empty styling

This commit is contained in:
debu-2 2026-10-05 21:34:12 +05:30
parent 1ee8a58117
commit 5cb49f4cb1
19 changed files with 547 additions and 67 deletions

View file

@ -0,0 +1,26 @@
import { useEffect, useState } from "react";
function storageKey(accountId) {
return `agmail_had_mail_${accountId}`;
}
export function useMailboxMaturity(account, emails, loading) {
const [hadMail, setHadMail] = useState(() => {
if (!account?.id) return false;
return localStorage.getItem(storageKey(account.id)) === "1";
});
useEffect(() => {
if (!account?.id) return;
if (!loading && emails.length > 0) {
localStorage.setItem(storageKey(account.id), "1");
setHadMail(true);
}
}, [account?.id, emails.length, loading]);
const isBrandNew = Boolean(
account?.id && !loading && emails.length === 0 && !hadMail,
);
return { isBrandNew, hadMail };
}