diff --git a/components/MaintenanceAlert.tsx b/components/MaintenanceAlert.tsx index d0e8a97..5919e0c 100644 --- a/components/MaintenanceAlert.tsx +++ b/components/MaintenanceAlert.tsx @@ -1,6 +1,7 @@ import { Alert, List, Text, Group, Box } from '@mantine/core' import { IconAlertTriangle } from '@tabler/icons-react' import { MaintenanceConfig, MonitorTarget } from '@/types/config' +import { pageConfig } from '@/uptime.config' export default function MaintenanceAlert({ maintenance, @@ -19,7 +20,7 @@ export default function MaintenanceAlert({ ? `Upcoming Maintenance: ${maintenance.title || 'Scheduled Maintenance'}` : maintenance.title || 'Scheduled Maintenance' } - color={upcoming ? 'gray' : maintenance.color || '#f29030'} + color={upcoming ? (pageConfig.maintenances?.upcomingColor ?? 'gray') : maintenance.color || '#f29030'} withCloseButton={false} style={{ margin: '16px auto', ...style }} > @@ -58,7 +59,6 @@ export default function MaintenanceAlert({ minWidth: 120, }} > - {upcoming ? 'Scheduled for' : 'From'}: {new Date(maintenance.start).toLocaleString()}
{upcoming ? 'Expected end' : 'To'}:{' '} diff --git a/types/config.ts b/types/config.ts index 83c39a6..5b954cd 100644 --- a/types/config.ts +++ b/types/config.ts @@ -4,6 +4,9 @@ export type PageConfig = { title?: string links?: PageConfigLink[] group?: PageConfigGroup + maintenances?: { + upcomingColor?: string | null + } } export type MaintenanceConfig = { diff --git a/uptime.config.ts b/uptime.config.ts index d2ddf4f..63ab017 100644 --- a/uptime.config.ts +++ b/uptime.config.ts @@ -16,6 +16,12 @@ const pageConfig: PageConfig = { '🌐 Public (example group name)': ['foo_monitor', 'bar_monitor', 'more monitor ids...'], '🔐 Private': ['test_tcp_monitor'], }, + // [OPTIONAL] Maintenance style + maintenances: { + // If not specified all upcoming maintenance alerts will default to "gray", + // when they are active they will use the color specified in the `MaintenanceConfig[]` + upcomingColor: "gray" + } } const workerConfig: WorkerConfig = {