diff --git a/frontend/src/component/personalDashboard/FlagMetricsChart.tsx b/frontend/src/component/personalDashboard/FlagMetricsChart.tsx index 9456556f43..7d5d37215d 100644 --- a/frontend/src/component/personalDashboard/FlagMetricsChart.tsx +++ b/frontend/src/component/personalDashboard/FlagMetricsChart.tsx @@ -11,7 +11,7 @@ import annotationPlugin from 'chartjs-plugin-annotation'; import { Bar } from 'react-chartjs-2'; import useTheme from '@mui/material/styles/useTheme'; import { type FC, useEffect, useMemo, useState } from 'react'; -import { Box, type Theme, styled } from '@mui/material'; +import { Box, type Theme, styled, Typography } from '@mui/material'; import { FeatureMetricsHours } from '../feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours'; import GeneralSelect from '../common/GeneralSelect/GeneralSelect'; import { useFeatureMetricsRaw } from 'hooks/api/getters/useFeatureMetricsRaw/useFeatureMetricsRaw'; @@ -27,16 +27,14 @@ import { FlagExposure } from 'component/feature/FeatureView/FeatureOverview/Feat const defaultYes = [0, 14, 28, 21, 33, 31, 31, 22, 26, 37, 31, 14, 21, 14, 0]; -const placeholderData = (theme: Theme, label?: string) => ({ +const placeholderData = (theme: Theme) => ({ labels: Array.from({ length: 15 }, (_, i) => i + 1), datasets: [ { data: defaultYes, backgroundColor: theme.palette.divider, hoverBackgroundColor: theme.palette.divider, - label: - label || - 'No metrics for this feature flag in the selected environment and time period', + label: '', }, ], }); @@ -46,7 +44,7 @@ const ChartWrapper = styled('div')({ flexGrow: 1, }); -export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({ +const PlaceholderFlagMetricsChart: React.FC<{ label: string }> = ({ label, }) => { const theme = useTheme(); @@ -56,21 +54,22 @@ export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({ }, [theme]); const data = useMemo(() => { - return placeholderData(theme, label); + return placeholderData(theme); }, [theme]); + const labelId = 'placeholder-chart-label'; + return ( - - - + <> + {label} + + + + ); }; -export const EmptyFlagMetricsChart = () => { +const EmptyFlagMetricsChart = () => { const theme = useTheme(); const options = useMemo(() => { @@ -177,7 +176,8 @@ const EnvironmentSelect: FC<{ const MetricsSelectors = styled(Box)(({ theme }) => ({ display: 'flex', - justifyContent: 'flex-end', + justifyContent: 'flex-start', + flexFlow: 'row wrap', gap: theme.spacing(2), })); @@ -195,12 +195,23 @@ const StyledExposure = styled(FlagExposure)({ justifySelf: 'start', }); -const ExposureAndMetricsRow = styled('div')({ +const ExposureAndMetricsRow = styled('div')(({ theme }) => ({ display: 'flex', - flexFlow: 'row', justifyContent: 'space-between', + flexFlow: 'row wrap', width: '100%', -}); + gap: theme.spacing(1), +})); + +export const PlaceholderFlagMetricsChartWithWrapper: React.FC<{ + label: string; +}> = (props) => { + return ( + + + + ); +}; export const FlagMetricsChart: FC<{ flag: { name: string; project: string }; @@ -245,7 +256,7 @@ export const FlagMetricsChart: FC<{ {loading ? ( ) : noData ? ( - + ) : ( ); const PlaceholderFlagMetricsChart = React.lazy(() => import('./FlagMetricsChart').then((module) => ({ - default: module.PlaceholderFlagMetricsChart, + default: module.PlaceholderFlagMetricsChartWithWrapper, })), ); diff --git a/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx b/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx index fe18760b8b..fce80ebf17 100644 --- a/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx +++ b/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx @@ -12,7 +12,7 @@ type Props = { const Wrapper = styled('div')(({ theme }) => ({ width: '100%', display: 'flex', - flexDirection: 'row', + flexFlow: 'row wrap', gap: theme.spacing(1), justifyContent: 'space-between', }));