import Head from 'next/head' import { Inter } from 'next/font/google' import { MonitorState } from '@/uptime.types' import { KVNamespace } from '@cloudflare/workers-types' import config from '@/uptime.config' import OverallStatus from '@/components/OverallStatus' import Header from '@/components/Header' import MonitorList from '@/components/MonitorList' import { Center, Divider, Text } from '@mantine/core' export const runtime = 'experimental-edge' const inter = Inter({ subsets: ['latin'] }) export default function Home({ state }: { state: MonitorState }) { return ( <> {config.page.title}
{state === undefined ? (
Monitor State is not defined now, please check your worker's status and KV binding!
) : (
)}
Open-source monitoring and status page powered by{' '} Uptimeflare {' '} and{' '} Cloudflare , made with ❤ by{' '} lyc8503 .
) } export async function getServerSideProps() { const { UPTIMEFLARE_STATE } = process.env as unknown as { UPTIMEFLARE_STATE: KVNamespace } const state = (await UPTIMEFLARE_STATE?.get( 'state', 'json' )) as unknown as MonitorState return { props: { state } } }