Skip to content

Show Smart Limit card option disabled when approvals are optional#96567

Draft
MelvinBot wants to merge 3 commits into
mainfrom
claude-smartLimitDisabledOption
Draft

Show Smart Limit card option disabled when approvals are optional#96567
MelvinBot wants to merge 3 commits into
mainfrom
claude-smartLimitDisabledOption

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The Smart Limit limit type was completely hidden from the Expensify Card limit type selector whenever the workspace's approval workflow was Optional. Both the edit-existing-card flow (DynamicExpensifyCardLimitTypePage) and the issue-new-card flow (LimitTypeStep) only pushed the Smart Limit option into the list when areApprovalsConfigured was true, so admins on Optional-approvals workspaces never saw it and had no indication of how to enable it.

Per the approved proposal, instead of hiding the option we now always display Smart Limit and keep it disabled when the workspace uses Optional approvals, with a description explaining that an approval workflow must be enabled to use it.

Changes:

  • DynamicExpensifyCardLimitTypePage.tsx and issueNew/LimitTypeStep.tsx: always add the Smart Limit option; set isDisabled: !areApprovalsConfigured and swap the description to an explanatory string when approvals aren't configured.
  • ValueSelectionList.tsx: forward the isDisabled flag through the item mapping (it was previously dropped), so SelectionList renders the row as a non-pressable, greyed option.
  • ValuePicker/types.ts: add optional isDisabled to ValuePickerItem.
  • en.ts: add smartLimitDisabledDescription. Translations for other locales are generated automatically by the Polyglot Parrot workflow.

Since getDefaultExpensifyCardLimitType returns MONTHLY (not SMART) when approvals are Optional, the disabled option is never pre-selected.

Fixed Issues

$ #94072
PROPOSAL: #94072 (comment)

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • 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 followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team July 21, 2026 04:34
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-smartLimitDisabledOption
git checkout -b claude-smartLimitDisabledOption upstream/claude-smartLimitDisabledOption
git push -u origin claude-smartLimitDisabledOption

Then you can push follow-up commits from your fork.

Note: Translations for locales other than English will be added automatically by the Polyglot Parrot workflow (it runs because src/languages/en.ts changed). I intentionally only edited en.ts.

@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 38a5c417ff7..c762b57ea87 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -6657,6 +6657,7 @@ Der Control-Tarif beginnt bei 9 $ pro aktivem Mitglied und Monat.`,
                 createNew: 'Neu erstellen',
                 spendRulesEmptyStateTitle: 'Keine Regeln zur Auswahl',
                 spendRulesEmptyStateSubtitle: 'Noch keine Regeln. Sie können eine auf dem vorherigen Bildschirm erstellen.',
+                smartLimitDisabledDescription: 'Aktivieren Sie einen Genehmigungsworkflow für diesen Workspace, um Smart Limit zu verwenden',
             },
             deactivateCardModal: {
                 deactivate: 'Deaktivieren',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 2e2751fa125..cb8d2004ece 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -6781,6 +6781,7 @@ El plan Controlar empieza en 9 $ por miembro activo al mes.`,
                 createNew: 'Crear nuevo',
                 spendRulesEmptyStateTitle: 'No hay reglas para elegir',
                 spendRulesEmptyStateSubtitle: 'Todavía no hay reglas. Puedes crear una desde la pantalla anterior.',
+                smartLimitDisabledDescription: 'Habilita un flujo de aprobación para este espacio de trabajo para usar Smart Limit',
             },
             deactivateCardModal: {
                 deactivate: 'Desactivar',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c629abc9b71..88b9b5d70dc 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -6684,6 +6684,7 @@ Le forfait Control commence à 9 $ par Membre actif et par mois.`,
                 createNew: 'Créer nouveau',
                 spendRulesEmptyStateTitle: 'Aucune règle à sélectionner',
                 spendRulesEmptyStateSubtitle: 'Aucune règle pour le moment. Vous pouvez en créer une depuis l’écran précédent.',
+                smartLimitDisabledDescription: 'Activez un flux d’approbation pour cet espace de travail afin d’utiliser Smart Limit',
             },
             deactivateCardModal: {
                 deactivate: 'Désactiver',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 6d0e525d96f..f554ffe04cb 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -6642,6 +6642,7 @@ Il piano Control parte da 9 $ al mese per ogni membro attivo.`,
                 createNew: 'Crea nuovo',
                 spendRulesEmptyStateTitle: 'Nessuna regola tra cui scegliere',
                 spendRulesEmptyStateSubtitle: 'Ancuna nessuna regola. Puoi crearne una dalla schermata precedente.',
+                smartLimitDisabledDescription: 'Abilita un flusso di approvazione per questo spazio di lavoro per usare Smart Limit',
             },
             deactivateCardModal: {
                 deactivate: 'Disattiva',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index fa6dd6c61c4..c019fdc6da9 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -6561,6 +6561,7 @@ Control プランは、アクティブメンバー1人あたり月額 $9 から
                 createNew: '新規作成',
                 spendRulesEmptyStateTitle: '選択できるルールがありません',
                 spendRulesEmptyStateSubtitle: 'まだルールがありません。前の画面から作成できます。',
+                smartLimitDisabledDescription: 'このワークスペースで Smart Limit を利用するには、承認ワークフローを有効にしてください',
             },
             deactivateCardModal: {
                 deactivate: '無効化',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 48358b1a042..a5166513316 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -6625,6 +6625,7 @@ Het Control-abonnement begint bij $9 per actieve deelnemer per maand.`,
                 createNew: 'Nieuw maken',
                 spendRulesEmptyStateTitle: 'Geen regels om uit te kiezen',
                 spendRulesEmptyStateSubtitle: 'Nog geen regels. Je kunt er een aanmaken vanaf het vorige scherm.',
+                smartLimitDisabledDescription: 'Schakel een goedkeuringsworkflow in voor deze werkruimte om Smart Limit te gebruiken',
             },
             deactivateCardModal: {
                 deactivate: 'Deactiveren',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 15aeecbc355..59efcbc3905 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -6607,6 +6607,7 @@ Plan Control zaczyna się od 9 USD za aktywnego członka miesięcznie.`,
                 createNew: 'Utwórz nowy',
                 spendRulesEmptyStateTitle: 'Brak reguł do wyboru',
                 spendRulesEmptyStateSubtitle: 'Brak jeszcze żadnych reguł. Możesz utworzyć jedną na poprzednim ekranie.',
+                smartLimitDisabledDescription: 'Włącz proces zatwierdzania dla tego obszaru roboczego, aby używać Smart Limit',
             },
             deactivateCardModal: {
                 deactivate: 'Dezaktywuj',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index e4c7ecd38a2..7e2cf4c0b65 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -6618,6 +6618,7 @@ O plano Control começa em US$ 9 por membro ativo por mês.`,
                 createNew: 'Criar novo',
                 spendRulesEmptyStateTitle: 'Nenhuma regra para escolher',
                 spendRulesEmptyStateSubtitle: 'Ainda não há regras. Você pode criar uma a partir da tela anterior.',
+                smartLimitDisabledDescription: 'Ative um fluxo de aprovação para este workspace para usar o Smart Limit',
             },
             deactivateCardModal: {
                 deactivate: 'Desativar',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 99fdc6e7084..d700af06953 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -6424,6 +6424,7 @@ _如需更详细的说明,请[访问我们的帮助网站](${CONST.NETSUITE_IM
                 createNew: '新建',
                 spendRulesEmptyStateTitle: '没有可供选择的规则',
                 spendRulesEmptyStateSubtitle: '尚未创建规则。您可以在上一屏创建一个。',
+                smartLimitDisabledDescription: '为此工作区启用审批流程以使用智能额度',
             },
             deactivateCardModal: {
                 deactivate: '停用',

Note

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

View workflow run

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing Oxfmt check and pushed to the branch.

Cause: In src/components/ValuePicker/ValueSelectionList.tsx, adding isDisabled: item.isDisabled to the items.map(...) object literal pushed that line to 195 characters, over the repo's printWidth of 190. Oxfmt therefore wanted the object literal wrapped onto multiple lines.

Fix: Wrapped the object literal across multiple lines (one property per line with a trailing comma), matching what npm run fmt produces.

The only other failing check, checklist (PR Author Checklist), is the human checklist and isn't something I can act on.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The Oxfmt check is now passing after my fix in 3b847d8 (wrapped the over-190-char object literal in ValueSelectionList.tsx). ESLint and the other re-run checks are green or still in progress.

The only remaining failing check is checklist (PR Author Checklist), which is the human checklist — not something I can resolve. Please complete the checklist items in the PR description.

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the remaining failures (typecheck and test (job 6) / TranslateTest) and pushed.

Cause: The new key smartLimitDisabledDescription was added to en.ts only. TypeScript requires every locale to satisfy the same translation shape, and TranslateTest asserts each locale has all English keys — so both checks failed with the key missing from the 9 other locale files.

Fix: Added smartLimitDisabledDescription (with a translation using each locale's Smart Limit term) to de, es, fr, it, ja, nl, pl, pt-BR, and zh-hans.

This is on top of the earlier Oxfmt fix. The only remaining failure, checklist (PR Author Checklist), is the human checklist and isn't something I can act on.

@truph01

truph01 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 6efde33a2d

ℹ️ 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".

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.

3 participants