email box empty styling
This commit is contained in:
parent
1ee8a58117
commit
5cb49f4cb1
19 changed files with 547 additions and 67 deletions
|
|
@ -5,7 +5,6 @@ import {
|
|||
ChevronRight,
|
||||
CircleHelp,
|
||||
Filter,
|
||||
Inbox,
|
||||
LayoutGrid,
|
||||
List,
|
||||
Mail,
|
||||
|
|
@ -31,8 +30,10 @@ import AgAgentPanel from "./AgAgentPanel";
|
|||
import AgentSpark from "./AgentSpark";
|
||||
import CommandPalette from "./CommandPalette";
|
||||
import { useAgentInsight } from "../hooks/useAgentInsight";
|
||||
import { useMailboxMaturity } from "../hooks/useMailboxMaturity";
|
||||
import MailDetail from "./MailDetail";
|
||||
import MailRow from "./MailRow";
|
||||
import MailboxEmptyState from "./MailboxEmptyState";
|
||||
import MailboxSelectionBar from "./MailboxSelectionBar";
|
||||
import StickyNotesPanel from "./StickyNotesPanel";
|
||||
import {
|
||||
|
|
@ -70,6 +71,7 @@ export default function MailboxView({
|
|||
agentNav = null,
|
||||
onLogout,
|
||||
onOpenSettings,
|
||||
onCompose,
|
||||
onStats,
|
||||
}) {
|
||||
const token = sessionStorage.getItem("agmail_access_token");
|
||||
|
|
@ -165,6 +167,11 @@ export default function MailboxView({
|
|||
[checked],
|
||||
);
|
||||
const selectedCount = selectedIds.length;
|
||||
const hasFilters = filters.read !== "all" || Boolean(filters.sender.trim())
|
||||
|| Boolean(filters.dateFrom) || Boolean(filters.dateTo);
|
||||
const hasSearch = Boolean(filters.query.trim());
|
||||
const { isBrandNew } = useMailboxMaturity(account, emails, status.loading);
|
||||
const isEmpty = !status.loading && !status.error && listedEmails.length === 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (!onStats) return;
|
||||
|
|
@ -495,8 +502,6 @@ export default function MailboxView({
|
|||
setDetail(null);
|
||||
}
|
||||
|
||||
const hasFilters =
|
||||
filters.read !== "all" || filters.sender || filters.dateFrom || filters.dateTo;
|
||||
const initials = `${account?.first_name?.[0] || ""}${account?.last_name?.[0] || ""}`.toUpperCase();
|
||||
const rangeStart = listedEmails.length ? cursorHistory.length * PAGE_SIZE + 1 : 0;
|
||||
const rangeEnd = cursorHistory.length * PAGE_SIZE + listedEmails.length;
|
||||
|
|
@ -623,19 +628,25 @@ export default function MailboxView({
|
|||
</div>
|
||||
)}
|
||||
|
||||
<div className="mailbox-rows" aria-busy={status.loading}>
|
||||
{status.loading && <div className="mailbox-state">Loading messages…</div>}
|
||||
<div className={`mailbox-rows${isEmpty ? " is-empty" : ""}`} aria-busy={status.loading}>
|
||||
{status.loading && <div className="mailbox-state loading">Loading messages…</div>}
|
||||
{status.error && (
|
||||
<div className="mailbox-state error" role="alert">
|
||||
<p>{status.error}</p><button type="button" onClick={load}>Try again</button>
|
||||
</div>
|
||||
)}
|
||||
{!status.loading && !status.error && listedEmails.length === 0 && (
|
||||
<div className="mailbox-state empty">
|
||||
<span><Inbox size={22} /></span>
|
||||
<strong>No messages here</strong>
|
||||
<p>{hasFilters || filters.query || lens !== "all" ? "Try another category, label, or search." : `Your ${title.toLowerCase()} is empty.`}</p>
|
||||
</div>
|
||||
{isEmpty && (
|
||||
<MailboxEmptyState
|
||||
mailbox={mailbox}
|
||||
title={title}
|
||||
category={mailbox === "inbox" ? category : null}
|
||||
isBrandNew={isBrandNew}
|
||||
hasFilters={hasFilters}
|
||||
hasSearch={hasSearch}
|
||||
lens={lens}
|
||||
onCompose={onCompose}
|
||||
onRefresh={load}
|
||||
/>
|
||||
)}
|
||||
{!status.loading && !status.error && listedEmails.map((email) => (
|
||||
<MailRow
|
||||
|
|
@ -655,19 +666,24 @@ export default function MailboxView({
|
|||
))}
|
||||
</div>
|
||||
|
||||
{!status.loading && listedEmails.length > 0 && (
|
||||
{!status.loading && (
|
||||
<footer className="mailbox-pagination">
|
||||
<span className="mailbox-pagination-range">
|
||||
{`${rangeStart}–${rangeEnd}`}
|
||||
{nextCursor ? "" : ` · ${rangeEnd} loaded`}
|
||||
{listedEmails.length === 0
|
||||
? "0 messages"
|
||||
: `${rangeStart}–${rangeEnd}${nextCursor ? "" : ` · ${rangeEnd} loaded`}`}
|
||||
</span>
|
||||
<div className="mailbox-pagination-controls">
|
||||
<button type="button" title="Previous page" aria-label="Previous page" disabled={!cursorHistory.length} onClick={previousPage}>
|
||||
<ChevronLeft size={16} strokeWidth={1.75} />
|
||||
</button>
|
||||
<button type="button" title="Next page" aria-label="Next page" disabled={!nextCursor} onClick={nextPage}>
|
||||
<ChevronRight size={16} strokeWidth={1.75} />
|
||||
</button>
|
||||
{listedEmails.length > 0 && (
|
||||
<>
|
||||
<button type="button" title="Previous page" aria-label="Previous page" disabled={!cursorHistory.length} onClick={previousPage}>
|
||||
<ChevronLeft size={16} strokeWidth={1.75} />
|
||||
</button>
|
||||
<button type="button" title="Next page" aria-label="Next page" disabled={!nextCursor} onClick={nextPage}>
|
||||
<ChevronRight size={16} strokeWidth={1.75} />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="mailbox-pagination-density" aria-label="List density">
|
||||
<button type="button" className="active" title="Comfortable density" aria-label="Comfortable density"><List size={15} strokeWidth={1.75} /></button>
|
||||
|
|
@ -702,6 +718,9 @@ export default function MailboxView({
|
|||
focus={agentFocus}
|
||||
insight={insight}
|
||||
loading={status.loading}
|
||||
mailboxEmpty={isEmpty}
|
||||
isBrandNewMailbox={isBrandNew && mailbox === "inbox"}
|
||||
onCompose={onCompose}
|
||||
onQuickAction={runQuickAction}
|
||||
onOpenEmail={(emailId) => {
|
||||
const email = listedEmails.find((item) => item.id === emailId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue