Repository navigation
[Insights] Add summaries to the headline charts - #107750
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Updated |
|
@truph01 @aldo-expensify this should be ready for review |
|
🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
…dline-summary # Conflicts: # src/pages/Insights/charts/InsightsChartWidget.tsx
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looking great! @dannymcclain please make sure you review for design. Then two additional comments from me:
|
|
@luacmartins Spend total doesn't match the chart On Insights > Spend (This month, Previous period, VND), the headline shows
|
This comment has been minimized.
This comment has been minimized.
|
Updated |
| @@ -106,7 +108,7 @@ function buildStackedSeries({ | |||
| dateFnsLocale, | |||
| }: BuildStackedSeriesParams): SearchChartModel { | |||
There was a problem hiding this comment.
❌ CONSISTENCY-18 (docs)
This line now prefers comparison[CONST.SEARCH.CHART_METRIC.DURATION] over the locally computed getStackedAverage(data, stages), but nothing explains why the backend-supplied duration should win. A future reader can't tell that this is the report-weighted range average (matching the headline summary) and that the bucket average is only a fallback for older cached responses. Add a short comment stating the reason, e.g.:
// Prefer the backend's report-weighted range average so the line matches the headline summary; older cached charts without it fall back to the bucket average.
const averageValue = isChartAverage(comparison) ? (comparison[CONST.SEARCH.CHART_METRIC.DURATION] ?? getStackedAverage(data, stages)) : undefined;Reviewed at: 76c8f3d | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
|
@luacmartins conflicts |
Keep tag-level loading and reusable chart averages while matching headline summaries to their snapshots. Use one request effect for dashboard changes and Search snapshot replacements.
Reuse the chart tooltip colors for headline comparisons. Explain why the report-weighted Efficiency average takes precedence over the bucket average.
This comment has been minimized.
This comment has been minimized.
|
@aldo-expensify resolved |
|
@luacmartins We have conflicts again |
|
Let's try to get this PR merged today. |
|
@truph01 the conflicts are only in a test file, I think you can still do your full review and leave that ready |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-12-01.at.23.44.06.movScreen.Recording.2026-12-01.at.23.44.25.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-12-01.at.23.37.48.mov |
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: View the translation diffdiff --git a/src/languages/de.ts b/src/languages/de.ts
index 3e36acfd..ad0f26c3 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -1269,13 +1269,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `Ø ${amount}`,
- flaggedExpenses: ({formattedCount}) => ({one: `Bei ${formattedCount} Ausgabe`, other: `Bei ${formattedCount} Ausgaben`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} Verstoß`, other: `${formattedCount} Verstöße`}),
- timeToSubmit: (time) => `${time} bis zur Einreichung`,
- timeToApprove: (time) => `${time} bis zur Genehmigung`,
- timeToPay: (time) => `${time} bis zur Zahlung`,
- vsPreviousPeriod: (change) => `${change} gegenüber dem vorherigen Zeitraum`,
+ averageExpense: (amount: string) => `${amount} Durchschnitt`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Auf ${formattedCount} Ausgabe`, other: `Auf ${formattedCount} Ausgaben`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} Verstoß`, other: `${formattedCount} Verstöße`}),
+ timeToSubmit: (time: string) => `${time} bis zur Einreichung`,
+ timeToApprove: (time: string) => `${time} bis zur Genehmigung`,
+ timeToPay: (time: string) => `${time} bis zur Zahlung`,
+ vsPreviousPeriod: (change: string) => `${change} vs vorheriger Zeitraum`,
},
tagLevel: (level: string) => `Tag-Stufe ${level}`,
noTaggedExpenses: 'Keine Ausgaben mit Tags',
diff --git a/src/languages/el.ts b/src/languages/el.ts
index fc095847..4ad3ed9d 100644
--- a/src/languages/el.ts
+++ b/src/languages/el.ts
@@ -1315,13 +1315,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `${amount} κατά μέσο όρο`,
- flaggedExpenses: ({formattedCount}) => ({one: `Σε ${formattedCount} έξοδο`, other: `Σε ${formattedCount} έξοδα`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} παράβαση`, other: `${formattedCount} παραβάσεις`}),
- timeToSubmit: (time) => `${time} μέχρι την υποβολή`,
- timeToApprove: (time) => `${time} μέχρι την έγκριση`,
- timeToPay: (time) => `${time} μέχρι την πληρωμή`,
- vsPreviousPeriod: (change) => `${change} σε σχέση με την προηγούμενη περίοδο`,
+ averageExpense: (amount: string) => `μέσος όρος ${amount}`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Σε ${formattedCount} δαπάνη`, other: `Σε ${formattedCount} δαπάνες`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} παράβαση`, other: `${formattedCount} παραβάσεις`}),
+ timeToSubmit: (time: string) => `${time} για αποστολή`,
+ timeToApprove: (time: string) => `${time} για έγκριση`,
+ timeToPay: (time: string) => `${time} μέχρι την πληρωμή`,
+ vsPreviousPeriod: (change: string) => `${change} έναντι προηγούμενης περιόδου`,
},
tagLevel: (level: string) => `Επίπεδο ετικέτας ${level}`,
noTaggedExpenses: 'Δεν υπάρχουν δαπάνες με ετικέτες',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index fd274722..cb1e52fc 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -1263,13 +1263,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `${amount} de media`,
- flaggedExpenses: ({formattedCount}) => ({one: `En ${formattedCount} gasto`, other: `En ${formattedCount} gastos`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} infracción`, other: `${formattedCount} infracciones`}),
- timeToSubmit: (time) => `${time} para enviar`,
- timeToApprove: (time) => `${time} para aprobar`,
- timeToPay: (time) => `${time} para pagar`,
- vsPreviousPeriod: (change) => `${change} respecto al periodo anterior`,
+ averageExpense: (amount: string) => `${amount} de media`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `En ${formattedCount} gasto`, other: `En ${formattedCount} gastos`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} infracción`, other: `${formattedCount} infracciones`}),
+ timeToSubmit: (time: string) => `${time} para enviar`,
+ timeToApprove: (time: string) => `${time} para aprobar`,
+ timeToPay: (time: string) => `${time} para pagar`,
+ vsPreviousPeriod: (change: string) => `${change} vs periodo anterior`,
},
tagLevel: (level: string) => `Nivel de etiqueta ${level}`,
noTaggedExpenses: 'No hay gastos con etiquetas',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 81f854c4..b9454c8d 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -1273,13 +1273,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `${amount} en moyenne`,
- flaggedExpenses: ({formattedCount}) => ({one: `Sur ${formattedCount} dépense`, other: `Sur ${formattedCount} dépenses`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} infraction`, other: `${formattedCount} infractions`}),
- timeToSubmit: (time) => `${time} pour soumettre`,
- timeToApprove: (time) => `${time} pour approuver`,
- timeToPay: (time) => `${time} pour payer`,
- vsPreviousPeriod: (change) => `${change} par rapport à la période précédente`,
+ averageExpense: (amount: string) => `${amount} en moyenne`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Sur ${formattedCount} dépense`, other: `Sur ${formattedCount} dépenses`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} infraction`, other: `${formattedCount} infractions`}),
+ timeToSubmit: (time: string) => `${time} pour soumettre`,
+ timeToApprove: (time: string) => `${time} pour approuver`,
+ timeToPay: (time: string) => `${time} pour payer`,
+ vsPreviousPeriod: (change: string) => `${change} vs période précédente`,
},
tagLevel: (level: string) => `Niveau de tag ${level}`,
noTaggedExpenses: 'Aucune dépense avec un tag',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 5a5ade2a..151decad 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -1272,13 +1272,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `${amount} in media`,
- flaggedExpenses: ({formattedCount}) => ({one: `Su ${formattedCount} spesa`, other: `Su ${formattedCount} spese`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} violazione`, other: `${formattedCount} violazioni`}),
- timeToSubmit: (time) => `${time} per inviare`,
- timeToApprove: (time) => `${time} per approvare`,
- timeToPay: (time) => `${time} per pagare`,
- vsPreviousPeriod: (change) => `${change} rispetto al periodo precedente`,
+ averageExpense: (amount: string) => `${amount} in media`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Su ${formattedCount} spesa`, other: `Su ${formattedCount} spese`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} violazione`, other: `${formattedCount} violazioni`}),
+ timeToSubmit: (time: string) => `${time} per inviare`,
+ timeToApprove: (time: string) => `${time} per approvare`,
+ timeToPay: (time: string) => `${time} per pagare`,
+ vsPreviousPeriod: (change: string) => `${change} rispetto al periodo precedente`,
},
tagLevel: (level: string) => `Livello tag ${level}`,
noTaggedExpenses: 'Nessuna spesa con tag',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 784a6ed3..9e29ee05 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -1257,13 +1257,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `平均${amount}`,
- flaggedExpenses: ({formattedCount}) => ({one: `${formattedCount}件の経費`, other: `${formattedCount}件の経費`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount}件の違反事項`, other: `${formattedCount}件の違反事項`}),
- timeToSubmit: (time) => `提出まで${time}`,
- timeToApprove: (time) => `承認まで${time}`,
- timeToPay: (time) => `支払いまで${time}`,
- vsPreviousPeriod: (change) => `前期間比 ${change}`,
+ averageExpense: (amount: string) => `平均 ${amount}`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount}件の経費で`, other: `${formattedCount}件の経費で`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} 件の違反`, other: `${formattedCount} 件の違反`}),
+ timeToSubmit: (time: string) => `提出まであと ${time}`,
+ timeToApprove: (time: string) => `承認まで${time}`,
+ timeToPay: (time: string) => `支払期日 ${time}`,
+ vsPreviousPeriod: (change: string) => `前期比 ${change}`,
},
tagLevel: (level: string) => `タグレベル ${level}`,
noTaggedExpenses: 'タグが付いた経費がありません',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index d09b9a17..0aad5c01 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -1268,13 +1268,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `Gemiddeld ${amount}`,
- flaggedExpenses: ({formattedCount}) => ({one: `Bij ${formattedCount} uitgave`, other: `Bij ${formattedCount} uitgaven`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} overtreding`, other: `${formattedCount} overtredingen`}),
- timeToSubmit: (time) => `${time} tot indiening`,
- timeToApprove: (time) => `${time} tot goedkeuring`,
- timeToPay: (time) => `${time} tot betaling`,
- vsPreviousPeriod: (change) => `${change} ten opzichte van de vorige periode`,
+ averageExpense: (amount: string) => `${amount} gemiddeld`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Op ${formattedCount} uitgave`, other: `Op ${formattedCount} uitgaven`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} overtreding`, other: `${formattedCount} overtredingen`}),
+ timeToSubmit: (time: string) => `${time} om in te dienen`,
+ timeToApprove: (time: string) => `${time} om goed te keuren`,
+ timeToPay: (time: string) => `${time} om te betalen`,
+ vsPreviousPeriod: (change: string) => `${change} t.o.v. vorige periode`,
},
tagLevel: (level: string) => `Tagniveau ${level}`,
noTaggedExpenses: 'Geen uitgaven met tags',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 466b0533..edea33b8 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -1300,23 +1300,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `Średnio ${amount}`,
- flaggedExpenses: ({formattedCount}) => ({
- one: `W ${formattedCount} wydatku`,
- few: `W ${formattedCount} wydatkach`,
- many: `W ${formattedCount} wydatkach`,
- other: `W ${formattedCount} wydatku`,
- }),
- violationCount: ({formattedCount}) => ({
- one: `${formattedCount} naruszenie`,
- few: `${formattedCount} naruszenia`,
- many: `${formattedCount} naruszeń`,
- other: `${formattedCount} naruszenia`,
- }),
- timeToSubmit: (time) => `${time} do przesłania`,
- timeToApprove: (time) => `${time} do zatwierdzenia`,
- timeToPay: (time) => `${time} do zapłaty`,
- vsPreviousPeriod: (change) => `${change} względem poprzedniego okresu`,
+ averageExpense: (amount: string) => `średnio ${amount}`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Na ${formattedCount} wydatku`, other: `Na ${formattedCount} wydatkach`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} naruszenie`, other: `${formattedCount} naruszenia`}),
+ timeToSubmit: (time: string) => `${time} na przesłanie`,
+ timeToApprove: (time: string) => `${time} do zatwierdzenia`,
+ timeToPay: (time: string) => `${time} do zapłaty`,
+ vsPreviousPeriod: (change: string) => `${change} vs poprzedni okres`,
},
tagLevel: (level: string) => `Poziom tagu ${level}`,
noTaggedExpenses: 'Brak wydatków z tagami',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 7983a9f5..649e14ba 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -1271,13 +1271,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `Média de ${amount}`,
- flaggedExpenses: ({formattedCount}) => ({one: `Em ${formattedCount} despesa`, other: `Em ${formattedCount} despesas`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} violação`, other: `${formattedCount} violações`}),
- timeToSubmit: (time) => `${time} para enviar`,
- timeToApprove: (time) => `${time} para aprovar`,
- timeToPay: (time) => `${time} para pagar`,
- vsPreviousPeriod: (change) => `${change} em relação ao período anterior`,
+ averageExpense: (amount: string) => `${amount} em média`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `Em ${formattedCount} despesa`, other: `Em ${formattedCount} despesas`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} violação`, other: `${formattedCount} violações`}),
+ timeToSubmit: (time: string) => `${time} para enviar`,
+ timeToApprove: (time: string) => `${time} para aprovar`,
+ timeToPay: (time: string) => `${time} para pagar`,
+ vsPreviousPeriod: (change: string) => `${change} vs período anterior`,
},
tagLevel: (level: string) => `Nível de tag ${level}`,
noTaggedExpenses: 'Nenhuma despesa com tags',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 4d472487..1ecb7e1f 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -1227,13 +1227,13 @@ const translations: TranslationDeepObject<typeof en> = {
},
insightsPage: {
headline: {
- averageExpense: (amount) => `平均 ${amount}`,
- flaggedExpenses: ({formattedCount}) => ({one: `涉及 ${formattedCount} 笔费用`, other: `涉及 ${formattedCount} 笔费用`}),
- violationCount: ({formattedCount}) => ({one: `${formattedCount} 项违规`, other: `${formattedCount} 项违规`}),
- timeToSubmit: (time) => `提交用时 ${time}`,
- timeToApprove: (time) => `审批用时 ${time}`,
- timeToPay: (time) => `付款用时 ${time}`,
- vsPreviousPeriod: (change) => `较上一周期 ${change}`,
+ averageExpense: (amount: string) => `平均 ${amount}`,
+ flaggedExpenses: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `在 ${formattedCount} 笔报销上`, other: `在 ${formattedCount} 笔报销中`}),
+ violationCount: ({formattedCount}: {count: number; formattedCount: string}) => ({one: `${formattedCount} 次违规`, other: `${formattedCount} 条违规记录`}),
+ timeToSubmit: (time: string) => `剩余 ${time} 可提交`,
+ timeToApprove: (time: string) => `${time} 内完成审批`,
+ timeToPay: (time: string) => `${time} 去支付`,
+ vsPreviousPeriod: (change: string) => `${change} 与上一期间对比`,
},
tagLevel: (level: string) => `标签级别 ${level}`,
noTaggedExpenses: '没有带标签的费用',
Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
|
@aldo-expensify all yours |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 aldo-expensify has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 9.5.57-0 🚀
|
|
No help site update needed — the changes add summary figures to existing Insights charts without changing a documented workflow or making an existing article sentence incorrect. |


Explanation of Change
Add summaries to the Spend, Compliance, and Efficiency headline charts. They use range totals from Auth #27101 and compare the same number of days when the current range is still in progress. The Efficiency headline and chart pill use the same report-weighted average. Older cached charts still render without a summary.
Large VND totals can still be truncated in the Spend chart. The separate Auth fix has not shipped yet.
Fixed Issues
$ #107477
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari