From 30d5ab0dadea5810794005655f942eb1e858039c Mon Sep 17 00:00:00 2001 From: Rodrigo Alves da Silva Matos Date: Thu, 13 Aug 2026 18:13:32 -0300 Subject: [PATCH] fix(platform): format org timeline tooltip values as percentages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tooltip formatter matched on the series' `name` argument against dataKey strings ("commits", "stabilization", "aiPctNorm"), but each Line/Bar sets an explicit `name` prop (the translated label, e.g. "Estabilização") — Recharts passes that prop value as `name`, not the dataKey, so the match always missed and fell through to the raw, unrounded 0..1 decimal (e.g. "0.5860367647058823" instead of "59%"). Match on the payload entry's `dataKey` instead, which Recharts always populates regardless of the `name` prop override. Co-Authored-By: Claude Sonnet 5 --- .../app/[tenant]/dashboard/sections/OrgTimeline.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/src/app/[tenant]/dashboard/sections/OrgTimeline.tsx b/platform/src/app/[tenant]/dashboard/sections/OrgTimeline.tsx index bdebf49..23cdefc 100644 --- a/platform/src/app/[tenant]/dashboard/sections/OrgTimeline.tsx +++ b/platform/src/app/[tenant]/dashboard/sections/OrgTimeline.tsx @@ -95,16 +95,21 @@ export function OrgTimeline({ data }: OrgTimelineProps) { labelStyle={{ color: "var(--color-foreground)" }} itemStyle={{ color: "var(--color-muted-foreground)" }} labelFormatter={(label) => formatDate(String(label))} - formatter={(value, name) => { + formatter={(value, name, entry) => { + // Recharts passes each series' `name` PROP here (already the + // translated label, e.g. "Estabilização"), not its dataKey — + // matching against the dataKey strings below always missed, + // silently falling through to the raw untruncated decimal. const v = Number(value); - if (name === "commits") + const dataKey = entry?.dataKey; + if (dataKey === "commits") return [v.toFixed(0), t("dashboard.orgTimeline.commits")]; - if (name === "stabilization") + if (dataKey === "stabilization") return [ `${(v * 100).toFixed(0)}%`, t("dashboard.orgTimeline.stabilization"), ]; - if (name === "aiPctNorm") + if (dataKey === "aiPctNorm") return [ `${(v * 100).toFixed(0)}%`, t("dashboard.orgTimeline.aiAdoption"),