-
-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change request insights widget (#6606)
- Loading branch information
Showing
3 changed files
with
146 additions
and
12 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
frontend/src/component/project/Project/ProjectInsights/ChangeRequests/ChangeRequests.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,131 @@ | ||
import { Box, styled, Typography } from '@mui/material'; | ||
import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight'; | ||
import { Link } from 'react-router-dom'; | ||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; | ||
|
||
const Container = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
})); | ||
|
||
const BoxesContainer = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
gap: theme.spacing(1), | ||
justifyContent: 'space-between', | ||
flexWrap: 'wrap', | ||
})); | ||
|
||
const NumberBox = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
padding: theme.spacing(1), | ||
borderRadius: theme.shape.borderRadiusMedium, | ||
border: `1px solid ${theme.palette.divider}`, | ||
})); | ||
|
||
const OpenBox = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flex: 1, | ||
borderRadius: theme.shape.borderRadiusMedium, | ||
padding: theme.spacing(3), | ||
border: `2px solid ${theme.palette.primary.main}`, | ||
})); | ||
|
||
const ColorBox = styled(Box)(({ theme }) => ({ | ||
borderRadius: '8px', | ||
padding: theme.spacing(1, 2), | ||
display: 'flex', | ||
gap: theme.spacing(6), | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
marginBottom: theme.spacing(1.5), | ||
whiteSpace: 'nowrap', | ||
})); | ||
|
||
const ApplyBox = styled(ColorBox)(({ theme }) => ({ | ||
background: theme.palette.success.light, | ||
})); | ||
|
||
const ReviewBox = styled(ColorBox)(({ theme }) => ({ | ||
background: theme.palette.secondary.light, | ||
})); | ||
|
||
const ChangeRequestNavigation = styled(Link)(({ theme }) => ({ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
marginBottom: theme.spacing(2.5), | ||
textDecoration: 'none', | ||
color: theme.palette.text.primary, | ||
})); | ||
|
||
const Title = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.spacing(2), | ||
color: theme.palette.text.secondary, | ||
marginBottom: theme.spacing(1), | ||
})); | ||
|
||
const MediumNumber = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.spacing(3), | ||
color: theme.palette.text.primary, | ||
})); | ||
|
||
const BigNumber = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.spacing(5.5), | ||
color: theme.palette.text.primary, | ||
})); | ||
|
||
export const ChangeRequests = () => { | ||
const projectId = useRequiredPathParam('projectId'); | ||
|
||
const toBeApplied = 12; | ||
const toBeReviewed = 3; | ||
const total = 32; | ||
const applied = 28; | ||
const rejected = 4; | ||
|
||
return ( | ||
<Container> | ||
<ChangeRequestNavigation | ||
to={`/projects/${projectId}/change-requests`} | ||
> | ||
<Typography variant='h3'>Change requests</Typography> | ||
<KeyboardArrowRight /> | ||
</ChangeRequestNavigation> | ||
|
||
<BoxesContainer> | ||
<OpenBox> | ||
<ChangeRequestNavigation | ||
to={`/projects/${projectId}/change-requests`} | ||
> | ||
<span>Open</span> | ||
<KeyboardArrowRight /> | ||
</ChangeRequestNavigation> | ||
<ApplyBox> | ||
<span>To be applied</span> | ||
<MediumNumber>{toBeApplied}</MediumNumber> | ||
</ApplyBox> | ||
<ReviewBox> | ||
<span>To be reviewed</span> | ||
<MediumNumber>{toBeReviewed}</MediumNumber> | ||
</ReviewBox> | ||
</OpenBox> | ||
<NumberBox> | ||
<Title>Total</Title> | ||
<BigNumber>{total}</BigNumber> | ||
</NumberBox> | ||
<NumberBox> | ||
<Title>Applied</Title> | ||
<BigNumber>{applied}</BigNumber> | ||
</NumberBox> | ||
<NumberBox> | ||
<Title>Rejected</Title> | ||
<BigNumber>{rejected}</BigNumber> | ||
</NumberBox> | ||
</BoxesContainer> | ||
</Container> | ||
); | ||
}; |
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