Skip to content

Commit

Permalink
Add close button, fix layout, refactor (#8755)
Browse files Browse the repository at this point in the history
This PR consists of cleanup for the project status modal as well as
adding the missing button.

I've added inline comments to explain the different steps.

It now looks like this:

![image](https://github.com/user-attachments/assets/29a3c0b7-770c-4019-aaed-b363c5804138)
  • Loading branch information
thomasheartman authored Nov 14, 2024
1 parent 395a4b6 commit b4e2d5d
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 240 deletions.
2 changes: 1 addition & 1 deletion frontend/src/assets/icons/projectStatus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import { styled, Tooltip } from '@mui/material';
const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
gap: theme.spacing(2),
}));

const TitleContainer = styled('h4')({
margin: 0,
width: '100%',
});

type Output = { date: string; count: number; level: number };

const ensureFullYearData = (data: Output[]): Output[] => {
Expand Down Expand Up @@ -93,7 +86,6 @@ export const ProjectActivity = () => {
<>
{data.activityCountByDate.length > 0 ? (
<StyledContainer>
<TitleContainer>Activity in project</TitleContainer>
<ActivityCalendar
theme={explicitTheme}
data={fullData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import { Link } from 'react-router-dom';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';

const HealthContainer = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.envAccordion.expanded,
padding: theme.spacing(3),
borderRadius: theme.shape.borderRadiusExtraLarge,
minWidth: '300px',
gridArea: 'health',
}));
import { HealthGridTile } from './ProjectHealthGrid.styles';

const TextContainer = styled('div')(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -63,7 +56,7 @@ export const ProjectHealth = () => {
: theme.palette.success.border;

return (
<HealthContainer>
<HealthGridTile>
<ChartRow>
<SVGWrapper>
<StyledSVG viewBox='0 0 100 100'>
Expand Down Expand Up @@ -111,6 +104,6 @@ export const ProjectHealth = () => {
)}
</TextContainer>
</ChartRow>
</HealthContainer>
</HealthGridTile>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { styled } from '@mui/material';

export const HealthGridTile = styled('article')(({ theme }) => ({
backgroundColor: theme.palette.envAccordion.expanded,
padding: theme.spacing(3),
borderRadius: theme.shape.borderRadiusExtraLarge,
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ProjectHealth } from './ProjectHealth';
import { styled } from '@mui/material';
import { StaleFlags } from './StaleFlags';
import { ProjectResources } from './ProjectResources';

const onNarrowGrid = (css: object) => ({
'@container (max-width: 650px)': css,
'@supports not (container-type: inline-size)': {
'@media (max-width: 712px)': css,
},
});

const HealthContainer = styled('div')({
containerType: 'inline-size',
});

const HealthGrid = styled('div')(({ theme }) => ({
display: 'grid',
gridTemplateAreas: `
"health resources"
"stale resources"
`,
gridTemplateColumns: 'repeat(2, minmax(300px, 1fr))',
gap: theme.spacing(1, 2),
...onNarrowGrid({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(1),
}),
}));

const Tile = styled('div', {
shouldForwardProp: (prop) => prop !== 'gridArea',
})<{ gridArea: string }>(({ theme, gridArea }) => ({
gridArea,
'&>*': {
height: '100%',
},
}));

export const ProjectHealthGrid = () => {
return (
<HealthContainer>
<HealthGrid>
<Tile gridArea='health'>
<ProjectHealth />
</Tile>
<Tile gridArea='stale'>
<StaleFlags />
</Tile>
<Tile gridArea='resources'>
<ProjectResources />
</Tile>
</HealthGrid>
</HealthContainer>
);
};
Loading

0 comments on commit b4e2d5d

Please sign in to comment.