The page (pages/, components/, styles/) is rewritten in Cottage's brand, replacing Mantine. - Brand files: tokens, fonts and component CSS copied from Hearth; logo, pod row, status pill and banner ported from the brand handbook. - Themes: light by default, dark when the OS asks. - Services: grouped; each has a status pill, uptime and 90 daily bars (30 on phones). - Bars: each bar has a text label, keyboard navigation and a day card. - Response-time chart: optional, drawn in brand colours. - Notices: colour-coded posted notices and planned maintenance. - Incident history: by month, with the brand's empty state. The check worker, D1 storage, types and Terraform are untouched, so upstream merges stay clean. uptime.config.ts lists Cottage's services (website, dashboard, apps in US East). `npm run dev` shows sample data (?sample=outage|maintenance|empty) since there's no D1. Deploys are gated on the CLOUDFLARE_DEPLOY repository variable until launch, Wrangler telemetry is off, and a Check workflow lints, type-checks and builds every pull request. Removed upstream's issue-translation workflow, funding file and translations.
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { MaintenanceConfig, MonitorTarget } from '@/types/config'
|
|
import { formatDateTime, noticeTone } from '@/util/status'
|
|
import { Banner } from './brand'
|
|
|
|
function when(n: MaintenanceConfig) {
|
|
const now = new Date()
|
|
const start = formatDateTime(n.start)
|
|
const end = n.end ? formatDateTime(n.end) : null
|
|
if (new Date(n.start) > now) return end ? `Planned for ${start} to ${end}` : `Planned for ${start}`
|
|
if (!n.end || new Date(n.end) > now) return end ? `Since ${start}, expected to end ${end}` : `Since ${start}`
|
|
return `${start} to ${end}`
|
|
}
|
|
|
|
// A posted notice (incident update or maintenance) from `maintenances` in uptime.config.ts.
|
|
export default function Notice({
|
|
notice,
|
|
monitors,
|
|
upcoming = false,
|
|
}: {
|
|
notice: MaintenanceConfig
|
|
monitors: MonitorTarget[]
|
|
upcoming?: boolean
|
|
}) {
|
|
const affected = (notice.monitors || []).map(
|
|
(id) => monitors.find((m) => m.id === id)?.name ?? id
|
|
)
|
|
const tone = upcoming ? 'info' : noticeTone(notice.color)
|
|
return (
|
|
<Banner tone={tone as any} title={notice.title || (upcoming ? 'Planned maintenance' : 'Maintenance')}>
|
|
<p className="st-notice__when">{when(notice)}</p>
|
|
<p className="st-notice__body">{notice.body}</p>
|
|
{affected.length > 0 && <p className="st-notice__affected">Affects: {affected.join(', ')}</p>}
|
|
</Banner>
|
|
)
|
|
}
|