bbgo_origin/frontend/pages/_app.tsx

49 lines
1.2 KiB
TypeScript
Raw Normal View History

import React, { useEffect } from 'react';
2021-01-24 06:32:52 +00:00
import PropTypes from 'prop-types';
import Head from 'next/head';
2021-01-24 10:12:26 +00:00
2022-06-12 15:11:42 +00:00
import { ThemeProvider } from '@mui/material/styles';
2021-01-24 06:32:52 +00:00
2022-06-12 15:11:42 +00:00
import CssBaseline from '@mui/material/CssBaseline';
2021-01-24 06:32:52 +00:00
import theme from '../src/theme';
2022-06-11 00:57:54 +00:00
import '../styles/globals.css';
import {triggerSync} from "../api/bbgo";
2021-02-22 07:01:05 +00:00
2021-01-24 06:32:52 +00:00
export default function MyApp(props) {
2022-06-11 00:57:54 +00:00
const { Component, pageProps } = props;
2021-01-24 10:12:26 +00:00
useEffect(() => {
2022-06-11 00:57:54 +00:00
// Remove the server-side injected CSS.
const jssStyles = document.querySelector('#jss-server-side');
if (jssStyles) {
jssStyles.parentElement.removeChild(jssStyles);
}
}, []);
2021-01-24 10:12:26 +00:00
useEffect(() => {
triggerSync()
}, [])
2022-06-11 00:57:54 +00:00
return (
<React.Fragment>
<Head>
<title>BBGO</title>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
/>
</Head>
<ThemeProvider theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
<Component {...pageProps} />
2022-06-11 00:57:54 +00:00
</ThemeProvider>
</React.Fragment>
);
2021-01-24 06:07:44 +00:00
}
2021-01-24 06:32:52 +00:00
MyApp.propTypes = {
2022-06-11 00:57:54 +00:00
Component: PropTypes.elementType.isRequired,
pageProps: PropTypes.object.isRequired,
2021-01-24 06:32:52 +00:00
};