import { Card } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { useBackendHealth } from '@/hooks/useBackendHealth';
import { useHealthAlerts } from '@/hooks/useHealthAlerts';
import { HealthAlertSettings } from '@/components/HealthAlertSettings';
import { AlertCircle, CheckCircle, RefreshCw, XCircle, Clock, AlertTriangle, Settings } from 'lucide-react';
import { formatDistanceToNow } from 'date-fns';
import { useState } from 'react';
export function BackendHealthMonitor() {
const { healthReport, loading, lastChecked, refresh } = useBackendHealth(true, 60000);
const { config, updateConfig, clearAlertHistory } = useHealthAlerts(healthReport);
const [showSettings, setShowSettings] = useState(false);
const getStatusIcon = (status: string) => {
switch (status) {
case 'healthy':
return
Running health checks...
{key.replace(/_/g, ' ').replace('edge function ', '')}
{check.message}