-
-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add stale flags counter (#8741)
This PR adds the stale flag component to the health grid. In doing so, it also reworks the layout of the health row (now a grid) and updates the health component. In addition to removing the text from the component, I have adjust the SVG a bit to make it not shrink on smaller screens and have adjusted it's spacing, so that it's not full of dead space at the bottom. This makes it easier to style because it doesn't add 15px of invisible content. This PR also touches up a few other visual issues I found, such as header level and sidebar width. Wide: ![image](https://github.com/user-attachments/assets/acb57b17-eb7f-4b69-9bfa-1113bb748467) Medium: ![image](https://github.com/user-attachments/assets/a57331b0-825f-4b20-9b05-3ecd81804f5d) Narrow: ![image](https://github.com/user-attachments/assets/65c6e8d1-1783-4354-b71b-2867eabcc9ec)
- Loading branch information
1 parent
3e424ec
commit 9440b52
Showing
4 changed files
with
155 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
frontend/src/component/project/Project/ProjectStatus/StaleFlags.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Typography } from '@mui/material'; | ||
import { styled } from '@mui/material'; | ||
import { PrettifyLargeNumber } from 'component/common/PrettifyLargeNumber/PrettifyLargeNumber'; | ||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; | ||
import type { FC } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
const Wrapper = styled('article')(({ theme }) => ({ | ||
backgroundColor: theme.palette.envAccordion.expanded, | ||
padding: theme.spacing(3), | ||
borderRadius: theme.shape.borderRadiusExtraLarge, | ||
minWidth: '300px', | ||
gridArea: 'stale', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: theme.spacing(1), | ||
})); | ||
|
||
const BigText = styled('span')(({ theme }) => ({ | ||
fontSize: `calc(2 * ${theme.typography.body1.fontSize})`, | ||
lineHeight: 0, | ||
})); | ||
|
||
const BigNumber: FC<{ value?: number }> = ({ value }) => { | ||
return ( | ||
<BigText> | ||
<PrettifyLargeNumber | ||
value={value ?? 0} | ||
threshold={1000} | ||
precision={1} | ||
/> | ||
</BigText> | ||
); | ||
}; | ||
|
||
export const StaleFlags = () => { | ||
const projectId = useRequiredPathParam('projectId'); | ||
return ( | ||
<Wrapper> | ||
<Typography component='h4'> | ||
<BigNumber value={6} />{' '} | ||
<Link to={`/projects/${projectId}?state=IS%3Astale`}> | ||
stale flags | ||
</Link> | ||
</Typography> | ||
<Typography variant='body2'> | ||
Remember to archive your stale feature flags to keep the project | ||
healthy | ||
</Typography> | ||
</Wrapper> | ||
); | ||
}; |