From fb9855c3fad883ca9d595a7ff79bd8d055a02c84 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Tue, 9 Apr 2024 17:48:04 +0300 Subject: [PATCH] fix: Do not show the MetricsChartTooltip InfoSummary when all projects (#6810) What it says on the tin Closes # [](https://linear.app/unleash/issue/1-2275/hide-bottom-part-of-metrics-tooltip-when-all-projects) Screenshot 2024-04-09 at 16 57 13 Screenshot 2024-04-09 at 16 55 53 --------- Signed-off-by: andreas-unleash --- .../MetricsChartTooltip-InfoSummary.test.tsx | 18 ------- .../MetricsChartTooltip.tsx | 51 ++++++++++++------- 2 files changed, 33 insertions(+), 36 deletions(-) delete mode 100644 frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx diff --git a/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx deleted file mode 100644 index dc60887b68..0000000000 --- a/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import { InfoSummary } from './MetricsChartTooltip'; - -test('Renders apps, flags, and environments, even when their data is `N/A`', () => { - render( - , - ); - - screen.getByText('Environments'); - screen.getByText('Apps'); - screen.getByText('Flags'); -}); diff --git a/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx index 6cd3c5b48e..9054c162ff 100644 --- a/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx +++ b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx @@ -2,6 +2,7 @@ import type { VFC } from 'react'; import type { InstanceInsightsSchemaMetricsSummaryTrendsItem } from 'openapi'; import { Box, Divider, Paper, styled, Typography } from '@mui/material'; import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip'; +import { ConditionallyRender } from '../../../../common/ConditionallyRender/ConditionallyRender'; const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({ padding: theme.spacing(2), @@ -126,24 +127,38 @@ export const MetricsSummaryTooltip: VFC<{ tooltip: TooltipState | null }> = ({ title={`Not exposed: ${point.value.totalNo ?? 0}`} color={'error'} /> - ({ margin: theme.spacing(1.5, 0) })} - /> - + ({ + margin: theme.spacing(1.5, 0), + })} + /> + + + } /> )) || null}