From 1afddc71ee0de4a6a950ec1f26d3509227ac536c Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Thu, 26 Nov 2026 15:46:33 +0100 Subject: [PATCH] [Insights polish] Use success-text and danger-text colors for comparison labels --- .../Charts/components/ChartTooltipComparison.tsx | 8 ++++---- src/pages/Insights/charts/InsightsDataTable.tsx | 5 ++--- src/pages/Insights/details/InsightsSummary.tsx | 5 ++--- src/styles/utils/index.ts | 7 +++++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/Charts/components/ChartTooltipComparison.tsx b/src/components/Charts/components/ChartTooltipComparison.tsx index 45b714503010..916b2f093f68 100644 --- a/src/components/Charts/components/ChartTooltipComparison.tsx +++ b/src/components/Charts/components/ChartTooltipComparison.tsx @@ -27,7 +27,7 @@ function ChartTooltipComparison({rows, change}: ChartTooltipComparisonProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const icons = useMemoizedLazyExpensifyIcons(['ArrowUpLong', 'ArrowDownLong']); - const changeColor = StyleUtils.getSpendChangeColor(!!change?.isIncrease); + const isIncrease = !!change?.isIncrease; return ( <> @@ -40,12 +40,12 @@ function ChartTooltipComparison({rows, change}: ChartTooltipComparisonProps) { {!!change && ( - {formatTooltipValue(change)} + {formatTooltipValue(change)} )} diff --git a/src/pages/Insights/charts/InsightsDataTable.tsx b/src/pages/Insights/charts/InsightsDataTable.tsx index d06491171905..2e23f81a65af 100644 --- a/src/pages/Insights/charts/InsightsDataTable.tsx +++ b/src/pages/Insights/charts/InsightsDataTable.tsx @@ -96,7 +96,6 @@ function InsightsDataTable({rows, formatValue, isLoading, skeletonRowCount = SKE const changePercentage = hasChange ? formatChangePercentage(primaryValue, comparedValue, preferredLocale) : undefined; const isIncrease = hasChange && primaryValue > comparedValue; const isNewSpend = comparedValue === 0; - const changeColor = StyleUtils.getSpendChangeColor(isIncrease); const isLevelTag = item.groupedBy === CONST.SEARCH.GROUP_BY.TAG && item.tagLevel !== undefined; const parentLabel = isLevelTag ? formatTagParentPath(item.parentTagPath) : ''; @@ -144,11 +143,11 @@ function InsightsDataTable({rows, formatValue, isLoading, skeletonRowCount = SKE > - {changePercentage} + {changePercentage} )} diff --git a/src/pages/Insights/details/InsightsSummary.tsx b/src/pages/Insights/details/InsightsSummary.tsx index ec552a9c4b31..f8d2dc628b0b 100644 --- a/src/pages/Insights/details/InsightsSummary.tsx +++ b/src/pages/Insights/details/InsightsSummary.tsx @@ -159,7 +159,6 @@ function SummaryAverageComparison({comparison, graphKey, periodGroupBy, currency } const isIncrease = comparison.difference > 0; - const changeColor = StyleUtils.getSpendChangeColor(isIncrease); const percentage = formatPercentOfTotal(comparison.percentage, comparison.difference, preferredLocale); const amount = convertToDisplayString(Math.abs(comparison.difference), currency); @@ -169,13 +168,13 @@ function SummaryAverageComparison({comparison, graphKey, periodGroupBy, currency {getVersusAverageLabel(amount)} diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index bb8369ede6e3..9d5be3568b12 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -2138,8 +2138,11 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ */ getMentionTextColor: (isOurMention: boolean): string => (isOurMention ? theme.ourMentionText : theme.mentionText), - /** Returns the color of a change in spend, red when it went up and green when it went down */ - getSpendChangeColor: (isIncrease: boolean): string => (isIncrease ? theme.danger : theme.successHover), + /** Returns the arrow color of a change in spend, red when it went up and green when it went down */ + getSpendChangeIconColor: (isIncrease: boolean): string => (isIncrease ? theme.danger : theme.success), + + /** Returns the text color of a change in spend, red when it went up and green when it went down */ + getSpendChangeTextColor: (isIncrease: boolean): string => (isIncrease ? theme.textError : theme.textSuccess), /** * Generate the wrapper styles for the mini ReportActionContextMenu.