feat(ui): email dashboard UX refactor — split-view, row polish, dashboard (PHASES 1/3/4)
CI / backend (pull_request) Successful in 2m26s
CI / frontend (pull_request) Successful in 31s
CI / format (pull_request) Successful in 1m25s
CI / db-tests (pull_request) Successful in 1m27s
Security / secrets (pull_request) Successful in 7s
Security / dependencies (pull_request) Successful in 1m18s
Security / sast (pull_request) Successful in 1m1s
CI / backend (pull_request) Successful in 2m26s
CI / frontend (pull_request) Successful in 31s
CI / format (pull_request) Successful in 1m25s
CI / db-tests (pull_request) Successful in 1m27s
Security / secrets (pull_request) Successful in 7s
Security / dependencies (pull_request) Successful in 1m18s
Security / sast (pull_request) Successful in 1m1s
Batch of 4 parallel units, rebased onto current develop and integrated: - PHASE 1 split-view: clicking an email opens an in-place, collapsible + resizable reading pane (shared EmailDetail extracted from Senders) instead of a new tab; list stays interactive, selection preserved, mobile stacks (<768px); list gains Skeleton loading + EmptyState. (FolderView, SearchResults, +EmailDetail, +split.css) - PHASE 3 row polish: EmailRow gains onOpen (Gmail fallback kept), a new accessible Checkbox primitive (ui/checkbox.jsx), 44px rows, clearer hierarchy + hover; keeps the search why-matched highlight rendering. (EmailRow, ui/checkbox, styles.css) - PHASE 4 bulk+keys: BulkToolbar hierarchy/responsive/clear-selection; keyboard nav adds ArrowUp/Down + u=unread, hardened input guard. (BulkToolbar, useListKeyboardNav) - PHASE 3/4 dashboard: remove dead HeatmapWidget, replace CategoryHeatmap with a clickable Emails-by-Category bar (a11y: rank by text+count, not colour); Skeleton + EmptyState on widgets. (widgets, Dashboard, client.js, styles.css) Each unit was self-code-reviewed and built green; integrated build passes. Supersedes PRs #40-43 (their branches had a stale 38-commit base). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,13 +2,29 @@ import { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { SearchApi } from '../api/client.js';
|
||||
import EmailRow from '../components/EmailRow.jsx';
|
||||
import EmailDetail from '../components/EmailDetail.jsx';
|
||||
import BulkToolbar from '../components/BulkToolbar.jsx';
|
||||
import { Skeleton, EmptyState } from '../components/ui';
|
||||
import useSelection from '../hooks/useSelection.js';
|
||||
import useListKeyboardNav from '../hooks/useListKeyboardNav.js';
|
||||
import useSavedSearches from '../hooks/useSavedSearches.js';
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
|
||||
function ListSkeleton({ rows = 6 }) {
|
||||
return (
|
||||
<div className="sv-skeleton-list" aria-hidden="true">
|
||||
{Array.from({ length: rows }).map((_, i) => (
|
||||
<div className="sv-skeleton-row" key={i}>
|
||||
<Skeleton className="h-3 w-3 rounded-full" />
|
||||
<Skeleton className="h-3 flex-1" />
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default function SearchResults() {
|
||||
const [searchParams] = useSearchParams();
|
||||
@@ -20,6 +36,7 @@ export default function SearchResults() {
|
||||
const [hasMore, setHasMore] = useState(true);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState(null);
|
||||
const [selectedEmail, setSelectedEmail] = useState(null);
|
||||
const { selected, toggle, clear, removeIds, selectedIds } = useSelection();
|
||||
const focusedId = useListKeyboardNav(emails, (id) => setEmails((prev) => prev.filter((x) => x.id !== id)));
|
||||
const { searches: savedSearches, add: addSavedSearch } = useSavedSearches();
|
||||
@@ -36,6 +53,7 @@ export default function SearchResults() {
|
||||
setPage(1);
|
||||
setHasMore(true);
|
||||
setError(null);
|
||||
setSelectedEmail(null);
|
||||
clear();
|
||||
}, [q, clear]);
|
||||
|
||||
@@ -83,11 +101,13 @@ export default function SearchResults() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!q.trim() && <div className="fv-empty">Enter a search query above.</div>}
|
||||
{error && <div className="fv-error">{error}</div>}
|
||||
{!loading && !error && q.trim() && emails.length === 0 && !hasMore && (
|
||||
<div className="fv-empty">No results for "{q}".</div>
|
||||
{!q.trim() && (
|
||||
<EmptyState
|
||||
title="Search your mail"
|
||||
description="Enter a search query above to find emails."
|
||||
/>
|
||||
)}
|
||||
{error && <div className="fv-error">{error}</div>}
|
||||
|
||||
<BulkToolbar
|
||||
selectedIds={selectedIds}
|
||||
@@ -100,27 +120,56 @@ export default function SearchResults() {
|
||||
}}
|
||||
/>
|
||||
|
||||
{emails.length > 0 && (
|
||||
<table className="email-list">
|
||||
<tbody>
|
||||
{emails.map((e) => (
|
||||
<EmailRow
|
||||
key={e.id}
|
||||
email={e}
|
||||
selected={selected.has(e.id)}
|
||||
onToggleSelect={toggle}
|
||||
focused={focusedId === e.id}
|
||||
onRemove={(id) => setEmails((prev) => prev.filter((x) => x.id !== id))}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
{q.trim() && (
|
||||
<div className={`sv-split${selectedEmail ? ' sv-split--open' : ''}`}>
|
||||
<div className="sv-list-pane">
|
||||
{loading && emails.length === 0 && !error && <ListSkeleton />}
|
||||
|
||||
<div ref={sentinelRef} className="fv-sentinel" />
|
||||
{loading && <div className="fv-loading-more">Loading…</div>}
|
||||
{!hasMore && emails.length > 0 && (
|
||||
<div className="fv-end">— {emails.length.toLocaleString()} results —</div>
|
||||
{!loading && !error && emails.length === 0 && !hasMore && (
|
||||
<EmptyState
|
||||
title={`No results for "${q}"`}
|
||||
description="Try a different search term or filter."
|
||||
/>
|
||||
)}
|
||||
|
||||
{emails.length > 0 && (
|
||||
<table className="email-list">
|
||||
<tbody>
|
||||
{emails.map((e) => (
|
||||
<EmailRow
|
||||
key={e.id}
|
||||
email={e}
|
||||
selected={selected.has(e.id)}
|
||||
onToggleSelect={toggle}
|
||||
focused={focusedId === e.id}
|
||||
onOpen={(email) => setSelectedEmail(email)}
|
||||
onRemove={(id) => {
|
||||
setEmails((prev) => prev.filter((x) => x.id !== id));
|
||||
setSelectedEmail((cur) => (cur?.id === id ? null : cur));
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
|
||||
<div ref={sentinelRef} className="fv-sentinel" />
|
||||
{loading && emails.length > 0 && <div className="fv-loading-more">Loading…</div>}
|
||||
{!hasMore && emails.length > 0 && (
|
||||
<div className="fv-end">— {emails.length.toLocaleString()} results —</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedEmail && (
|
||||
<aside className="sv-reading-pane">
|
||||
<EmailDetail
|
||||
key={selectedEmail.id}
|
||||
email={selectedEmail}
|
||||
onClose={() => setSelectedEmail(null)}
|
||||
/>
|
||||
</aside>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user