-
-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds the flag widget: <img width="333" alt="Skjermbilde 2024-01-26 kl 14 16 19" src="https://github.com/Unleash/unleash/assets/16081982/57b8c312-fcd5-4a3f-85f7-76514c671912">
- Loading branch information
1 parent
9b281ca
commit 4a025a4
Showing
2 changed files
with
125 additions
and
0 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
123 changes: 123 additions & 0 deletions
123
frontend/src/component/executiveDashboard/FlagStats/FlagStats.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,123 @@ | ||
import { Settings } from '@mui/icons-material'; | ||
import { Box, Typography, styled } from '@mui/material'; | ||
import { HelpIcon } from 'component/common/HelpIcon/HelpIcon'; | ||
|
||
const StyledContent = styled(Box)(({ theme }) => ({ | ||
borderRadius: `${theme.shape.borderRadiusLarge}px`, | ||
backgroundColor: theme.palette.background.paper, | ||
maxWidth: 300, | ||
padding: theme.spacing(3), | ||
})); | ||
|
||
const StyledHeader = styled(Typography)(({ theme }) => ({ | ||
marginBottom: theme.spacing(3), | ||
fontSize: theme.fontSizes.bodySize, | ||
fontWeight: 'bold', | ||
display: 'flex', | ||
alignItems: 'center', | ||
})); | ||
|
||
const StyledRingContainer = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
})); | ||
|
||
const StyledRing = styled(Box)(({ theme }) => ({ | ||
borderRadius: '50%', | ||
width: '200px', | ||
height: '200px', | ||
border: `10px solid ${theme.palette.secondary.border}`, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
})); | ||
|
||
const StyledRingContent = styled(Box)(({ theme }) => ({ | ||
borderRadius: '50%', | ||
width: '180px', | ||
height: '180px', | ||
backgroundColor: theme.palette.secondary.light, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
fontWeight: 'bold', | ||
fontSize: theme.fontSizes.extraLargeHeader, | ||
border: `10px solid ${theme.palette.background.paper}`, | ||
})); | ||
|
||
const StyledInsightsContainer = styled(Box)(({ theme }) => ({ | ||
marginTop: theme.spacing(4), | ||
padding: theme.spacing(1.5), | ||
background: theme.palette.background.elevation2, | ||
borderRadius: `${theme.shape.borderRadius}px`, | ||
display: 'flex', | ||
alignItems: 'center', | ||
})); | ||
|
||
const StyledHeaderContainer = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
})); | ||
|
||
const StyledTextContainer = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
})); | ||
|
||
const StyledFlagCountPerUser = styled(Typography)(({ theme }) => ({ | ||
marginLeft: 'auto', | ||
fontSize: theme.fontSizes.mainHeader, | ||
})); | ||
|
||
const StyledSettingsIcon = styled(Settings)(({ theme }) => ({ | ||
color: theme.palette.primary.main, | ||
width: '15px', | ||
height: '15px', | ||
marginRight: theme.spacing(0.5), | ||
})); | ||
|
||
export const FlagStats = () => { | ||
return ( | ||
<StyledContent> | ||
<StyledHeader variant='h1'> | ||
Total flags{' '} | ||
<HelpIcon | ||
htmlTooltip | ||
tooltip={ | ||
<Box> | ||
<Typography variant='body2'> | ||
Total flags represent the total active flags | ||
(not archived) that currently exist across all | ||
projects of your application. | ||
</Typography> | ||
</Box> | ||
} | ||
/> | ||
</StyledHeader> | ||
<StyledRingContainer> | ||
<StyledRing> | ||
<StyledRingContent>9999</StyledRingContent> | ||
</StyledRing> | ||
</StyledRingContainer> | ||
|
||
<StyledInsightsContainer> | ||
<StyledTextContainer> | ||
<StyledHeaderContainer> | ||
<StyledSettingsIcon /> | ||
<Typography | ||
fontWeight='bold' | ||
variant='body2' | ||
color='primary' | ||
> | ||
Insights | ||
</Typography> | ||
</StyledHeaderContainer> | ||
<Typography variant='body2'>Flags per user</Typography> | ||
</StyledTextContainer> | ||
<StyledFlagCountPerUser>3.5</StyledFlagCountPerUser> | ||
</StyledInsightsContainer> | ||
</StyledContent> | ||
); | ||
}; |