1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: dashboard layout (#6063)

Align widgets properly on main screen. Responsive view in next PRs
This commit is contained in:
Tymoteusz Czech 2024-01-30 09:00:06 +01:00 committed by GitHub
parent 9d2c65c9c0
commit 46fb40ca08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 65 deletions

View File

@ -11,7 +11,7 @@ const StyledGrid = styled(Box)(({ theme }) => ({
display: 'grid', display: 'grid',
gridTemplateColumns: `300px 1fr`, gridTemplateColumns: `300px 1fr`,
// TODO: responsive grid size // TODO: responsive grid size
gridAutoRows: '1fr', gridAutoRows: 'auto',
gap: theme.spacing(2), gap: theme.spacing(2),
})); }));
@ -31,11 +31,10 @@ export const ExecutiveDashboard: VFC = () => {
</Box> </Box>
<StyledGrid> <StyledGrid>
<UserStats /> <UserStats />
<FlagStats />
<UsersChart <UsersChart
userTrends={executiveDashboardData?.userTrends ?? []} userTrends={executiveDashboardData?.userTrends ?? []}
/> />
<Paper>Stats</Paper> <FlagStats />
<FlagsChart <FlagsChart
flagsTrends={executiveDashboardData?.flagsTrends ?? []} flagsTrends={executiveDashboardData?.flagsTrends ?? []}
/> />

View File

@ -12,7 +12,7 @@ import {
} from 'chart.js'; } from 'chart.js';
import { Line } from 'react-chartjs-2'; import { Line } from 'react-chartjs-2';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import { Paper, Theme, useTheme } from '@mui/material'; import { Paper, Theme, Typography, useTheme } from '@mui/material';
import { import {
useLocationSettings, useLocationSettings,
type ILocationSettings, type ILocationSettings,
@ -54,20 +54,6 @@ const createOptions = (theme: Theme, locationSettings: ILocationSettings) =>
({ ({
responsive: true, responsive: true,
plugins: { plugins: {
title: {
text: 'Number of flags',
position: 'top',
align: 'start',
display: true,
font: {
size: 16,
weight: '400',
},
padding: {
bottom: 24,
},
color: theme.palette.text.primary,
},
legend: { legend: {
position: 'bottom', position: 'bottom',
}, },
@ -132,6 +118,12 @@ const FlagsChartComponent: VFC<IFlagsChartComponentProps> = ({
return ( return (
<Paper sx={(theme) => ({ padding: theme.spacing(4) })}> <Paper sx={(theme) => ({ padding: theme.spacing(4) })}>
<Typography
variant='h3'
sx={(theme) => ({ marginBottom: theme.spacing(3) })}
>
Number of flags
</Typography>
<Line options={options} data={data} /> <Line options={options} data={data} />
</Paper> </Paper>
); );

View File

@ -75,8 +75,6 @@ const StyledLink = styled(Link)({
export const UserStats = () => { export const UserStats = () => {
return ( return (
<>
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<StyledContent> <StyledContent>
<StyledHeader variant='h1'>Total users</StyledHeader> <StyledHeader variant='h1'>Total users</StyledHeader>
<StyledUserContainer> <StyledUserContainer>
@ -109,8 +107,6 @@ export const UserStats = () => {
</StyledLink> </StyledLink>
</StyledLinkContainer> </StyledLinkContainer>
</StyledContent> </StyledContent>
</Box>
</>
); );
}; };
@ -204,7 +200,6 @@ const UserDistributionInfo: React.FC<IUserDistributionInfoProps> = ({
}) => { }) => {
return ( return (
<StyledUserDistContainer> <StyledUserDistContainer>
<Box sx={{ display: 'flex' }}>
<StyledUserDistIndicator type={type} /> <StyledUserDistIndicator type={type} />
<StyledDistInfoInnerContainer> <StyledDistInfoInnerContainer>
<StyledDistInfoTextContainer> <StyledDistInfoTextContainer>
@ -217,7 +212,6 @@ const UserDistributionInfo: React.FC<IUserDistributionInfoProps> = ({
{count} {count}
</StyledCountTypography> </StyledCountTypography>
</StyledDistInfoInnerContainer> </StyledDistInfoInnerContainer>
</Box>
</StyledUserDistContainer> </StyledUserDistContainer>
); );
}; };