diff --git a/frontend/src/component/common/HelpIcon/HelpIcon.tsx b/frontend/src/component/common/HelpIcon/HelpIcon.tsx index 70177f828a..364b7ea545 100644 --- a/frontend/src/component/common/HelpIcon/HelpIcon.tsx +++ b/frontend/src/component/common/HelpIcon/HelpIcon.tsx @@ -29,6 +29,7 @@ const StyledContainer = styled('span')<{ size: string | undefined }>( type IHelpIconProps = { tooltip: React.ReactNode; + tooltipId?: string; placement?: TooltipProps['placement']; children?: React.ReactNode; size?: string; @@ -43,6 +44,7 @@ type IHelpIconProps = { export const HelpIcon = ({ tooltip, htmlTooltip, + tooltipId, placement, children, size, @@ -55,6 +57,7 @@ export const HelpIcon = ({ return ( + {children ?? } diff --git a/frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx b/frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx index 5254193907..d2eb5399e5 100644 --- a/frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx +++ b/frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx @@ -1,6 +1,11 @@ import Icon from '@mui/material/Icon'; import { Box, Typography, styled } from '@mui/material'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { useUiFlag } from 'hooks/useUiFlag'; +import { useId } from 'hooks/useId'; +import { ScreenReaderOnly } from 'component/common/ScreenReaderOnly/ScreenReaderOnly'; +import { HelpIcon } from 'component/common/HelpIcon/HelpIcon'; +import InfoOutlined from '@mui/icons-material/InfoOutlined'; const StyledRingContainer = styled(Box)(({ theme }) => ({ display: 'flex', @@ -65,9 +70,16 @@ const StyledIcon = styled(Icon)(({ theme }) => ({ fontSize: '15px!important', })); +const LabelContainer = styled('div')({ + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', +}); + interface IFlagStatsProps { count: number; - flagsPerUser?: string; + flagsPerUser?: string; // todo: remove this prop with the lifecycleMetrics flag isLoading?: boolean; } @@ -76,41 +88,74 @@ export const FlagStats: React.FC = ({ flagsPerUser, isLoading, }) => { + const hideFlagsPerUser = useUiFlag('lifecycleMetrics'); + const labelId = hideFlagsPerUser ? useId() : ''; + const descriptionId = hideFlagsPerUser ? useId() : ''; return ( <> - - {isLoading ? '' : count} + + {isLoading ? ( + + Loading total flag count + + ) : ( + count + )} - - - - award_star - - Insights + {hideFlagsPerUser ? ( + + + Total number of flags + + + + + + ) : ( + + + + award_star + + Insights + + + + Flags per user - - - Flags per user - - - - {flagsPerUser} - - - } - /> + + + {flagsPerUser} + + + } + /> + )} ); };