import { Alert, List, Text } from '@mantine/core' import { IconAlertTriangle } from '@tabler/icons-react' import { MaintenanceConfig, MonitorTarget } from '@/types/config' export default function MaintenanceAlert({ maintenance, style, hash, }: { maintenance: Omit & { monitors?: MonitorTarget[] } style?: React.CSSProperties hash?: string }) { const titleStyle: React.CSSProperties = {} if (hash) { titleStyle['textDecoration'] = 'underline' titleStyle['cursor'] = 'pointer' } function updateHash() { if (!hash) return window.location.hash = hash } return (
} title={ ( {maintenance.title} ) || 'Scheduled Maintenance' } color={maintenance.color || 'yellow'} withCloseButton={false} style={{ position: 'relative', margin: '16px auto 0 auto', ...style }} > {/* Date range in top right */}
From: {new Date(maintenance.start).toLocaleString()}
To:{' '} {maintenance.end ? new Date(maintenance.end).toLocaleString() : 'Until further notice'}
{maintenance.body} {maintenance.monitors && maintenance.monitors.length > 0 && ( <> Affected components: {maintenance.monitors.map((comp, compIdx) => ( {comp.name} ))} )}
) }