bbgo_origin/apps/backtest-report/pages/index.tsx

52 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-05-16 17:53:51 +00:00
import type {NextPage} from 'next'
2022-05-06 05:47:13 +00:00
import Head from 'next/head'
import styles from '../styles/Home.module.css'
2022-05-18 18:21:21 +00:00
import { useRouter } from "next/router";
2022-05-18 17:00:45 +00:00
import {AppShell, Header, Navbar, Text} from '@mantine/core';
2022-05-17 17:53:48 +00:00
import ReportDetails from '../components/ReportDetails';
import ReportNavigator from '../components/ReportNavigator';
2022-05-18 18:21:21 +00:00
import {useEffect, useState} from "react";
2022-05-11 11:51:31 +00:00
2022-05-06 05:47:13 +00:00
const Home: NextPage = () => {
2022-05-17 17:53:48 +00:00
const [currentReport, setCurrentReport] = useState<any>();
2022-05-18 18:21:21 +00:00
const { query } = useRouter();
const basePath = query.basePath ? query.basePath as string : '/output';
2022-05-06 05:47:13 +00:00
return (
2022-05-18 17:00:45 +00:00
<div>
2022-05-06 05:47:13 +00:00
<Head>
2022-05-18 17:00:45 +00:00
<title>BBGO Back-Test Report</title>
2022-05-16 17:53:51 +00:00
<meta name="description" content="Generated by create next app"/>
<link rel="icon" href="/favicon.ico"/>
2022-05-06 05:47:13 +00:00
</Head>
<main className={styles.main}>
2022-05-18 17:00:45 +00:00
<AppShell
padding="md"
navbar={<Navbar width={{base: 250}} height={500} p="xs">
<ReportNavigator onSelect={(reportEntry) => {
setCurrentReport(reportEntry)
}}/>
</Navbar>}
header={
<Header height={60} p="md">
<Text>BBGO Back-Test Report</Text>
</Header>
}
styles={(theme) => ({
main: {backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0]},
})}
>
{
2022-05-18 18:21:21 +00:00
currentReport ? <ReportDetails basePath={basePath} runID={currentReport.id}/> : null
2022-05-18 17:00:45 +00:00
}
</AppShell>
2022-05-06 05:47:13 +00:00
</main>
</div>
)
}
export default Home