refactor(dashboard): remove unused Header and SessionGroup components
Remove components that are no longer part of the dashboard architecture: Header.js: - Original header component replaced by integrated spawn controls - SpawnModal now handles project selection and agent spawning - Sidebar provides navigation context previously in header SessionGroup.js: - Session grouping now handled directly in App.js - Simplified rendering without intermediate wrapper component - groupSessionsByProject utility provides the grouping logic These components were bypassed during the spawn feature implementation and maintaining them increases cognitive overhead without benefit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
import { html, useState, useEffect } from '../lib/preact.js';
|
||||
|
||||
export function Header({ sessions }) {
|
||||
const [clock, setClock] = useState(() => new Date());
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => setClock(new Date()), 30000);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
const counts = {
|
||||
attention: sessions.filter(s => s.status === 'needs_attention').length,
|
||||
active: sessions.filter(s => s.status === 'active').length,
|
||||
starting: sessions.filter(s => s.status === 'starting').length,
|
||||
done: sessions.filter(s => s.status === 'done').length,
|
||||
};
|
||||
const total = sessions.length;
|
||||
|
||||
return html`
|
||||
<header class="sticky top-0 z-50 px-4 pt-4 sm:px-6 sm:pt-6">
|
||||
<div class="glass-panel rounded-2xl px-4 py-4 sm:px-6">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div class="min-w-0">
|
||||
<div class="inline-flex items-center gap-2 rounded-full border border-starting/40 bg-starting/10 px-3 py-1 text-micro font-medium uppercase tracking-[0.24em] text-starting">
|
||||
<span class="h-1.5 w-1.5 rounded-full bg-starting animate-float"></span>
|
||||
Control Plane
|
||||
</div>
|
||||
<h1 class="mt-3 truncate font-display text-xl font-semibold text-bright sm:text-2xl">
|
||||
Agent Mission Control
|
||||
</h1>
|
||||
<p class="mt-1 text-sm text-dim">
|
||||
${total} live session${total === 1 ? '' : 's'} • Updated ${clock.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2 text-xs sm:grid-cols-4 sm:gap-3">
|
||||
<div class="rounded-xl border border-attention/40 bg-attention/12 px-3 py-2 text-attention">
|
||||
<div class="font-mono text-lg font-medium tabular-nums text-bright">${counts.attention}</div>
|
||||
<div class="text-micro uppercase tracking-[0.16em]">Attention</div>
|
||||
</div>
|
||||
<div class="rounded-xl border border-active/40 bg-active/12 px-3 py-2 text-active">
|
||||
<div class="font-mono text-lg font-medium tabular-nums text-bright">${counts.active}</div>
|
||||
<div class="text-micro uppercase tracking-[0.16em]">Active</div>
|
||||
</div>
|
||||
<div class="rounded-xl border border-starting/40 bg-starting/12 px-3 py-2 text-starting">
|
||||
<div class="font-mono text-lg font-medium tabular-nums text-bright">${counts.starting}</div>
|
||||
<div class="text-micro uppercase tracking-[0.16em]">Starting</div>
|
||||
</div>
|
||||
<div class="rounded-xl border border-done/40 bg-done/12 px-3 py-2 text-done">
|
||||
<div class="font-mono text-lg font-medium tabular-nums text-bright">${counts.done}</div>
|
||||
<div class="text-micro uppercase tracking-[0.16em]">Done</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
`;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
import { html } from '../lib/preact.js';
|
||||
import { getStatusMeta, STATUS_PRIORITY } from '../utils/status.js';
|
||||
import { SessionCard } from './SessionCard.js';
|
||||
|
||||
export function SessionGroup({ projectName, projectDir, sessions, onCardClick, conversations, onFetchConversation, onRespond, onDismiss }) {
|
||||
if (sessions.length === 0) return null;
|
||||
|
||||
// Status summary for chips
|
||||
const statusCounts = {};
|
||||
for (const s of sessions) {
|
||||
statusCounts[s.status] = (statusCounts[s.status] || 0) + 1;
|
||||
}
|
||||
|
||||
// Group header dot uses the most urgent status
|
||||
const worstStatus = sessions.reduce((worst, s) => {
|
||||
return (STATUS_PRIORITY[s.status] ?? 99) < (STATUS_PRIORITY[worst] ?? 99) ? s.status : worst;
|
||||
}, 'done');
|
||||
const worstMeta = getStatusMeta(worstStatus);
|
||||
|
||||
return html`
|
||||
<section class="mb-12">
|
||||
<div class="mb-4 flex flex-wrap items-center gap-2.5 border-b border-selection/50 pb-3">
|
||||
<span class="h-2.5 w-2.5 rounded-full ${worstMeta.dot}"></span>
|
||||
<h2 class="font-display text-body font-semibold text-bright">${projectName}</h2>
|
||||
<span class="rounded-full border border-selection/80 bg-bg/55 px-2 py-0.5 font-mono text-micro text-dim">
|
||||
${sessions.length} agent${sessions.length === 1 ? '' : 's'}
|
||||
</span>
|
||||
${Object.entries(statusCounts).map(([status, count]) => {
|
||||
const meta = getStatusMeta(status);
|
||||
return html`
|
||||
<span key=${status} class="rounded-full border px-2 py-0.5 font-mono text-micro ${meta.badge}">
|
||||
${count} ${meta.label.toLowerCase()}
|
||||
</span>
|
||||
`;
|
||||
})}
|
||||
</div>
|
||||
${projectDir && projectDir !== 'unknown' && html`
|
||||
<div class="-mt-2 mb-3 truncate font-mono text-micro text-dim/60">${projectDir}</div>
|
||||
`}
|
||||
|
||||
<div class="flex flex-wrap gap-4">
|
||||
${sessions.map(session => html`
|
||||
<${SessionCard}
|
||||
key=${session.session_id}
|
||||
session=${session}
|
||||
onClick=${onCardClick}
|
||||
conversation=${conversations[session.session_id]}
|
||||
onFetchConversation=${onFetchConversation}
|
||||
onRespond=${onRespond}
|
||||
onDismiss=${onDismiss}
|
||||
/>
|
||||
`)}
|
||||
</div>
|
||||
</section>
|
||||
`;
|
||||
}
|
||||
Reference in New Issue
Block a user