Uptime Flare
Current Status: {overallStatus}
Last updated on: {state.lastUpdate.toString()}
{ config.monitors.map(monitor => ({monitor.name}
{JSON.stringify(state)}
import Head from 'next/head' import { Inter } from 'next/font/google' const inter = Inter({ subsets: ['latin'] }) import { MonitorState } from '@/uptime.types' import { KVNamespace } from '@cloudflare/workers-types' import config from '@/uptime.config' export const runtime = 'experimental-edge' export default function Home({ state }: { state: MonitorState }) { // Calculate overall status // TODO: Move this to a component let downCount = 0 let upCount = 0 for (const monitor of config.monitors) { if (state.history[monitor.id]?.slice(-1)[0].up) { upCount += 1 } else { downCount += 1 } } let overallStatus = "" if (downCount === 0 && upCount === 0) { overallStatus = "No monitors configured" } if (downCount === 0) { overallStatus = "All systems operational" } if (upCount === 0) { overallStatus = "All systems not operational" } if (upCount > 0 && downCount > 0) { overallStatus = "Some systems not operational" } return ( <>
{JSON.stringify(state)}