import React, {useState} from 'react';
import { useRouter } from 'next/router';
import {makeStyles} from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
import TotalAssetsPie from '../components/TotalAssetsPie';
import TotalAssetSummary from '../components/TotalAssetsSummary';
import TradingVolumePanel from '../components/TradingVolumePanel';
import ExchangeSessionTabPanel from '../components/ExchangeSessionTabPanel';
import DashboardLayout from '../layouts/DashboardLayout';
import {querySessions} from "../api/bbgo";
const useStyles = makeStyles((theme) => ({
paper: {
height: 140,
width: 200,
},
totalAssetsBox: {
height: 300,
},
totalAssetsSummary: {
padding: theme.spacing(2),
},
control: {
padding: theme.spacing(2),
},
}));
// props are pageProps passed from _app.tsx
export default function Home() {
const classes = useStyles();
const { push } = useRouter();
const [sessions, setSessions] = React.useState([])
React.useEffect(() => {
querySessions((sessions) => {
if (sessions && sessions.length > 0) {
setSessions(sessions)
} else {
push("/setup");
}
}).catch((err) => {
console.error(err);
})
}, [])
if (sessions.length == 0) {
return (
Loading
);
}
return (
Total Assets
);
}