bbgo_origin/frontend/pages/strategies.tsx

44 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2022-06-16 10:17:59 +00:00
import { styled } from '@mui/styles';
2022-06-14 09:30:33 +00:00
import DashboardLayout from '../layouts/DashboardLayout';
2022-06-15 10:57:28 +00:00
import { useEffect, useState } from 'react';
2022-06-16 04:36:45 +00:00
import { queryStrategiesMetrics } from '../api/bbgo';
import type { GridStrategy } from '../api/bbgo';
2022-06-14 09:30:33 +00:00
2022-06-16 08:47:35 +00:00
import Detail from '../components/Detail';
2022-06-14 09:30:33 +00:00
2022-06-16 10:17:59 +00:00
const StrategiesContainer = styled('div')(() => ({
width: '100%',
height: '100%',
padding: '40px 20px',
display: 'grid',
gridTemplateColumns: 'repeat(3, 350px);',
justifyContent: 'center',
gap: '30px',
'@media(max-width: 1400px)': {
gridTemplateColumns: 'repeat(2, 350px)',
},
'@media(max-width: 1000px)': {
gridTemplateColumns: '350px',
},
}));
2022-06-14 09:30:33 +00:00
2022-06-15 11:02:24 +00:00
export default function Strategies() {
2022-06-16 04:36:45 +00:00
const [details, setDetails] = useState<GridStrategy[]>([]);
2022-06-15 10:57:28 +00:00
useEffect(() => {
queryStrategiesMetrics().then((value) => {
setDetails(value);
2022-06-15 11:02:24 +00:00
});
}, []);
2022-06-14 09:30:33 +00:00
return (
<DashboardLayout>
2022-06-16 10:17:59 +00:00
<StrategiesContainer>
{details.map((element) => {
return <Detail key={element.id} data={element} />;
})}
</StrategiesContainer>
2022-06-15 10:57:28 +00:00
</DashboardLayout>
);
}