2024-01-22 11:07:38 +01:00
|
|
|
import { Box, Paper, styled, Typography } from '@mui/material';
|
|
|
|
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
2024-01-18 12:32:25 +01:00
|
|
|
import { VFC } from 'react';
|
2024-01-22 11:07:38 +01:00
|
|
|
import { UsersChart } from './UsersChart/UsersChart';
|
2024-01-22 12:15:49 +01:00
|
|
|
import { FlagsChart } from './FlagsChart/FlagsChart';
|
2024-01-26 09:03:12 +01:00
|
|
|
import { useExecutiveDashboard } from 'hooks/api/getters/useExecutiveSummary/useExecutiveSummary';
|
2024-01-25 14:43:59 +01:00
|
|
|
import { UserStats } from './UserStats/UserStats';
|
2024-01-26 14:22:16 +01:00
|
|
|
import { FlagStats } from './FlagStats/FlagStats';
|
2024-01-22 11:07:38 +01:00
|
|
|
|
|
|
|
const StyledGrid = styled(Box)(({ theme }) => ({
|
|
|
|
display: 'grid',
|
2024-01-26 14:33:11 +01:00
|
|
|
gridTemplateColumns: `300px 1fr`,
|
|
|
|
// TODO: responsive grid size
|
2024-01-30 09:00:06 +01:00
|
|
|
gridAutoRows: 'auto',
|
2024-01-22 11:07:38 +01:00
|
|
|
gap: theme.spacing(2),
|
|
|
|
}));
|
2024-01-18 12:32:25 +01:00
|
|
|
|
|
|
|
export const ExecutiveDashboard: VFC = () => {
|
2024-01-26 09:03:12 +01:00
|
|
|
const { executiveDashboardData, loading, error } = useExecutiveDashboard();
|
|
|
|
|
2024-01-22 11:07:38 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}>
|
|
|
|
<PageHeader
|
|
|
|
titleElement={
|
|
|
|
<Typography variant='h1' component='h2'>
|
|
|
|
Dashboard
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
<StyledGrid>
|
2024-01-25 14:43:59 +01:00
|
|
|
<UserStats />
|
2024-01-26 09:03:12 +01:00
|
|
|
<UsersChart
|
|
|
|
userTrends={executiveDashboardData?.userTrends ?? []}
|
|
|
|
/>
|
2024-01-30 09:00:06 +01:00
|
|
|
<FlagStats />
|
2024-01-26 09:03:12 +01:00
|
|
|
<FlagsChart
|
|
|
|
flagsTrends={executiveDashboardData?.flagsTrends ?? []}
|
|
|
|
/>
|
2024-01-22 11:07:38 +01:00
|
|
|
</StyledGrid>
|
|
|
|
</>
|
|
|
|
);
|
2024-01-18 12:32:25 +01:00
|
|
|
};
|