import { View, Text, TouchableOpacity, ActivityIndicator } from "react-native"; import { MaterialIcons } from "@expo/vector-icons"; import { ProgressBar } from "./ProgressBar"; import { ResetCountdown } from "./ResetCountdown"; interface UsageRow { label: string; percent: number; resetAtSeconds?: number; resetAtISO?: string; } interface ServiceStatusCardProps { title: string; icon: React.ComponentProps["name"]; accentColor: string; status: "idle" | "loading" | "success" | "error"; badge?: string; rows?: UsageRow[]; footer?: React.ReactNode; unconfiguredLabel?: string; onConfigurePress?: () => void; } export function ServiceStatusCard({ title, icon, accentColor, status, badge, rows, footer, unconfiguredLabel, onConfigurePress, }: ServiceStatusCardProps) { return ( {/* Header */} {title} {badge && ( {badge} )} {status === "success" && !badge && ( )} {status === "error" && ( )} {/* Body */} {status === "loading" && ( )} {status === "idle" && ( {unconfiguredLabel ?? "Not configured"} {onConfigurePress && ( Configure → )} )} {status === "error" && ( Failed to load usage data )} {status === "success" && rows && ( {rows.map((row, i) => ( {row.label} {Math.round(row.percent)}% ))} )} {footer && ( {footer} )} ); }