Files
roboco/panel/src/components/dashboard/command-center.tsx
T

149 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-04-20 15:10:54 +02:00
"use client";
2026-06-29 05:38:21 +02:00
import {
useCeoOverview,
useAuditorFlags,
useRecentActivity,
} from "@/hooks/use-dashboard";
2026-04-20 15:10:54 +02:00
import { useTasks } from "@/hooks/use-tasks";
import { TeamHealthCards } from "./team-health-cards";
import { KeyMetricsPanel } from "./key-metrics-panel";
import { AuditorAlertsPanel } from "./auditor-alerts-panel";
import { ActiveBlockersPanel } from "./active-blockers-panel";
import { RecentActivityFeed } from "./recent-activity-feed";
import { QuickActionsBar } from "./quick-actions-bar";
import { CeoApprovalQueue } from "./ceo-approval-queue";
import { PrReviewQueue } from "./pr-review-queue";
2026-06-26 01:43:08 +02:00
import { ReleaseProposalCard } from "./release-proposal-card";
import { PlaybookReviewQueue } from "./playbook-review-queue";
import { StrategySignalsPanel } from "./strategy-signals-panel";
2026-04-20 15:10:54 +02:00
import type { Activity } from "./activity-item";
import { Button } from "@/components/ui/button";
import { UsageOverviewPanel } from "./usage-overview-panel";
import { ScorecardOverviewPanel } from "./scorecard-overview-panel";
import { RefreshCw, Settings, AlertCircle } from "lucide-react";
2026-04-20 15:10:54 +02:00
import Link from "next/link";
export function CommandCenter() {
2026-06-29 05:38:21 +02:00
const {
data: overview,
isLoading: loadingOverview,
isError: errorOverview,
refetch: refetchOverview,
} = useCeoOverview();
const {
data: flags,
isLoading: loadingFlags,
isError: errorFlags,
refetch: refetchFlags,
} = useAuditorFlags({ resolved: false });
const {
data: tasks,
isLoading: loadingTasks,
isError: errorTasks,
refetch: refetchTasks,
} = useTasks();
const {
data: activity,
isLoading: loadingActivity,
isError: errorActivity,
refetch: refetchActivity,
} = useRecentActivity(24);
const hasError = errorOverview || errorFlags || errorTasks || errorActivity;
2026-04-20 15:10:54 +02:00
const handleRefresh = () => {
refetchOverview();
refetchFlags();
refetchTasks();
refetchActivity();
2026-04-20 15:10:54 +02:00
};
return (
<div className="space-y-6">
{/* Header */}
<div className="flex items-center justify-between">
<div>
2026-06-29 05:38:21 +02:00
<h1 className="text-3xl font-bold tracking-tight">
RoboCo Command Center
</h1>
2026-04-20 15:10:54 +02:00
<p className="text-muted-foreground">
Complete visibility into all operations
</p>
</div>
<div className="flex items-center gap-2">
<Button variant="outline" onClick={handleRefresh}>
<RefreshCw className="h-4 w-4 mr-2" />
Refresh
</Button>
2026-07-02 15:36:49 +02:00
<Link href="/settings" prefetch={false}>
2026-04-20 15:10:54 +02:00
<Button variant="ghost" size="icon">
<Settings className="h-5 w-5" />
</Button>
</Link>
</div>
</div>
{/* Error indicator */}
{hasError && (
<div className="flex items-center gap-2 rounded-md border border-destructive/50 bg-destructive/10 px-4 py-2 text-sm text-destructive">
<AlertCircle className="h-4 w-4 shrink-0" />
Some data failed to load. Click Refresh to try again.
</div>
)}
2026-04-20 15:10:54 +02:00
{/* Team Health */}
<section>
<h2 className="text-lg font-semibold mb-4">Team Health</h2>
<TeamHealthCards
teams={overview?.health_status}
isLoading={loadingOverview}
/>
</section>
{/* Quick Actions — placed immediately after Team Health so it is
visible without scrolling on a 900px-tall viewport, before the
data-heavy grid rows below. */}
<section>
<h2 className="text-lg font-semibold mb-4">Quick Actions</h2>
<QuickActionsBar />
</section>
{/* CEO Approval Queue + Strategy Signals - side-by-side on lg+ */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
2026-04-20 15:10:54 +02:00
<CeoApprovalQueue />
<StrategySignalsPanel />
</div>
2026-04-20 15:10:54 +02:00
{/* External-PR review decision queue (hidden when empty) */}
<PrReviewQueue />
2026-06-26 01:43:08 +02:00
{/* Gated release proposal (hidden when none open) */}
<ReleaseProposalCard />
{/* Playbook review queue (hidden when no drafts) */}
<PlaybookReviewQueue />
{/* Metrics, Alerts, Usage, and Performance Row */}
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 gap-6">
2026-04-20 15:10:54 +02:00
<KeyMetricsPanel
metrics={overview?.key_metrics}
isLoading={loadingOverview}
/>
<AuditorAlertsPanel alerts={flags} isLoading={loadingFlags} />
<UsageOverviewPanel />
<ScorecardOverviewPanel />
2026-04-20 15:10:54 +02:00
</div>
{/* Blockers and Activity Row */}
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 2xl:grid-cols-2 gap-6">
2026-04-20 15:10:54 +02:00
<ActiveBlockersPanel tasks={tasks} isLoading={loadingTasks} />
<RecentActivityFeed
activities={activity as Activity[] | undefined}
isLoading={loadingActivity}
/>
</div>
</div>
);
}