fix: move index to Layout Component

pull/108/head
Bennet Gallein 2025-05-10 11:26:10 +02:00
parent 09077c4506
commit e83caa1cfb
No known key found for this signature in database
GPG Key ID: 54F2DF6954E8C635
1 changed files with 17 additions and 56 deletions

View File

@ -1,14 +1,12 @@
import Head from 'next/head'
import { Inter } from 'next/font/google' import { Inter } from 'next/font/google'
import { MonitorState, MonitorTarget } from '@/types/config' import { MonitorState, MonitorTarget } from '@/types/config'
import { KVNamespace } from '@cloudflare/workers-types' import { KVNamespace } from '@cloudflare/workers-types'
import { maintenances, pageConfig, workerConfig } from '@/uptime.config' import { maintenances, workerConfig } from '@/uptime.config'
import OverallStatus from '@/components/OverallStatus' import OverallStatus from '@/components/OverallStatus'
import Header from '@/components/Header'
import MonitorList from '@/components/MonitorList' import MonitorList from '@/components/MonitorList'
import { Center, Divider, Text } from '@mantine/core' import { Center, Text } from '@mantine/core'
import MonitorDetail from '@/components/MonitorDetail' import MonitorDetail from '@/components/MonitorDetail'
import Layout from '@/components/Layout'
export const runtime = 'experimental-edge' export const runtime = 'experimental-edge'
const inter = Inter({ subsets: ['latin'] }) const inter = Inter({ subsets: ['latin'] })
@ -42,54 +40,20 @@ export default function Home({
} }
return ( return (
<> <Layout>
<Head> {state == undefined ? (
<title>{pageConfig.title}</title> <Center>
<link rel="icon" href="/favicon.ico" /> <Text fw={700}>
</Head> Monitor State is not defined now, please check your worker&apos;s status and KV binding!
</Text>
<main className={inter.className}> </Center>
<Header /> ) : (
<div>
{state == undefined ? ( <OverallStatus state={state} monitors={monitors} maintenances={maintenances} />
<Center> <MonitorList monitors={monitors} state={state} />
<Text fw={700}> </div>
Monitor State is not defined now, please check your worker&apos;s status and KV )}
binding! </Layout>
</Text>
</Center>
) : (
<div>
<OverallStatus state={state} monitors={monitors} maintenances={maintenances} />
<MonitorList monitors={monitors} state={state} />
</div>
)}
<Divider mt="lg" />
<Text
size="xs"
mt="xs"
mb="xs"
style={{
textAlign: 'center',
}}
>
Open-source monitoring and status page powered by{' '}
<a href="https://github.com/lyc8503/UptimeFlare" target="_blank">
Uptimeflare
</a>{' '}
and{' '}
<a href="https://www.cloudflare.com/" target="_blank">
Cloudflare
</a>
, made with by{' '}
<a href="https://github.com/lyc8503" target="_blank">
lyc8503
</a>
.
</Text>
</main>
</>
) )
} }
@ -106,11 +70,8 @@ export async function getServerSideProps() {
return { return {
id: monitor.id, id: monitor.id,
name: monitor.name, name: monitor.name,
// @ts-ignore
tooltip: monitor?.tooltip, tooltip: monitor?.tooltip,
// @ts-ignore
statusPageLink: monitor?.statusPageLink, statusPageLink: monitor?.statusPageLink,
// @ts-ignore
hideLatencyChart: monitor?.hideLatencyChart, hideLatencyChart: monitor?.hideLatencyChart,
} }
}) })