From 772ec56d3d0b8560eefc4e2a2d44baf700691d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Obermu=CC=88ller?= Date: Mon, 13 Nov 2023 17:49:33 +0100 Subject: [PATCH] cleanup --- .../nodes/InsightViz/InsightDisplayConfig.tsx | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx index dbf4d665f98ff..07e9d8b7e701a 100644 --- a/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx +++ b/frontend/src/queries/nodes/InsightViz/InsightDisplayConfig.tsx @@ -51,11 +51,7 @@ export function InsightDisplayConfig(): JSX.Element { funnelDataLogic(insightProps) ) - const showDateRange = !isRetention - const disableDateRange = isFunnels && !!isEmptyFunnel const showCompare = (isTrends && display !== ChartDisplayType.ActionsAreaGraph) || isStickiness - const showUnit = isTrends - const showChart = supportsDisplay const showInterval = isTrendsFunnel || isLifecycle || @@ -66,15 +62,8 @@ export function InsightDisplayConfig(): JSX.Element { !trendsFilter?.compare && (!display || display === ChartDisplayType.ActionsLineGraph) && featureFlags[FEATURE_FLAGS.SMOOTHING_INTERVAL] - const showRetention = !!isRetention - const showPaths = !!isPaths - const showFunnelDisplayLayout = !!isStepsFunnel - const showFunnelBins = !!isTimeToConvertFunnel - const showValueOnSeries = supportsValueOnSeries - const { showPercentStackView: isPercentStackViewOn, showValueOnSeries: isValueOnSeriesOn } = useValues( - trendsDataLogic(insightProps) - ) + const { showPercentStackView: isPercentStackViewOn, showValueOnSeries } = useValues(trendsDataLogic(insightProps)) const advancedOptions: LemonMenuItems = [ ...(supportsValueOnSeries || showPercentStackView || hasLegend @@ -82,14 +71,14 @@ export function InsightDisplayConfig(): JSX.Element { { title: 'Display', items: [ - ...(showValueOnSeries ? [{ label: () => }] : []), + ...(supportsValueOnSeries ? [{ label: () => }] : []), ...(showPercentStackView ? [{ label: () => }] : []), ...(hasLegend ? [{ label: () => }] : []), ], }, ] : []), - ...(!isPercentStackViewOn && showUnit + ...(!isPercentStackViewOn && isTrends ? [ { title: axisLabel(display || ChartDisplayType.ActionsLineGraph), @@ -99,10 +88,10 @@ export function InsightDisplayConfig(): JSX.Element { : []), ] const advancedOptionsCount: number = - (showValueOnSeries && isValueOnSeriesOn ? 1 : 0) + + (supportsValueOnSeries && showValueOnSeries ? 1 : 0) + (showPercentStackView && isPercentStackViewOn ? 1 : 0) + (!isPercentStackViewOn && - showUnit && + isTrends && trendsFilter?.aggregation_axis_format && trendsFilter.aggregation_axis_format !== 'numeric' ? 1 @@ -112,9 +101,9 @@ export function InsightDisplayConfig(): JSX.Element { return (
- {showDateRange && ( + {!isRetention && ( - + )} @@ -130,14 +119,14 @@ export function InsightDisplayConfig(): JSX.Element { )} - {showRetention && ( + {!!isRetention && ( )} - {showPaths && ( + {!!isPaths && ( @@ -159,17 +148,17 @@ export function InsightDisplayConfig(): JSX.Element { )} - {showChart && ( + {supportsDisplay && ( )} - {showFunnelDisplayLayout && ( + {!!isStepsFunnel && ( )} - {showFunnelBins && ( + {!!isTimeToConvertFunnel && (