From 4a768555dcf2931c51986ff2fcd61c19b950b83e Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 23 Sep 2026 09:50:27 +0000 Subject: [PATCH] ui: simplify scanner workflow and host status --- apps/web/src/HostStatus.tsx | 81 +++++++++---- apps/web/src/host.css | 113 +++++++++++++++++- packages/fieldlens-core/src/App.css | 6 +- packages/fieldlens-core/src/App.tsx | 10 +- .../src/features/scanner/ScannerView.tsx | 6 +- .../src/lib/preferences.test.ts | 8 ++ .../fieldlens-core/src/lib/preferences.ts | 11 +- 7 files changed, 190 insertions(+), 45 deletions(-) diff --git a/apps/web/src/HostStatus.tsx b/apps/web/src/HostStatus.tsx index f5bf0ea..3274922 100644 --- a/apps/web/src/HostStatus.tsx +++ b/apps/web/src/HostStatus.tsx @@ -34,9 +34,10 @@ export function HostStatus() { const pending = useLiveQuery(() => database.outbox.filter((event: OutboxRecord) => !event.syncedAt).count(), []) ?? 0 const errors = useLiveQuery(() => database.outbox.filter((event: OutboxRecord) => !event.syncedAt && Boolean(event.lastError)).count(), []) ?? 0 const [authenticated, setAuthenticated] = useState(Boolean(keycloak?.authenticated)) - const [station, setStation] = useState('Local / unassigned') + const [station, setStation] = useState('This device') const [access, setAccess] = useState(null) const [requests, setRequests] = useState([]) + const [expanded, setExpanded] = useState(false) const [showRequests, setShowRequests] = useState(false) async function refreshAccess() { @@ -85,34 +86,62 @@ export function HostStatus() { if (next) await refreshRequests() } + const summary = !authenticated + ? 'Sign in to sync' + : !access + ? 'Checking access' + : access.status !== 'approved' + ? access.status === 'pending' + ? 'Access pending' + : access.status === 'rejected' + ? 'Access rejected' + : 'Access required' + : errors + ? `${errors} retrying` + : pending + ? `${pending} waiting to sync` + : 'Synced' + + const tone = !authenticated || access?.status !== 'approved' + ? 'muted' + : errors + ? 'error' + : pending + ? 'pending' + : 'synced' + return ( <> -