Skip to content

Commit 5eaffad

Browse files
author
Hakan Kaya
committed
feat(web): align console UI with design references
1 parent 8d08ba7 commit 5eaffad

3 files changed

Lines changed: 160 additions & 81 deletions

File tree

‎apps/vds-web/src/features/dashboard/DashboardPage.tsx‎

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo } from 'react'
2-
import { Activity, Boxes, Radio, ShieldAlert } from 'lucide-react'
2+
import { Activity, Boxes, Cpu, Radio, ShieldAlert } from 'lucide-react'
33

44
import { useDevices, useFaults, useHealth, useRun } from '../../api/queries'
55
import { AsyncState } from '../../components/AsyncState'
@@ -25,48 +25,61 @@ export function DashboardPage() {
2525
() => events.filter((event) => event.event_type === 'transaction_completed').slice(-8),
2626
[events],
2727
)
28+
const enabledFaults = faults.data?.filter((fault) => fault.enabled).length ?? 0
2829

2930
return (
3031
<div className="page-stack">
3132
<PageHeader
32-
eyebrow="Operational overview"
33-
title="Simulator pulse"
33+
eyebrow="Control plane / Overview"
34+
title="System overview"
3435
description="Authoritative snapshots from REST, live operational context from the domain event stream."
3536
action={<div className="header-status"><span>Event stream</span><StatusBadge status={connectionStatus} /></div>}
3637
/>
37-
<div className="metric-grid">
38-
<MetricCard accent="cyan" detail={health.isError ? 'API unavailable' : 'Control API'} icon={Radio} label="Server health" value={health.data?.status ?? 'checking'} />
39-
<MetricCard accent="violet" detail="Loaded runtime models" icon={Boxes} label="Devices" value={devices.data?.length ?? '—'} />
40-
<MetricCard accent="amber" detail={`${faults.data?.filter((fault) => fault.enabled).length ?? 0} enabled`} icon={ShieldAlert} label="Fault profiles" value={faults.data?.length ?? '—'} />
41-
<MetricCard detail="Retained in this session" icon={Activity} label="Live events" value={events.length} />
42-
</div>
43-
<div className="dashboard-grid">
44-
<GlassPanel eyebrow="Runtime snapshot" title="Device states">
38+
<div className="dashboard-command-grid">
39+
<GlassPanel className="runtime-map-panel" eyebrow="Runtime snapshot" title="Device map" action={<span className="panel-count">{devices.data?.length ?? 0} loaded</span>}>
4540
{devices.isPending && <AsyncState kind="loading" title="Loading devices" />}
4641
{devices.isError && <AsyncState detail={devices.error.message} kind="error" title="Device snapshot unavailable" />}
4742
{devices.data?.length === 0 && <AsyncState kind="empty" title="No devices loaded" />}
48-
<div className="state-list">
43+
<div className="runtime-device-grid">
4944
{devices.data?.map((device) => (
50-
<div className="state-row" key={device.id}>
45+
<article className="runtime-device-card" key={device.id}>
46+
<div className="runtime-device-icon"><Cpu aria-hidden="true" size={18} /></div>
5147
<div><strong>{device.id}</strong><span>{humanize(device.bus)} bus</span></div>
5248
<StatusBadge status={device.state} />
53-
</div>
49+
</article>
5450
))}
5551
</div>
5652
</GlassPanel>
57-
<GlassPanel className="dashboard-run-panel" eyebrow="Orchestration" title="Active scenario run">
58-
<BrandLogo className="panel-brand-watermark" decorative />
59-
{!activeRunId && <AsyncState detail="Start a scenario to track it here." kind="empty" title="No active run" />}
60-
{activeRun.isError && <AsyncState detail={activeRun.error.message} kind="error" title="Run status unavailable" />}
61-
{activeRun.data && (
62-
<div className="run-overview">
63-
<div><span>Run ID</span><strong>{activeRun.data.run_id}</strong></div>
64-
<div><span>Scenario</span><strong>{activeRun.data.scenario_id}</strong></div>
65-
<div><span>Status</span><StatusBadge status={activeRun.data.status} /></div>
53+
<div className="dashboard-side-stack">
54+
<GlassPanel className="dashboard-run-panel" eyebrow="Orchestration" title="Running scenario">
55+
<BrandLogo className="panel-brand-watermark" decorative />
56+
{!activeRunId && <AsyncState detail="Start a scenario to track it here." kind="empty" title="No active run" />}
57+
{activeRun.isError && <AsyncState detail={activeRun.error.message} kind="error" title="Run status unavailable" />}
58+
{activeRun.data && (
59+
<div className="run-overview">
60+
<div><span>Run ID</span><strong>{activeRun.data.run_id}</strong></div>
61+
<div><span>Scenario</span><strong>{activeRun.data.scenario_id}</strong></div>
62+
<div><span>Status</span><StatusBadge status={activeRun.data.status} /></div>
63+
</div>
64+
)}
65+
</GlassPanel>
66+
<GlassPanel className="stream-health-panel" eyebrow="Live telemetry" title="Event stream" action={<StatusBadge status={connectionStatus} />}>
67+
<div className="stream-health-stats">
68+
<div><span>Retained events</span><strong>{events.length.toLocaleString()}</strong></div>
69+
<div><span>Transactions</span><strong>{recentTransactions.length}</strong></div>
70+
<div><span>Enabled faults</span><strong>{enabledFaults}</strong></div>
6671
</div>
67-
)}
68-
</GlassPanel>
69-
<GlassPanel className="dashboard-transactions" eyebrow="Data plane telemetry" title="Latest completed transactions">
72+
</GlassPanel>
73+
</div>
74+
</div>
75+
<div className="metric-grid">
76+
<MetricCard accent="cyan" detail={health.isError ? 'API unavailable' : 'Control API'} icon={Radio} label="Server health" value={health.data?.status ?? 'checking'} />
77+
<MetricCard accent="violet" detail="Loaded runtime models" icon={Boxes} label="Active devices" value={devices.data?.length ?? '—'} />
78+
<MetricCard accent="amber" detail={`${enabledFaults} enabled`} icon={ShieldAlert} label="Fault profiles" value={faults.data?.length ?? '—'} />
79+
<MetricCard detail="Current session" icon={Activity} label="Domain events" value={events.length} />
80+
</div>
81+
<div className="dashboard-grid">
82+
<GlassPanel className="dashboard-transactions" eyebrow="Data plane telemetry" title="Recent transactions">
7083
{connectionStatus === 'disconnected' && recentTransactions.length === 0 && (
7184
<AsyncState detail="The UI will resume from its last event ID." kind="disconnected" title="Event stream disconnected" />
7285
)}

‎apps/vds-web/src/layouts/AppShell.tsx‎

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BrandLogo } from '../components/BrandLogo'
55
import { EventDetailDrawer } from '../components/EventDetailDrawer'
66
import { StatusBadge } from '../components/StatusBadge'
77
import { useEventStore } from '../stores/eventStore'
8+
import { formatVirtualTime } from '../utils/format'
89

910
const navigation = [
1011
{ to: '/', label: 'Dashboard', icon: Gauge, end: true },
@@ -14,9 +15,19 @@ const navigation = [
1415
{ to: '/flows', label: 'Flows', icon: GitBranch, end: false },
1516
] as const
1617

18+
const workspaceNavigation = [
19+
{ to: '/', label: 'Overview', end: true },
20+
{ to: '/devices', label: 'Devices', end: false },
21+
{ to: '/transactions', label: 'Transactions', end: false },
22+
{ to: '/scenarios', label: 'Scenarios', end: false },
23+
{ to: '/flows', label: 'Flow editor', end: false },
24+
] as const
25+
1726
export function AppShell() {
1827
const connectionStatus = useEventStore((state) => state.connectionStatus)
1928
const lastEventId = useEventStore((state) => state.lastEventId)
29+
const retainedEvents = useEventStore((state) => state.events.length)
30+
const virtualTime = useEventStore((state) => state.events.at(-1)?.timestamp_virtual_ns ?? 0)
2031
return (
2132
<div className="app-shell">
2233
<aside className="sidebar">
@@ -32,12 +43,30 @@ export function AppShell() {
3243
))}
3344
</nav>
3445
<div className="sidebar-stream">
35-
<div className="stream-heading"><Radio aria-hidden="true" size={15} /><span>Live stream</span></div>
36-
<StatusBadge status={connectionStatus} />
37-
<small>Cursor #{lastEventId || '—'}</small>
46+
<div className="stream-heading"><Radio aria-hidden="true" size={15} /><span>Simulator status</span></div>
47+
<div className="sidebar-runtime-row"><span>Event stream</span><StatusBadge status={connectionStatus} /></div>
48+
<dl className="sidebar-runtime-stats">
49+
<div><dt>Virtual time</dt><dd>{virtualTime ? formatVirtualTime(virtualTime) : '—'}</dd></div>
50+
<div><dt>Retained</dt><dd>{retainedEvents.toLocaleString()}</dd></div>
51+
<div><dt>Cursor</dt><dd>#{lastEventId || '—'}</dd></div>
52+
</dl>
3853
</div>
54+
<div className="workspace-identity"><span>LW</span><div><strong>Local workspace</strong><small>Control plane</small></div></div>
3955
</aside>
40-
<main className="main-content"><Outlet /></main>
56+
<div className="workspace-shell">
57+
<header className="workspace-topbar">
58+
<nav aria-label="Workspace navigation" className="workspace-tabs">
59+
{workspaceNavigation.map(({ to, label, end }) => (
60+
<NavLink className={({ isActive }) => isActive ? 'active' : ''} end={end} key={to} to={to}>{label}</NavLink>
61+
))}
62+
</nav>
63+
<div className="workspace-context">
64+
<div><span>Environment</span><strong>Local simulator</strong></div>
65+
<StatusBadge status={connectionStatus} />
66+
</div>
67+
</header>
68+
<main className="main-content"><Outlet /></main>
69+
</div>
4170
<EventDetailDrawer />
4271
</div>
4372
)

0 commit comments

Comments
 (0)