-
Notifications
You must be signed in to change notification settings - Fork 0
Redesign Web Mode command interface #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,145 +1,7 @@ | ||
| 'use client'; | ||
|
|
||
| import { useNeuroRift } from '@/lib/hooks'; | ||
| import { Activity, Shield, AlertTriangle, FileText } from 'lucide-react'; | ||
| import { cn, getSeverityColor } from '@/lib/utils'; | ||
| import { CommandCenter } from '@/components/webmode/CommandCenter'; | ||
|
|
||
| export default function DashboardPage() { | ||
| const { session, agents, tasks, approvals } = useNeuroRift(); | ||
|
|
||
| if (!session) { | ||
| return ( | ||
| <div className="h-full flex items-center justify-center"> | ||
| <div className="text-center"> | ||
| <Shield className="w-16 h-16 text-neuro-text-muted mx-auto mb-4" /> | ||
| <h2 className="text-2xl font-bold text-neuro-text-primary mb-2">No Active Session</h2> | ||
| <p className="text-neuro-text-secondary">Create or load a session to get started</p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const findingsBySeverity = session.findings.reduce((acc, finding) => { | ||
| acc[finding.severity] = (acc[finding.severity] || 0) + 1; | ||
| return acc; | ||
| }, {} as Record<string, number>); | ||
|
|
||
| return ( | ||
| <div className="p-6 space-y-6"> | ||
| {/* Header */} | ||
| <div> | ||
| <h1 className="text-3xl font-bold text-neuro-text-primary">Dashboard</h1> | ||
| <p className="text-neuro-text-secondary mt-1">Overview of {session.name}</p> | ||
| </div> | ||
|
|
||
| {/* Stats Grid */} | ||
| <div className="grid grid-cols-4 gap-4"> | ||
| <StatsCard | ||
| icon={Shield} | ||
| label="Total Findings" | ||
| value={session.findings.length} | ||
| color="text-neuro-primary" | ||
| /> | ||
| <StatsCard | ||
| icon={Activity} | ||
| label="Active Tasks" | ||
| value={tasks.filter((t) => t.status === 'running').length} | ||
| color="text-neuro-success" | ||
| /> | ||
| <StatsCard | ||
| icon={AlertTriangle} | ||
| label="Pending Approvals" | ||
| value={approvals.filter((a) => a.status === 'pending').length} | ||
| color="text-severity-medium" | ||
| /> | ||
| <StatsCard | ||
| icon={FileText} | ||
| label="Artifacts" | ||
| value={session.artifacts.length} | ||
| color="text-neuro-text-secondary" | ||
| /> | ||
| </div> | ||
|
|
||
| {/* Severity Breakdown */} | ||
| <div className="glass-card p-6"> | ||
| <h2 className="text-xl font-semibold text-neuro-text-primary mb-4">Findings by Severity</h2> | ||
| <div className="space-y-3"> | ||
| {(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'INFO'] as const).map((severity) => { | ||
| const count = findingsBySeverity[severity] || 0; | ||
| const total = session.findings.length || 1; | ||
| const percentage = (count / total) * 100; | ||
|
|
||
| return ( | ||
| <div key={severity}> | ||
| <div className="flex items-center justify-between mb-1"> | ||
| <span className={cn('text-sm font-medium', getSeverityColor(severity))}> | ||
| {severity} | ||
| </span> | ||
| <span className="text-sm text-neuro-text-muted">{count}</span> | ||
| </div> | ||
| <div className="h-2 bg-neuro-bg rounded-full overflow-hidden"> | ||
| <div | ||
| className={cn('h-full transition-all', getSeverityColor(severity).replace('text-', 'bg-'))} | ||
| style={{ width: `${percentage}%` }} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Agent Status */} | ||
| <div className="glass-card p-6"> | ||
| <h2 className="text-xl font-semibold text-neuro-text-primary mb-4">Agent Status</h2> | ||
| <div className="grid grid-cols-5 gap-4"> | ||
| {Object.entries(agents).map(([agentType, status]) => ( | ||
| <div key={agentType} className="text-center"> | ||
| <div className={cn( | ||
| 'w-12 h-12 rounded-full mx-auto mb-2 flex items-center justify-center', | ||
| status.state === 'idle' ? 'bg-neuro-bg' : | ||
| status.state === 'error' ? 'bg-severity-critical/20' : | ||
| 'bg-neuro-primary/20' | ||
| )}> | ||
| <Activity className={cn( | ||
| 'w-6 h-6', | ||
| status.state === 'idle' ? 'text-neuro-text-muted' : | ||
| status.state === 'error' ? 'text-severity-critical' : | ||
| 'text-neuro-primary' | ||
| )} /> | ||
| </div> | ||
| <p className="text-sm font-medium text-neuro-text-primary">{agentType}</p> | ||
| <p className="text-xs text-neuro-text-muted capitalize">{status.state}</p> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function StatsCard({ | ||
| icon: Icon, | ||
| label, | ||
| value, | ||
| color, | ||
| }: { | ||
| icon: any; | ||
| label: string; | ||
| value: number; | ||
| color: string; | ||
| }) { | ||
| return ( | ||
| <div className="glass-card p-4"> | ||
| <div className="flex items-center gap-3"> | ||
| <div className={cn('p-2 rounded-lg bg-neuro-bg', color)}> | ||
| <Icon className="w-6 h-6" /> | ||
| </div> | ||
| <div> | ||
| <p className="text-2xl font-bold text-neuro-text-primary">{value}</p> | ||
| <p className="text-sm text-neuro-text-secondary">{label}</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| return <CommandCenter />; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| 'use client'; | ||
|
|
||
| import { CommandCenterSurface } from '@/components/webmode/CommandCenterSurface'; | ||
| import { WebModeProvider } from '@/components/webmode/WebModeProvider'; | ||
|
|
||
| export function CommandCenter() { | ||
| return ( | ||
| <WebModeProvider> | ||
| <CommandCenterSurface /> | ||
| </WebModeProvider> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| 'use client'; | ||
|
|
||
| import { Activity, ShieldCheck, Wifi, Signal } from 'lucide-react'; | ||
| import { useNeuroRift } from '@/lib/hooks'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| export function CommandCenterFrame({ children }: { children: React.ReactNode }) { | ||
| const { session, systemHealth, torConnected, metrics } = useNeuroRift(); | ||
|
|
||
| return ( | ||
| <div className="min-h-screen bg-neuro-void text-neuro-text-primary"> | ||
| <div className="pointer-events-none fixed inset-0 bg-[radial-gradient(circle_at_top,_rgba(34,211,238,0.12),_transparent_50%),radial-gradient(circle_at_bottom,_rgba(99,102,241,0.12),_transparent_55%)]" /> | ||
| <div className="pointer-events-none fixed inset-0 bg-[linear-gradient(to_right,_rgba(15,23,42,0.35)_1px,_transparent_1px),linear-gradient(to_bottom,_rgba(15,23,42,0.35)_1px,_transparent_1px)] bg-[size:32px_32px] opacity-30" /> | ||
| <div className="relative flex min-h-screen flex-col"> | ||
| <header className="flex items-center justify-between px-6 py-4 border-b border-neuro-border/60 backdrop-blur"> | ||
| <div className="flex items-center gap-3"> | ||
| <div className="h-10 w-10 rounded-xl bg-gradient-to-br from-cyan-500 via-blue-600 to-purple-600 flex items-center justify-center shadow-lg shadow-cyan-500/30"> | ||
| <Signal className="h-5 w-5 text-white" /> | ||
| </div> | ||
| <div> | ||
| <p className="text-xs uppercase tracking-[0.4em] text-neuro-text-muted">NeuroRift Web Mode</p> | ||
| <h1 className="text-lg font-semibold">Command Interface</h1> | ||
| </div> | ||
| </div> | ||
| <div className="hidden lg:flex items-center gap-4 text-xs text-neuro-text-muted"> | ||
| <div className="flex items-center gap-2 px-3 py-1 rounded-full bg-neuro-surface/60 border border-neuro-border/60"> | ||
| <ShieldCheck className="w-3.5 h-3.5 text-emerald-300" /> | ||
| <span>{session ? session.name : 'No active session'}</span> | ||
| </div> | ||
| <div className="flex items-center gap-2 px-3 py-1 rounded-full bg-neuro-surface/60 border border-neuro-border/60"> | ||
| <Wifi className={cn('w-3.5 h-3.5', torConnected ? 'text-emerald-300' : 'text-rose-400')} /> | ||
| <span>{torConnected ? 'Secure Relay' : 'Relay Offline'}</span> | ||
| </div> | ||
| <div className="flex items-center gap-2 px-3 py-1 rounded-full bg-neuro-surface/60 border border-neuro-border/60"> | ||
| <Activity className="w-3.5 h-3.5 text-cyan-300" /> | ||
| <span>CPU {systemHealth.cpu.toFixed(0)}%</span> | ||
| <span>MEM {systemHealth.memory.toFixed(0)}%</span> | ||
| <span>LAT {systemHealth.latency.toFixed(0)}ms</span> | ||
| </div> | ||
| </div> | ||
| <div className="flex items-center gap-2 text-xs text-neuro-text-muted"> | ||
| <span className="px-2 py-1 rounded-full bg-neuro-surface/60 border border-neuro-border/60">Tasks {metrics.activeTasks}</span> | ||
| <span className="px-2 py-1 rounded-full bg-neuro-surface/60 border border-neuro-border/60">Approvals {metrics.pendingApprovals}</span> | ||
| </div> | ||
| </header> | ||
| <div className="flex-1 overflow-hidden">{children}</div> | ||
| <footer className="px-6 py-3 border-t border-neuro-border/60 text-xs text-neuro-text-muted flex items-center justify-between backdrop-blur"> | ||
| <span>Policy-driven routing • Deterministic execution enforced</span> | ||
| <span>Web Mode vNext</span> | ||
| </footer> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| 'use client'; | ||
|
|
||
| import { panelDefinitions, layoutZones } from '@/lib/webmode/schema'; | ||
| import { evaluatePanelPolicy } from '@/lib/webmode/policy'; | ||
| import { PanelRenderer } from '@/components/webmode/PanelRenderer'; | ||
| import { useNeuroRift } from '@/lib/hooks'; | ||
| import { useWebModeContext } from '@/components/webmode/WebModeProvider'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| export function CommandCenterSurface() { | ||
| const { session } = useNeuroRift(); | ||
| const { deviceTier, controlMode, phase, lastSignal } = useWebModeContext(); | ||
|
|
||
| const policyContext = { | ||
| deviceTier, | ||
| controlMode, | ||
| sessionActive: Boolean(session), | ||
| }; | ||
|
|
||
| const panels = panelDefinitions.filter(panel => evaluatePanelPolicy(panel, policyContext)); | ||
|
|
||
| const panelMap = new Map(panels.map(panel => [panel.id, panel])); | ||
|
|
||
| const primaryPanels = layoutZones.primary.map(id => panelMap.get(id)).filter(Boolean); | ||
| const secondaryPanels = layoutZones.secondary.map(id => panelMap.get(id)).filter(Boolean); | ||
| const tertiaryPanels = layoutZones.tertiary.map(id => panelMap.get(id)).filter(Boolean); | ||
| const dockPanels = layoutZones.dock.map(id => panelMap.get(id)).filter(Boolean); | ||
|
|
||
| return ( | ||
| <div className="h-full overflow-y-auto px-6 py-6"> | ||
| <div className="mb-6 flex flex-col gap-3"> | ||
| <div className="flex flex-wrap items-center gap-3"> | ||
| <span className="text-xs uppercase tracking-[0.4em] text-neuro-text-muted">Phase</span> | ||
| <span className="px-3 py-1 rounded-full bg-neuro-surface/70 border border-neuro-border/60 text-xs">{phase}</span> | ||
| <span className="px-3 py-1 rounded-full bg-neuro-surface/70 border border-neuro-border/60 text-xs">{controlMode.toUpperCase()} MODE</span> | ||
| <span className={cn( | ||
| 'px-3 py-1 rounded-full border text-xs', | ||
| deviceTier === 'mobile' && 'border-cyan-400/60 text-cyan-200', | ||
| deviceTier === 'tablet' && 'border-indigo-400/60 text-indigo-200', | ||
| deviceTier === 'desktop' && 'border-emerald-400/60 text-emerald-200', | ||
| deviceTier === 'wide' && 'border-purple-400/60 text-purple-200' | ||
| )}> | ||
| {deviceTier.toUpperCase()} TIER | ||
| </span> | ||
| </div> | ||
| <div className="text-sm text-neuro-text-secondary">{lastSignal}</div> | ||
| </div> | ||
|
|
||
| <div className="grid grid-cols-1 xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)] gap-6"> | ||
| <div className="space-y-6"> | ||
| <div className="grid grid-cols-1 lg:grid-cols-2 gap-6"> | ||
| {primaryPanels.map(panel => ( | ||
| panel ? <PanelRenderer key={panel.id} panel={panel} /> : null | ||
| ))} | ||
| </div> | ||
| <div className="grid grid-cols-1 lg:grid-cols-2 gap-6"> | ||
| {secondaryPanels.map(panel => ( | ||
| panel ? <PanelRenderer key={panel.id} panel={panel} /> : null | ||
| ))} | ||
| </div> | ||
| </div> | ||
| <div className="space-y-6"> | ||
| {tertiaryPanels.map(panel => ( | ||
| panel ? <PanelRenderer key={panel.id} panel={panel} /> : null | ||
| ))} | ||
| <div className="grid grid-cols-1 gap-6"> | ||
| {dockPanels.map(panel => ( | ||
| panel ? <PanelRenderer key={panel.id} panel={panel} /> : null | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import type React from 'react'; | ||
| import type { PanelId } from '@/lib/webmode/types'; | ||
| import { CommandPanel } from '@/components/webmode/panels/CommandPanel'; | ||
| import { ActivityStreamPanel } from '@/components/webmode/panels/ActivityStreamPanel'; | ||
| import { AgentGraphPanel } from '@/components/webmode/panels/AgentGraphPanel'; | ||
| import { IntentFlowPanel } from '@/components/webmode/panels/IntentFlowPanel'; | ||
| import { ExecutionTimelinePanel } from '@/components/webmode/panels/ExecutionTimelinePanel'; | ||
| import { MemoryPulsePanel } from '@/components/webmode/panels/MemoryPulsePanel'; | ||
| import { ConfigMatrixPanel } from '@/components/webmode/panels/ConfigMatrixPanel'; | ||
| import { OnlineModePanel } from '@/components/webmode/panels/OnlineModePanel'; | ||
| import { PermissionsPanel } from '@/components/webmode/panels/PermissionsPanel'; | ||
|
|
||
| export const PanelRegistry: Record<PanelId, React.ComponentType> = { | ||
| command: CommandPanel, | ||
| activity: ActivityStreamPanel, | ||
| 'agent-graph': AgentGraphPanel, | ||
| 'intent-flow': IntentFlowPanel, | ||
| 'execution-timeline': ExecutionTimelinePanel, | ||
| 'memory-pulse': MemoryPulsePanel, | ||
| 'config-matrix': ConfigMatrixPanel, | ||
| 'online-mode': OnlineModePanel, | ||
| permissions: PermissionsPanel, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing React import
CommandCenterFrameusesReact.ReactNodein the prop type, but this file doesn’t importReact(orReactNode). This will fail type-checking in TS setups withoutjsxImportSource/global React types. Importtype Reactortype ReactNodefromreactand use it in the signature.