mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
00b3cbaa8b
Data fetching for dashboard https://linear.app/unleash/issue/1-1969/dashboard-users-chart-api-hook
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { Box, Paper, styled, Typography } from '@mui/material';
|
|
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
|
import { VFC } from 'react';
|
|
import { UsersChart } from './UsersChart/UsersChart';
|
|
import { FlagsChart } from './FlagsChart/FlagsChart';
|
|
import { useExecutiveDashboard } from 'hooks/api/getters/useExecutiveSummary/useExecutiveSummary';
|
|
import { UserStats } from './UserStats/UserStats';
|
|
|
|
const StyledGrid = styled(Box)(({ theme }) => ({
|
|
display: 'grid',
|
|
gridTemplateColumns: `repeat(auto-fill, minmax(600px, 1fr))`,
|
|
gridAutoRows: '1fr',
|
|
gap: theme.spacing(2),
|
|
}));
|
|
|
|
export const ExecutiveDashboard: VFC = () => {
|
|
const { executiveDashboardData, loading, error } = useExecutiveDashboard();
|
|
|
|
return (
|
|
<>
|
|
<Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}>
|
|
<PageHeader
|
|
titleElement={
|
|
<Typography variant='h1' component='h2'>
|
|
Dashboard
|
|
</Typography>
|
|
}
|
|
/>
|
|
</Box>
|
|
<StyledGrid>
|
|
<UserStats />
|
|
<UsersChart
|
|
userTrends={executiveDashboardData?.userTrends ?? []}
|
|
/>
|
|
<Paper>Stats</Paper>
|
|
<FlagsChart
|
|
flagsTrends={executiveDashboardData?.flagsTrends ?? []}
|
|
/>
|
|
</StyledGrid>
|
|
</>
|
|
);
|
|
};
|