fix: move index to Layout Component
parent
09077c4506
commit
e83caa1cfb
|
|
@ -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'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'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,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue