mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: adjust the height of the flag section (#8426)
This commit adjusts the height of the flag section in the personal dashboard, so that the chart doesn't cause scrolling on the widest version. Before: ![image](https://github.com/user-attachments/assets/32a30338-b647-4458-bc09-604e821b30c7) After: ![image](https://github.com/user-attachments/assets/c4760900-ef1b-4c45-b8aa-f81dff2a3a55) Also fixes some issues in regards to super big lists when it goes into flex mode and makes the chart more responsive
This commit is contained in:
parent
e72aa2871e
commit
01b2a15b8a
@ -42,7 +42,8 @@ const placeholderData = (theme: Theme, label?: string) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const ChartWrapper = styled('div')({
|
const ChartWrapper = styled('div')({
|
||||||
width: '80%',
|
width: '100%',
|
||||||
|
flexGrow: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({
|
export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({
|
||||||
@ -185,6 +186,8 @@ const ChartContainer = styled('div')(({ theme }) => ({
|
|||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
gap: theme.spacing(3),
|
gap: theme.spacing(3),
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
height: '100%',
|
||||||
|
justifyContent: 'space-between',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledExposure = styled(FlagExposure)({
|
const StyledExposure = styled(FlagExposure)({
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Box, styled } from '@mui/material';
|
import { Box, List, styled } from '@mui/material';
|
||||||
import type { Theme } from '@mui/material/styles/createTheme';
|
import type { Theme } from '@mui/material/styles/createTheme';
|
||||||
|
|
||||||
export const ContentGridContainer = styled('div')({
|
export const ContentGridContainer = styled('div')({
|
||||||
@ -49,7 +49,7 @@ export const ProjectGrid = styled(ContentGrid)(
|
|||||||
export const FlagGrid = styled(ContentGrid)(
|
export const FlagGrid = styled(ContentGrid)(
|
||||||
onWideContainer({
|
onWideContainer({
|
||||||
gridTemplateColumns: '1fr 1fr 1fr',
|
gridTemplateColumns: '1fr 1fr 1fr',
|
||||||
gridTemplateRows: '450px',
|
gridTemplateRows: '410px',
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateAreas: `
|
gridTemplateAreas: `
|
||||||
"flags chart chart"
|
"flags chart chart"
|
||||||
@ -104,3 +104,12 @@ export const listItemStyle = (theme: Theme) => ({
|
|||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
gap: theme.spacing(1),
|
gap: theme.spacing(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const StyledList = styled(List)(({ theme }) => ({
|
||||||
|
overflowY: 'auto',
|
||||||
|
maxHeight: '400px',
|
||||||
|
|
||||||
|
...onWideContainer({
|
||||||
|
maxHeight: '100%',
|
||||||
|
})({ theme }),
|
||||||
|
}));
|
||||||
|
@ -2,7 +2,6 @@ import {
|
|||||||
Box,
|
Box,
|
||||||
IconButton,
|
IconButton,
|
||||||
Link,
|
Link,
|
||||||
List,
|
|
||||||
ListItem,
|
ListItem,
|
||||||
ListItemButton,
|
ListItemButton,
|
||||||
Typography,
|
Typography,
|
||||||
@ -28,6 +27,7 @@ import {
|
|||||||
ProjectGrid,
|
ProjectGrid,
|
||||||
GridItem,
|
GridItem,
|
||||||
SpacedGridItem,
|
SpacedGridItem,
|
||||||
|
StyledList,
|
||||||
} from './Grid';
|
} from './Grid';
|
||||||
import { ContactAdmins, DataError } from './ProjectDetailsError';
|
import { ContactAdmins, DataError } from './ProjectDetailsError';
|
||||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
@ -199,10 +199,7 @@ export const MyProjects = forwardRef<
|
|||||||
<ContentGridContainer ref={ref}>
|
<ContentGridContainer ref={ref}>
|
||||||
<ProjectGrid>
|
<ProjectGrid>
|
||||||
<SpacedGridItem gridArea='projects'>
|
<SpacedGridItem gridArea='projects'>
|
||||||
<List
|
<StyledList>
|
||||||
disablePadding={true}
|
|
||||||
sx={{ height: '100%', overflow: 'auto' }}
|
|
||||||
>
|
|
||||||
{projects.map((project) => (
|
{projects.map((project) => (
|
||||||
<ProjectListItem
|
<ProjectListItem
|
||||||
key={project.id}
|
key={project.id}
|
||||||
@ -211,7 +208,7 @@ export const MyProjects = forwardRef<
|
|||||||
onClick={() => setActiveProject(project.id)}
|
onClick={() => setActiveProject(project.id)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</StyledList>
|
||||||
</SpacedGridItem>
|
</SpacedGridItem>
|
||||||
<SpacedGridItem gridArea='box1'>
|
<SpacedGridItem gridArea='box1'>
|
||||||
{box1Content()}
|
{box1Content()}
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
IconButton,
|
IconButton,
|
||||||
Link,
|
Link,
|
||||||
List,
|
|
||||||
ListItem,
|
ListItem,
|
||||||
ListItemButton,
|
ListItemButton,
|
||||||
styled,
|
styled,
|
||||||
@ -32,6 +31,7 @@ import {
|
|||||||
ListItemBox,
|
ListItemBox,
|
||||||
listItemStyle,
|
listItemStyle,
|
||||||
SpacedGridItem,
|
SpacedGridItem,
|
||||||
|
StyledList,
|
||||||
} from './Grid';
|
} from './Grid';
|
||||||
import { ContentGridNoProjects } from './ContentGridNoProjects';
|
import { ContentGridNoProjects } from './ContentGridNoProjects';
|
||||||
import ExpandMore from '@mui/icons-material/ExpandMore';
|
import ExpandMore from '@mui/icons-material/ExpandMore';
|
||||||
@ -390,7 +390,7 @@ export const PersonalDashboard = () => {
|
|||||||
<SpacedGridItem gridArea='flags'>
|
<SpacedGridItem gridArea='flags'>
|
||||||
{personalDashboard &&
|
{personalDashboard &&
|
||||||
personalDashboard.flags.length > 0 ? (
|
personalDashboard.flags.length > 0 ? (
|
||||||
<List
|
<StyledList
|
||||||
disablePadding={true}
|
disablePadding={true}
|
||||||
sx={{
|
sx={{
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@ -410,7 +410,7 @@ export const PersonalDashboard = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</StyledList>
|
||||||
) : activeProject ? (
|
) : activeProject ? (
|
||||||
<NoActiveFlagsInfo>
|
<NoActiveFlagsInfo>
|
||||||
<Typography>
|
<Typography>
|
||||||
|
@ -40,6 +40,7 @@ export const createPlaceholderBarChartOptions = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
stacked: true,
|
stacked: true,
|
||||||
@ -78,7 +79,7 @@ export const createBarChartOptions = (
|
|||||||
hoursBack: number,
|
hoursBack: number,
|
||||||
locationSettings: ILocationSettings,
|
locationSettings: ILocationSettings,
|
||||||
): ChartOptions<'bar'> => {
|
): ChartOptions<'bar'> => {
|
||||||
const { responsive, elements, interaction, scales } =
|
const { responsive, elements, interaction, scales, maintainAspectRatio } =
|
||||||
createPlaceholderBarChartOptions(theme);
|
createPlaceholderBarChartOptions(theme);
|
||||||
return {
|
return {
|
||||||
plugins: {
|
plugins: {
|
||||||
@ -153,6 +154,7 @@ export const createBarChartOptions = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
responsive,
|
responsive,
|
||||||
|
maintainAspectRatio,
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
...(scales ? scales.x : {}),
|
...(scales ? scales.x : {}),
|
||||||
|
Loading…
Reference in New Issue
Block a user