'use client'; import React from 'react'; import { OperationsHealth, ComponentHealthStatus, HealthComponentKey } from './types'; import { HEALTH_COMPONENT_METADATA } from '../../lib/ops-data'; interface OperationsOverviewProps { health: OperationsHealth; onRefresh: () => Promise | void; isRefreshing: boolean; } export function OperationsOverview({ health, onRefresh, isRefreshing, }: OperationsOverviewProps) { const componentKeys: HealthComponentKey[] = [ 'operations_api', 'operations_database', 'session_validation', 'audit_persistence', ]; function getStatusBadge(status: ComponentHealthStatus) { switch (status) { case 'available': return { label: 'AVAILABLE', icon: 'check_circle', classes: 'bg-emerald-950/60 text-emerald-400 border-emerald-800/60', }; case 'degraded': return { label: 'DEGRADED', icon: 'warning', classes: 'bg-amber-950/60 text-amber-400 border-amber-800/60', }; case 'unavailable': return { label: 'UNAVAILABLE', icon: 'cancel', classes: 'bg-rose-950/60 text-rose-400 border-rose-800/60', }; case 'unknown': default: return { label: 'UNKNOWN', icon: 'help', classes: 'bg-surface-container-highest text-on-surface-variant border-outline-variant/40', }; } } const formattedCheckedAt = health.checked_at ? new Date(health.checked_at).toLocaleString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit', timeZoneName: 'short', }) : '--'; return (
{/* Header Row: Title & Manual Refresh */}
SYSTEM HEALTH

Operations Overview

Real-time health telemetry across core Operations subsystems.

Last checked
{/* 4 Health Status Cards */}
{componentKeys.map((key) => { const meta = HEALTH_COMPONENT_METADATA[key]; const comp = health.components?.[key]; const status = comp?.status ?? 'unknown'; const badge = getStatusBadge(status); return (
Subsystem

{meta.name}

{comp?.description || meta.description}

Status
{badge.icon} {badge.label}
); })}
{/* Operational Policy & Architecture Boundary */}
verified_user

Operational Architecture & Data Boundary

Authority Source

PostgreSQL ops.operators schema. Consumer roles and Firebase custom claims strictly bypassed.

Privacy Isolation

Zero cross-rider data access. Personal rides, GPS points, vehicles, and billing accounts are structurally inaccessible.

Session Integrity

Governed by host-prefixed __Host-motorsignal_ops cookies with strict same-origin isolation.

); }