Split app/styles.css from ~40k lines down to ~4.5k. Created 56 co-located
component CSS files in app/components/, each imported by its owning .tsx.
The remainder of styles.css holds genuinely global rules (design tokens,
.btn/.card/.modal/.form-input primitives, cross-component @media overrides).
- Lazy-load 13 heavy views (AgentsView, RoadmapsView, NodesView, etc.) via
React.lazy + Suspense; prefetch all chunks on idle so first navigation is
instant. Initial JS bundle: 1.58 MB → 1.16 MB (-26%). Initial CSS bundle:
635 kB → 471 kB (-26%); the rest splits into 13 per-view chunks.
- Add app/test/cssFixture.ts exposing loadAllAppCss() + loadAllAppCssBaseOnly()
so CSS regression tests load the full per-component bundle (mirroring Vite
source order). Migrate 30+ tests off direct readFileSync('../styles.css').
- Enable test.css: { include: [/.+/] } in vitest.config.ts so component CSS
imports actually inject styles in jsdom (fixes getComputedStyle assertions).
- Add ESLint rule (no-restricted-syntax) banning direct styles.css reads in
dashboard test files; points at loadAllAppCss() instead.
- Restore lost utility classes (.text-muted, .text-secondary, .text-dim,
.form-input) and rescue dropped chat tool-call rules into QuickChatFAB.css.
- Mobile fixes along the way: scroll containment for view containers
(min-height:0 + -webkit-overflow-scrolling), QuickChatFAB full-screen on
mobile (with safe-area-inset for iOS home bar), AgentsView single-row
header layout, ActivityLogModal close button on right, model-combobox
z-index above the mobile quick-chat panel.
- Bug fix: SkillsView toggle was display:none which hid the input from the
accessibility tree; replaced with the visually-hidden pattern so screen
readers + getByRole still find the checkbox.
- Bug fix: standalone Delete button in TaskDetailModal for triage-column
tasks (Actions dropdown is hidden in triage state, so previously no way
to delete a freshly-created task without status change first).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
202 lines
8.0 KiB
TypeScript
202 lines
8.0 KiB
TypeScript
import "./ExecutorStatusBar.css";
|
|
import { useMemo } from "react";
|
|
import type { Task } from "@fusion/core";
|
|
import { AlertTriangle, Clock, Pause, Play, Zap } from "lucide-react";
|
|
import { useExecutorStats } from "../hooks/useExecutorStats";
|
|
import type { ExecutorState, AiSessionSummary } from "../api";
|
|
import { BackgroundTasksIndicator } from "./BackgroundTasksIndicator";
|
|
|
|
interface ExecutorStatusBarProps {
|
|
/** Task list (shared with the board to keep counts in sync) */
|
|
tasks: Task[];
|
|
/** Project ID for fetching project-specific stats */
|
|
projectId?: string;
|
|
/** Project-level stuck task timeout in milliseconds (undefined = disabled) */
|
|
taskStuckTimeoutMs?: number;
|
|
/** Background AI sessions */
|
|
backgroundSessions?: AiSessionSummary[];
|
|
backgroundGenerating?: number;
|
|
backgroundNeedsInput?: number;
|
|
onOpenBackgroundSession?: (session: AiSessionSummary) => void;
|
|
onDismissBackgroundSession?: (id: string) => void;
|
|
/** Timestamp (ms) when task data was last confirmed fresh from the server. Used for freshness-aware stuck detection. */
|
|
lastFetchTimeMs?: number;
|
|
}
|
|
|
|
/**
|
|
* Format a relative time string (e.g., "2m ago", "1h ago")
|
|
*/
|
|
function formatRelativeTime(timestamp: string | undefined): string {
|
|
if (!timestamp) return "no activity";
|
|
|
|
const now = Date.now();
|
|
const then = new Date(timestamp).getTime();
|
|
const diffMs = now - then;
|
|
|
|
const seconds = Math.floor(diffMs / 1000);
|
|
const minutes = Math.floor(seconds / 60);
|
|
const hours = Math.floor(minutes / 60);
|
|
const days = Math.floor(hours / 24);
|
|
|
|
if (days > 0) return `${days}d ago`;
|
|
if (hours > 0) return `${hours}h ago`;
|
|
if (minutes > 0) return `${minutes}m ago`;
|
|
if (seconds > 10) return `${seconds}s ago`;
|
|
return "just now";
|
|
}
|
|
|
|
/**
|
|
* Get display configuration for an executor state
|
|
*/
|
|
function getStateDisplay(state: ExecutorState): { label: string; color: string; icon: typeof Play } {
|
|
switch (state) {
|
|
case "running":
|
|
return { label: "Running", color: "var(--color-success)", icon: Play };
|
|
case "paused":
|
|
return { label: "Paused", color: "var(--triage)", icon: Pause };
|
|
case "idle":
|
|
default:
|
|
return { label: "Idle", color: "var(--text-muted)", icon: Zap };
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Footer status bar component that displays real-time executor statistics.
|
|
*
|
|
* Shows:
|
|
* - Running tasks count with pulsing animation when > 0
|
|
* - Blocked tasks count with warning color when > 0
|
|
* - Queued tasks count
|
|
* - Executor state badge (idle/running/paused)
|
|
* - Last activity timestamp
|
|
*/
|
|
export function ExecutorStatusBar({ tasks, projectId, taskStuckTimeoutMs, backgroundSessions, backgroundGenerating, backgroundNeedsInput, onOpenBackgroundSession, onDismissBackgroundSession, lastFetchTimeMs }: ExecutorStatusBarProps) {
|
|
const { stats, loading, error } = useExecutorStats(tasks, projectId, taskStuckTimeoutMs, lastFetchTimeMs);
|
|
|
|
const stateDisplay = useMemo(() => getStateDisplay(stats.executorState), [stats.executorState]);
|
|
|
|
const relativeTime = useMemo(() => formatRelativeTime(stats.lastActivityAt), [stats.lastActivityAt]);
|
|
|
|
const StateIcon = stateDisplay.icon;
|
|
|
|
if (error) {
|
|
return (
|
|
<div className="executor-status-bar executor-status-bar--error" role="status" aria-label="Executor status">
|
|
<span className="executor-status-bar__error">
|
|
<AlertTriangle size={14} />
|
|
{error}
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (loading && stats.runningTaskCount === 0) {
|
|
return (
|
|
<div className="executor-status-bar executor-status-bar--loading" role="status" aria-label="Executor status">
|
|
<span className="executor-status-bar__loading-text">Loading...</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={`executor-status-bar ${stats.executorState === "running" ? "executor-status-bar--running" : ""}`}
|
|
role="status"
|
|
aria-label="Executor status"
|
|
>
|
|
{/* Background AI tasks indicator */}
|
|
{backgroundSessions && backgroundSessions.length > 0 && onOpenBackgroundSession && onDismissBackgroundSession && (
|
|
<>
|
|
<BackgroundTasksIndicator
|
|
sessions={backgroundSessions}
|
|
generating={backgroundGenerating ?? 0}
|
|
needsInput={backgroundNeedsInput ?? 0}
|
|
onOpenSession={onOpenBackgroundSession}
|
|
onDismissSession={onDismissBackgroundSession}
|
|
/>
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
</>
|
|
)}
|
|
|
|
{/* Queued tasks */}
|
|
<div className="executor-status-bar__segment">
|
|
<span className="executor-status-bar__indicator executor-status-bar__indicator--queued" aria-hidden="true" />
|
|
<span className="executor-status-bar__label">Queued</span>
|
|
<span className="executor-status-bar__count">{stats.queuedTaskCount}</span>
|
|
</div>
|
|
|
|
{/* Separator */}
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
|
|
{/* Running tasks */}
|
|
<div className="executor-status-bar__segment">
|
|
<span
|
|
className={`executor-status-bar__indicator executor-status-bar__indicator--running ${stats.runningTaskCount > 0 ? "executor-status-bar__indicator--active" : ""}`}
|
|
aria-hidden="true"
|
|
/>
|
|
<span className="executor-status-bar__label">Running</span>
|
|
<span className="executor-status-bar__count">{stats.runningTaskCount}</span>
|
|
<span className="executor-status-bar__separator" aria-hidden="true">/</span>
|
|
<span className="executor-status-bar__max">{stats.maxConcurrent}</span>
|
|
</div>
|
|
|
|
{/* Separator */}
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
|
|
{/* Stuck tasks */}
|
|
{stats.stuckTaskCount > 0 && (
|
|
<>
|
|
<div className="executor-status-bar__segment executor-status-bar__segment--stuck">
|
|
<span className="executor-status-bar__indicator executor-status-bar__indicator--stuck executor-status-bar__indicator--active" aria-hidden="true" />
|
|
<span className="executor-status-bar__label">Stuck</span>
|
|
<span className="executor-status-bar__count executor-status-bar__count--error">{stats.stuckTaskCount}</span>
|
|
</div>
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
</>
|
|
)}
|
|
|
|
{/* Blocked tasks */}
|
|
<div className="executor-status-bar__segment">
|
|
<span
|
|
className={`executor-status-bar__indicator executor-status-bar__indicator--blocked ${stats.blockedTaskCount > 0 ? "executor-status-bar__indicator--active" : ""}`}
|
|
aria-hidden="true"
|
|
/>
|
|
<span className="executor-status-bar__label">Blocked</span>
|
|
<span className={`executor-status-bar__count ${stats.blockedTaskCount > 0 ? "executor-status-bar__count--warning" : ""}`}>
|
|
{stats.blockedTaskCount}
|
|
</span>
|
|
</div>
|
|
|
|
{/* Separator */}
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
|
|
{/* In review count */}
|
|
<div className="executor-status-bar__segment">
|
|
<span className="executor-status-bar__indicator executor-status-bar__indicator--review" aria-hidden="true" />
|
|
<span className="executor-status-bar__label">In Review</span>
|
|
<span className="executor-status-bar__count">{stats.inReviewCount}</span>
|
|
</div>
|
|
|
|
{/* Spacer */}
|
|
<div className="executor-status-bar__spacer" />
|
|
|
|
{/* Last activity */}
|
|
<div className="executor-status-bar__segment executor-status-bar__segment--time">
|
|
<Clock size={12} className="executor-status-bar__icon" aria-hidden="true" />
|
|
<span className="executor-status-bar__time">{relativeTime}</span>
|
|
</div>
|
|
|
|
{/* Separator */}
|
|
<span className="executor-status-bar__divider" aria-hidden="true" />
|
|
|
|
{/* Executor state badge */}
|
|
<div className="executor-status-bar__segment">
|
|
<StateIcon size={12} style={{ color: stateDisplay.color }} aria-hidden="true" />
|
|
<span className="executor-status-bar__state" style={{ color: stateDisplay.color }}>
|
|
{stateDisplay.label}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|