diff --git a/frontend/app/dashboard/page.tsx b/frontend/app/dashboard/page.tsx deleted file mode 100644 index 1e8889dda..000000000 --- a/frontend/app/dashboard/page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -'use client' - -import { MainLayout } from '@/components/layout/main-layout' -import { Dashboard } from '@/components/dashboard/dashboard' -import { usePageAPI } from '@/hooks/use-page-api' - -export default function DashboardPage() { - usePageAPI('dashboard') - - return ( - - - - ) -} diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index fd035fa7a..bb96691f3 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -2,7 +2,5 @@ import { redirect } from 'next/navigation' export default function Home() { // New home is Chat - // Keep this as a server redirect to avoid rendering dashboard on "/" - // and to make "/dashboard" the dedicated dashboard route. redirect('/chat') } diff --git a/frontend/components/activity/activity-page.tsx b/frontend/components/activity/activity-page.tsx index c673d7e99..7dbcf660a 100644 --- a/frontend/components/activity/activity-page.tsx +++ b/frontend/components/activity/activity-page.tsx @@ -15,6 +15,9 @@ import { Calendar, Rss, History, + Zap, + MessageSquare, + Boxes, } from 'lucide-react' import { Button } from '@/components/ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' @@ -25,6 +28,12 @@ import { ActivityFeed } from './activity-feed' import { CommandCenterHistory } from './command-center-history' import { ActivityCalendar } from './calendar' import { useActivityStats } from '@/hooks/use-activity-api' +import { + useActivationMetrics, + useMissionSuccessRate, + useErrorsBySubsystem, + useWidgetEngagement, +} from '@/hooks/use-analytics-api' import type { StatItem } from '@/components/shared/stats-bar' import { cn } from '@/lib/utils' @@ -128,6 +137,66 @@ export function ActivityPage() { { label: 'Needs Attention', value: liveStats?.needs_attention ?? 0, icon: AlertTriangle, iconColor: 'text-destructive' }, ] + // PRD-142 Wave 0 (US-007) — "Is it working?" platform vitals over the real + // measurement endpoints. Per-primitive health (US-006) has no honest data + // source yet and renders as an explicit placeholder, not a fake green. + const { data: activation } = useActivationMetrics() + const { data: mission } = useMissionSuccessRate() + const { data: errors } = useErrorsBySubsystem('24h') + const { data: widget } = useWidgetEngagement('7d') + + const totalWs = activation?.total_workspaces ?? 0 + const activationPct = totalWs > 0 ? Math.round((activation?.rate ?? 0) * 100) : 0 + + const missionTotal = mission?.total_executions ?? 0 + const missionPct = missionTotal > 0 ? Math.round(mission?.value ?? 0) : 0 + + const errorTotal = errors?.total ?? 0 + const worstSubsystem = errors?.by_subsystem?.length + ? [...errors.by_subsystem].sort((a, b) => b.count - a.count)[0] + : null + + const widgetSessions = widget?.sessions ?? 0 + const widgetEvents = widget?.by_event_type?.reduce((sum, ev) => sum + ev.count, 0) ?? 0 + + const vitals: StatItem[] = [ + { + label: 'Activation', + value: totalWs > 0 ? `${activationPct}%` : '—', + change: totalWs > 0 ? `${activation?.activated ?? 0}/${totalWs} workspaces` : 'No workspaces yet', + icon: Zap, + iconColor: 'text-primary', + }, + { + label: 'Mission success rate', + value: missionTotal > 0 ? `${missionPct}%` : '—', + change: missionTotal > 0 ? `${mission?.successful_executions ?? 0}/${missionTotal} missions` : 'No missions yet', + icon: CheckCircle2, + iconColor: 'text-[hsl(var(--success))]', + }, + { + label: 'Error rate by subsystem', + value: errorTotal, + change: errorTotal > 0 && worstSubsystem ? `${worstSubsystem.subsystem} (${worstSubsystem.count}) · 24h` : 'None · 24h', + icon: AlertTriangle, + iconColor: errorTotal > 0 ? 'text-destructive' : 'text-[hsl(var(--success))]', + }, + { + label: 'Widget engagement', + value: widgetSessions, + change: widgetSessions > 0 ? `${widgetEvents} events · 7d` : 'No widget activity', + icon: MessageSquare, + iconColor: 'text-[hsl(var(--info))]', + }, + { + label: 'Per-primitive health', + value: '—', + change: 'Not yet measured', + icon: Boxes, + iconColor: 'text-muted-foreground', + }, + ] + return (
@@ -164,6 +233,10 @@ export function ActivityPage() {
+
+ +
+
diff --git a/frontend/components/auth/user-profile-button.tsx b/frontend/components/auth/user-profile-button.tsx index a9ac0a90f..bc911163d 100644 --- a/frontend/components/auth/user-profile-button.tsx +++ b/frontend/components/auth/user-profile-button.tsx @@ -16,8 +16,8 @@ interface UserProfileButtonProps { } export function UserProfileButton({ - afterSignInUrl = '/dashboard', - afterSignUpUrl = '/dashboard', + afterSignInUrl = '/chat', + afterSignUpUrl = '/chat', }: UserProfileButtonProps) { const { isSignedIn, isLoaded } = useUser() diff --git a/frontend/components/command-center/command-center-shell.tsx b/frontend/components/command-center/command-center-shell.tsx index 9a4a4b668..ccb69825f 100644 --- a/frontend/components/command-center/command-center-shell.tsx +++ b/frontend/components/command-center/command-center-shell.tsx @@ -24,6 +24,7 @@ import { useActivitySchedule } from '@/hooks/use-activity-api' import { useDecisionsNeeded } from '@/hooks/use-kpi-api' import { StatsStrip } from './stats-strip' +import { IsItWorkingStrip } from './is-it-working-strip' import { SummaryTab } from './summary-tab' import { BoardTab } from './board-tab' import { CalendarTab } from './calendar-tab' @@ -138,6 +139,7 @@ export function CommandCenterShell() {
+