From c2015c6f336ea84a4ee0139fea7206925c53bf1a Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Mon, 18 Mar 2024 15:25:03 +0100 Subject: [PATCH] fix: invalid HTML and react errors in insights pages (#6593) This PR fixes these errors (that were showing up in the dev console) in the insights pages: - nesting a div within a p in the count header (flags, environments, apps); instead flip the relationship and nest the p within the div - missing keys in mapped components - passing a boolean "scrolled" value to the underlying component (a div) is invalid: instead, make it so that that prop is not passed The only one of these that could have a visual impact is the first one (p>div -> div>p), but it appears to be the same to me. Here's before the change: ![image](https://github.com/Unleash/unleash/assets/17786332/ffffd3cc-1236-458f-8449-3310b0044f14) And here's after: ![image](https://github.com/Unleash/unleash/assets/17786332/9ad2d8f7-9f9e-492f-932e-a194683b1d75) --- .../executiveDashboard/ExecutiveDashboard.tsx | 20 ++++++------ .../MetricsChartTooltip.tsx | 32 +++++++++---------- .../UpdatesPerEnvironmentTypeChartTooltip.tsx | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx b/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx index 89c0664bd5..b8f0c9e30c 100644 --- a/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx +++ b/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx @@ -49,16 +49,16 @@ const ChartWidget = styled(Widget)(({ theme }) => ({ }, })); -const StickyWrapper = styled(Box)<{ scrolled?: boolean }>( - ({ theme, scrolled }) => ({ - position: 'sticky', - top: 0, - zIndex: 1000, - padding: scrolled ? theme.spacing(2, 0) : theme.spacing(0, 0, 2), - background: theme.palette.background.application, - transition: 'padding 0.3s ease', - }), -); +const StickyWrapper = styled(Box, { + shouldForwardProp: (prop) => prop !== 'scrolled', +})<{ scrolled?: boolean }>(({ theme, scrolled }) => ({ + position: 'sticky', + top: 0, + zIndex: 1000, + padding: scrolled ? theme.spacing(2, 0) : theme.spacing(0, 0, 2), + background: theme.palette.background.application, + transition: 'padding 0.3s ease', +})); export const ExecutiveDashboard: VFC = () => { const [scrolled, setScrolled] = useState(false); diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx b/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx index 5d3e4fae97..316eab6c0a 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx +++ b/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx @@ -36,24 +36,24 @@ const InfoLine = ({ ); const InfoSummary = ({ data }: { data: { key: string; value: number }[] }) => ( - - - {data.map(({ key, value }) => ( -
-
+ + {data.map(({ key, value }) => ( +
+
+ {key} -
-
{value}
+
- ))} -
- +
{value}
+
+ ))} + ); export const MetricsSummaryTooltip: VFC<{ tooltip: TooltipState | null }> = ({ diff --git a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx b/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx index 8c6c9406cb..8f5c9337f0 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx +++ b/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx @@ -39,7 +39,7 @@ const InfoSummary = ({ data }: { data: { key: string; value: number }[] }) => ( {data.map(({ key, value }) => ( -
+