import { Alert, List, Text, Group, Box } from '@mantine/core' import { IconAlertTriangle } from '@tabler/icons-react' import { MaintenanceConfig, MonitorTarget } from '@/types/config' export default function MaintenanceAlert({ maintenance, style, upcoming = false, }: { maintenance: Omit & { monitors?: MonitorTarget[] } style?: React.CSSProperties upcoming?: boolean }) { return ( } title={ upcoming ? `Upcoming Maintenance: ${maintenance.title || 'Scheduled Maintenance'}` : maintenance.title || 'Scheduled Maintenance' } color={upcoming ? 'gray' : maintenance.color || '#f29030'} withCloseButton={false} style={{ margin: '16px auto', ...style }} > {/* Body and dates in a responsive flex layout */} {/* Maintenance description and affected components */} {maintenance.body} {maintenance.monitors && maintenance.monitors.length > 0 && ( <> Affected components: {maintenance.monitors.map((comp, idx) => ( {comp.name} ))} )} {/* Date range */} {upcoming ? 'Scheduled for' : 'From'}: {new Date(maintenance.start).toLocaleString()}
{upcoming ? 'Expected end' : 'To'}:{' '} {maintenance.end ? new Date(maintenance.end).toLocaleString() : 'Until further notice'}
) }