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";
|
2026-06-17 02:23:49 +02:00
|
|
|
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";
|
2026-06-16 08:40:51 +02:00
|
|
|
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";
|
2026-06-10 14:38:44 +02:00
|
|
|
import { UsageOverviewPanel } from "./usage-overview-panel";
|
2026-07-01 05:18:45 +02:00
|
|
|
import { ScorecardOverviewPanel } from "./scorecard-overview-panel";
|
2026-06-16 06:57:00 +02:00
|
|
|
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);
|
2026-06-16 06:57:00 +02:00
|
|
|
|
|
|
|
|
const hasError = errorOverview || errorFlags || errorTasks || errorActivity;
|
2026-04-20 15:10:54 +02:00
|
|
|
|
|
|
|
|
const handleRefresh = () => {
|
|
|
|
|
refetchOverview();
|
2026-06-16 06:57:00 +02:00
|
|
|
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>
|
|
|
|
|
|
2026-06-16 06:57:00 +02:00
|
|
|
{/* 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>
|
|
|
|
|
|
2026-06-17 06:36:28 +02:00
|
|
|
{/* 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>
|
|
|
|
|
|
2026-06-16 08:40:51 +02:00
|
|
|
{/* 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 />
|
2026-06-16 08:40:51 +02:00
|
|
|
<StrategySignalsPanel />
|
|
|
|
|
</div>
|
2026-04-20 15:10:54 +02:00
|
|
|
|
2026-06-17 02:23:49 +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 />
|
|
|
|
|
|
2026-07-01 05:18:45 +02:00
|
|
|
{/* 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} />
|
2026-06-10 14:38:44 +02:00
|
|
|
<UsageOverviewPanel />
|
2026-07-01 05:18:45 +02:00
|
|
|
<ScorecardOverviewPanel />
|
2026-04-20 15:10:54 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Blockers and Activity Row */}
|
2026-06-14 20:55:23 +02:00
|
|
|
<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>
|
|
|
|
|
);
|
|
|
|
|
}
|