"use client" import { cn } from "@/lib/utils" import { AlertTriangle, CheckCircle, ChevronDown, ChevronUp, Info, XCircle } from "lucide-react" import { useState } from "react" interface Service { id: string name: string status: "operational" | "incident" | "outage" | "unknown" description: string details: string hasDetails?: boolean } interface StatusSectionProps { title?: string services?: Service[] showIncidentHistory?: boolean onIncidentClick?: () => void className?: string } const StatusSection = ({ title = "Status", services = [], showIncidentHistory = true, onIncidentClick = () => { }, className = "", }: StatusSectionProps) => { const [expandedServices, setExpandedServices] = useState>(new Set()) const toggleService = (serviceId: string) => { const newExpanded = new Set(expandedServices) if (newExpanded.has(serviceId)) { newExpanded.delete(serviceId) } else { newExpanded.add(serviceId) } setExpandedServices(newExpanded) } const getStatusIcon = (status: Service["status"]) => { switch (status) { case "operational": return case "incident": return case "outage": return default: return } } const getStatusColor = (status: Service["status"]) => { switch (status) { case "operational": return "bg-green-500 dark:bg-green-400" case "incident": return "bg-yellow-500 dark:bg-yellow-400" case "outage": return "bg-red-500 dark:bg-red-400" default: return "bg-muted-foreground" } } const getStatusText = (status: Service["status"]) => { switch (status) { case "operational": return "No issues" case "incident": return "Incident" case "outage": return "Outage" default: return "Unknown" } } const defaultServices: Service[] = [ { id: "login-sso", name: "Login / SSO", status: "operational", description: "Single Sign-On authentication services", details: "All authentication endpoints are responding normally", }, { id: "connectivity", name: "Connectivity", status: "incident", description: "Network connectivity and routing", details: "Something is not quite right. View details", hasDetails: true, }, { id: "listener", name: "Listener", status: "operational", description: "Event listening and processing services", details: "All listeners are processing events successfully", }, { id: "parser", name: "Parser", status: "operational", description: "Data parsing and transformation services", details: "All parsers are functioning optimally", }, { id: "alerts", name: "Alerts", status: "operational", description: "Notification and alerting system", details: "Alert delivery systems are fully operational", }, { id: "web-application", name: "Web Application", status: "operational", description: "Main web application platform", details: "Web application is running smoothly", }, ] const activeServices = services.length > 0 ? services : defaultServices return (

{title}

{showIncidentHistory && ( )}
{/* Incident Banner */}

Users may be experiencing issues connecting to Alpha

Today · 9:21 AM EDT ·

{/* Status Legend */}
Current Status by service
No issues
Incident
Outage
{/* Services List */}
{activeServices.map((service) => (

{service.name}

{service.hasDetails && ( )}

{getStatusText(service.status)}

{getStatusIcon(service.status)}
{expandedServices.has(service.id) && service.hasDetails && (

{service.details}

{service.status === "incident" && (
Last updated: 2 minutes ago
)}
)}
))}
{/* Footer */}

Last updated: {new Date().toLocaleString()}

) } export default StatusSection