Skip to content

Update the policy distance rates table to the new style - #93872

Merged
JS00001 merged 8 commits into
mainfrom
cmartins-distanceTable
Jun 22, 2026
Merged

JS00001 merged 8 commits into
mainfrom
cmartins-distanceTable

Conversation

@luacmartins

@luacmartins luacmartins commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Migrate the policy distance rates page to the shared Table component and add an empty state.

Fixed Issues

$ #86210

Tests

  1. Open a workspace Distance rates page with rates
  2. Confirm status, name, rate, enabled switch, and date columns (when applicable) render
  3. Tap a row → rate details opens
  4. Confirm Add rate, Settings, and bulk actions still work
  5. With 12+ rates, confirm search and sorting work
  6. Open a workspace with no rates → empty state with Add rate button renders
  • Verify that no errors appear in the JS console
Screenshot 2026-06-17 at 3 59 28 PM Screenshot 2026-06-17 at 3 59 38 PM

Offline tests

N/A

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

@luacmartins luacmartins self-assigned this Jun 17, 2026
@luacmartins luacmartins changed the title Cmartins distance table Update the policy distance rates table to the new style Jun 17, 2026
@OSBotify

This comment has been minimized.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...tanceRatesTable/WorkspaceDistanceRatesTableRow.tsx 0.00% <0.00%> (ø)
...nents/Tables/WorkspaceDistanceRatesTable/index.tsx 0.00% <0.00%> (ø)
...orkspace/distanceRates/PolicyDistanceRatesPage.tsx 0.00% <0.00%> (ø)
... and 10 files with indirect coverage changes

@luacmartins
luacmartins marked this pull request as ready for review June 17, 2026 22:14
@luacmartins
luacmartins requested review from a team as code owners June 17, 2026 22:14
@melvin-bot
melvin-bot Bot requested review from a team, JmillsExpensify, Krishna2323 and situchan and removed request for a team June 17, 2026 22:14
@melvin-bot

melvin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

@Krishna2323 @situchan One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from JS00001 and removed request for a team June 17, 2026 22:14
@melvin-bot

melvin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

@JS00001 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b30d9db0d8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx Outdated
Comment thread src/components/Tables/WorkspaceDistanceRatesTable/index.tsx Outdated

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ck API

Align WorkspaceDistanceRatesTableRow with the shared Table offlineWithFeedback
pattern and add EmptyStateComponent support so the table can render an empty
state while staying mounted.
Show a GenericEmptyStateComponent with an add-rate action when a workspace has
no distance rates, and add emptyRates copy across all supported languages.
@OSBotify

Copy link
Copy Markdown
Contributor

🦜 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 diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 5d27e86e23f..9447cafceb1 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -6746,7 +6746,7 @@ _Für ausführlichere Anweisungen [besuchen Sie unsere Hilfeseite](${CONST.NETSU
             workspaceNeeds: 'Ein Arbeitsbereich benötigt mindestens einen aktivierten Entfernungssatz.',
             distance: 'Entfernung',
             centrallyManage: 'Tarife zentral verwalten, in Meilen oder Kilometern nachverfolgen und eine Standardkategorie festlegen.',
-            emptyRates: {title: 'Noch keine Entfernungssätze', subtitle: 'Fügen Sie einen Satz hinzu, um Kilometer mit benutzerdefinierten Sätzen zu erstatten.'},
+            emptyRates: {title: 'Noch keine Entfernungssätze', subtitle: 'Fügen Sie einen Satz hinzu, um Kilometer mit individuellen Sätzen zu erstatten.'},
             rate: 'Bewerten',
             addRate: 'Satz hinzufügen',
             findRate: 'Kurs finden',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 2c7378e2264..78e439e445c 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -6772,7 +6772,7 @@ _Pour des instructions plus détaillées, [visitez notre site d’aide](${CONST.
             workspaceNeeds: 'Un espace de travail doit avoir au moins un taux de distance activé.',
             distance: 'Distance',
             centrallyManage: 'Gérez les taux de manière centralisée, suivez en miles ou en kilomètres et définissez une catégorie par défaut.',
-            emptyRates: {title: 'Aucun taux de distance pour le moment', subtitle: 'Ajoutez un taux pour rembourser le kilométrage à des taux personnalisés.'},
+            emptyRates: {title: 'Aucun taux de distance pour l’instant', subtitle: 'Ajoutez un taux pour rembourser le kilométrage à des taux personnalisés.'},
             rate: 'Taux',
             addRate: 'Ajouter un taux',
             findRate: 'Trouver le taux',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 5da77853984..63cd5ffaa2f 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -6732,7 +6732,7 @@ _Per istruzioni più dettagliate, [visita il nostro sito di assistenza](${CONST.
             workspaceNeeds: 'Uno spazio di lavoro necessita di almeno una tariffa distanza abilitata.',
             distance: 'Distanza',
             centrallyManage: 'Gestisci centralmente le tariffe, monitora in miglia o chilometri e imposta una categoria predefinita.',
-            emptyRates: {title: 'Nessuna tariffa distanza ancora', subtitle: 'Aggiungi una tariffa per rimborsare il chilometraggio con tariffe personalizzate.'},
+            emptyRates: {title: 'Ancuna nessuna tariffa distanza', subtitle: 'Aggiungi una tariffa per rimborsare il chilometraggio a tariffe personalizzate.'},
             rate: 'Valuta',
             addRate: 'Aggiungi tariffa',
             findRate: 'Trova tariffa',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index dbaae47dc77..2505a040162 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -6711,7 +6711,7 @@ _Voor meer gedetailleerde instructies, [bezoek onze help-site](${CONST.NETSUITE_
             workspaceNeeds: 'Een workspace heeft minstens één ingeschakelde afstandstarief nodig.',
             distance: 'Afstand',
             centrallyManage: 'Beheer tarieven centraal, volg in mijlen of kilometers en stel een standaardcategorie in.',
-            emptyRates: {title: 'Nog geen kilometertarieven', subtitle: 'Voeg een tarief toe om kilometers tegen aangepaste tarieven te vergoeden.'},
+            emptyRates: {title: 'Nog geen afstandstarieven', subtitle: 'Voeg een tarief toe om kilometers tegen aangepaste tarieven te vergoeden.'},
             rate: 'Beoordeling',
             addRate: 'Tarief toevoegen',
             findRate: 'Tarief zoeken',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index dbf9c2cf587..a70d665e84a 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -6705,7 +6705,7 @@ _Aby uzyskać bardziej szczegółowe instrukcje, [odwiedź naszą stronę pomocy
             workspaceNeeds: 'Miejsce pracy musi mieć włączoną co najmniej jedną stawkę za dystans.',
             distance: 'Dystans',
             centrallyManage: 'Centralnie zarządzaj stawkami, śledź w milach lub kilometrach i ustaw domyślną kategorię.',
-            emptyRates: {title: 'Brak stawek za dystans', subtitle: 'Dodaj stawkę, żeby rozliczać kilometry według własnych stawek.'},
+            emptyRates: {title: 'Brak stawek za dystans', subtitle: 'Dodaj stawkę do zwrotu kosztów przejechanych kilometrów według niestandardowych stawek.'},
             rate: 'Oceń',
             addRate: 'Dodaj stawkę',
             findRate: 'Znajdź kurs',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index e55a98485d2..2d3b3b998d3 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -6706,7 +6706,7 @@ _Para instruções mais detalhadas, [visite nossa central de ajuda](${CONST.NETS
             workspaceNeeds: 'Um workspace precisa de pelo menos uma taxa de distância ativada.',
             distance: 'Distância',
             centrallyManage: 'Gerencie tarifas centralmente, acompanhe em milhas ou quilômetros e defina uma categoria padrão.',
-            emptyRates: {title: 'Ainda não há tarifas de distância', subtitle: 'Adicione uma taxa para reembolsar a quilometragem com valores personalizados.'},
+            emptyRates: {title: 'Ainda não há tarifas de distância', subtitle: 'Adicione uma tarifa para reembolsar quilometragem com taxas personalizadas.'},
             rate: 'Avaliar',
             addRate: 'Adicionar tarifa',
             findRate: 'Encontrar tarifa',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 41bd235140c..476838e82d1 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -6538,7 +6538,7 @@ _如需更详细的说明,请[访问我们的帮助网站](${CONST.NETSUITE_IM
             workspaceNeeds: '一个工作区至少需要一个已启用的距离费率。',
             distance: '距离',
             centrallyManage: '集中管理费率,以英里或公里跟踪,并设置默认类别。',
-            emptyRates: {title: '尚未设置距离费率', subtitle: '添加一个费率,以按自定义费率报销里程。'},
+            emptyRates: {title: '尚未设置里程费率', subtitle: '添加里程报销费率,以自定义报销标准。'},
             rate: '评分',
             addRate: '添加费率',
             findRate: '查找费率',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@luacmartins
luacmartins requested a review from JS00001 June 18, 2026 19:25
@luacmartins

Copy link
Copy Markdown
Contributor Author

Updated

@JS00001

JS00001 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@Krishna2323 back to you

@Krishna2323

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp android_hybrid
Android: mWeb Chrome android_mWeb
iOS: HybridApp ios_hybrid
iOS: mWeb Safari ios_mWeb
MacOS: Chrome / Safari web_chrome

@Krishna2323 Krishna2323 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty state is unlikely to appear in normal user flows — workspaces always get a default distance rate, and the UI prevents deleting the last enabled rate. I couldn’t reproduce it without local code changes, but the implementation looks fine for the edge case.

@melvin-bot
melvin-bot Bot requested a review from mjasikowski June 22, 2026 12:26
@melvin-bot

melvin-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@JS00001
JS00001 merged commit 9efc894 into main Jun 22, 2026
40 of 41 checks passed
@JS00001
JS00001 deleted the cmartins-distanceTable branch June 22, 2026 13:06
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @JS00001 has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.4.17-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed the changes in this PR against the help site files under docs/articles.

No help site changes are required.

This PR is a visual/structural refactor — it migrates the Distance rates page to the shared Table component and adds an empty state. It does not change any documented workflow, feature name, setting, tab, or button:

  • The only new user-facing copy is the empty-state message ("No distance rates yet" / "Add a rate to reimburse mileage at custom rates."), which is shown only when a workspace has zero rates. Help articles don't document empty states.
  • All documented procedures in Set-distance-rates.md — enabling distance rates, adding/editing/deleting a rate, and bulk actions — remain accurate. The Add rate, Settings, and bulk-action flows are unchanged.

Since nothing in the documented behavior changed, I did not create a draft PR.

@luacmartins, if you'd like the empty state (or anything else here) reflected in the help site anyway, reply with @MelvinBot create the docs PR and I'll draft it.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

1 similar comment
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants