import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Bell, Zap, Shield, HardDrive, ChevronRight } from 'lucide-react'; import { formatCount } from '@/lib/utils'; import { useConfigurationStatus } from './useConfigurationStatus'; import type { SectionId } from '@/components/settings/types'; interface ConfigurationStatusProps { onOpenSettings?: (section: SectionId) => void; } function StatusBadge({ value, locked, requiredTier }: { value: string; locked?: boolean; requiredTier?: string; }) { if (locked && requiredTier) { const label = requiredTier === 'admiral' ? 'Admiral' : 'Skipper'; return ( {label} ); } const lower = value.toLowerCase(); if (lower === 'on' || lower === 'enabled') { return ( ON ); } if (lower === 'off' || lower === 'disabled') { return ( OFF ); } return ( {value} ); } function Row({ label, value, locked, requiredTier, onClick }: { label: string; value: string; locked?: boolean; requiredTier?: string; onClick?: () => void; }) { const labelClass = `text-xs ${locked ? 'text-stat-subtitle/60' : 'text-stat-subtitle'}`; if (onClick) { return ( ); } return (
{label}
); } function SectionHeader({ icon: Icon, label }: { icon: typeof Bell; label: string }) { return (
{label}
); } function SkeletonRow() { return (
); } export function ConfigurationStatus({ onOpenSettings }: ConfigurationStatusProps) { const { status, loading } = useConfigurationStatus(); const open = (section: SectionId) => () => onOpenSettings?.(section); if (loading) { return ( Configuration Status {Array.from({ length: 8 }).map((_, i) => )} ); } if (!status) { return ( Configuration Status

Unable to load configuration.

); } const { notifications, automation, security, thresholds, backup } = status; const agentSummary = (() => { const { discord, slack, webhook } = notifications.agents; const active = [ discord.enabled ? 'Discord' : null, slack.enabled ? 'Slack' : null, webhook.enabled ? 'Webhook' : null, ].filter(Boolean); return active.length === 0 ? 'None' : active.join(', '); })(); const ssoLabel = (() => { if (!security.ssoEnabled) return 'Off'; const names: Record = { oidc_custom: 'OIDC', oidc_google: 'Google', oidc_github: 'GitHub', oidc_okta: 'Okta', ldap: 'LDAP', }; return (security.ssoProvider && names[security.ssoProvider]) ?? 'Enabled'; })(); return ( Configuration Status
); }