From dd9bca3c7ef3ad2e51d8e02e961089c899506903 Mon Sep 17 00:00:00 2001 From: Rutika Pawar Date: Wed, 13 Nov 2024 12:00:09 +0000 Subject: [PATCH 1/4] Enable/disable option shows rates text in plural instead rate --- src/languages/en.ts | 12 +++++++++--- src/languages/es.ts | 12 +++++++++--- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 9 ++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index fa78b563c522..7975274ed697 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3569,10 +3569,16 @@ const translations = { actions: { delete: 'Delete rate', deleteMultiple: 'Delete rates', - disable: 'Disable rate', - disableMultiple: 'Disable rates', enable: 'Enable rate', - enableMultiple: 'Enable rates', + disable: 'Disable rate', + enableTaxTitle: () => ({ + one: 'enable rate', + other: 'enable rates', + }), + disableTaxTitle: () => ({ + one: 'Disable rate', + other: 'Disable rates', + }), }, importedFromAccountingSoftware: 'The taxes below are imported from your', taxCode: 'Tax code', diff --git a/src/languages/es.ts b/src/languages/es.ts index 0c682569263f..ac843ad6ad3a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3612,10 +3612,16 @@ const translations = { actions: { delete: 'Eliminar tasa', deleteMultiple: 'Eliminar tasas', - disable: 'Desactivar tasa', - disableMultiple: 'Desactivar tasas', enable: 'Activar tasa', - enableMultiple: 'Activar tasas', + disable: 'Desactivar tasa', + enableTaxTitle: () => ({ + one: 'Activar tasa', + other: 'Activar tasas', + }), + disableTaxTitle: () => ({ + one: 'Desactivar tasa', + other: 'Desactivar tasas', + }), }, importedFromAccountingSoftware: 'Impuestos importadas desde', taxCode: 'Código de impuesto', diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 207ecfc30706..2b4146002fec 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -71,6 +71,9 @@ function WorkspaceTaxesPage({ const currentConnectionName = PolicyUtils.getCurrentConnectionName(policy); const canSelectMultiple = shouldUseNarrowLayout ? selectionMode?.isEnabled : true; + const enabledRatesCount = selectedTaxesIDs.filter((taxID) => !policy?.taxRates?.taxes[taxID]?.isDisabled).length; + const disabledRatesCount = selectedTaxesIDs.length - enabledRatesCount; + const fetchTaxes = useCallback(() => { openPolicyTaxesPage(policyID); }, [policyID]); @@ -208,7 +211,7 @@ function WorkspaceTaxesPage({ if (selectedTaxesIDs.some((taxID) => !policy?.taxRates?.taxes[taxID]?.isDisabled)) { options.push({ icon: Expensicons.Close, - text: isMultiple ? translate('workspace.taxes.actions.disableMultiple') : translate('workspace.taxes.actions.disable'), + text: translate('workspace.taxes.actions.disableTaxTitle', {count: enabledRatesCount}), value: CONST.POLICY.BULK_ACTION_TYPES.DISABLE, onSelected: () => toggleTaxes(false), }); @@ -218,13 +221,13 @@ function WorkspaceTaxesPage({ if (selectedTaxesIDs.some((taxID) => policy?.taxRates?.taxes[taxID]?.isDisabled)) { options.push({ icon: Expensicons.Checkmark, - text: isMultiple ? translate('workspace.taxes.actions.enableMultiple') : translate('workspace.taxes.actions.enable'), + text: translate('workspace.taxes.actions.enableTaxTitle', {count: disabledRatesCount}), value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE, onSelected: () => toggleTaxes(true), }); } return options; - }, [hasAccountingConnections, policy?.taxRates?.taxes, selectedTaxesIDs, toggleTaxes, translate]); + }, [hasAccountingConnections, policy?.taxRates?.taxes, selectedTaxesIDs, toggleTaxes, translate, enabledRatesCount, disabledRatesCount]); const shouldShowBulkActionsButton = shouldUseNarrowLayout ? selectionMode?.isEnabled : selectedTaxesIDs.length > 0; const headerButtons = !shouldShowBulkActionsButton ? ( From e422408a6219b1a06dedaa73f6fff77703fb474c Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:40:08 +0530 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Getabalew <75031127+getusha@users.noreply.github.com> --- src/languages/en.ts | 8 ++++---- src/languages/es.ts | 4 ++-- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7975274ed697..741ebf5daa17 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3571,11 +3571,11 @@ const translations = { deleteMultiple: 'Delete rates', enable: 'Enable rate', disable: 'Disable rate', - enableTaxTitle: () => ({ - one: 'enable rate', - other: 'enable rates', + enableTaxRates: () => ({ + one: 'Enable rate', + other: 'Enable rates', }), - disableTaxTitle: () => ({ + disableTaxRates: () => ({ one: 'Disable rate', other: 'Disable rates', }), diff --git a/src/languages/es.ts b/src/languages/es.ts index ac843ad6ad3a..f8f6429a2b5c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3614,11 +3614,11 @@ const translations = { deleteMultiple: 'Eliminar tasas', enable: 'Activar tasa', disable: 'Desactivar tasa', - enableTaxTitle: () => ({ + disableTaxRates: () => ({ one: 'Activar tasa', other: 'Activar tasas', }), - disableTaxTitle: () => ({ + disableTaxRates: () => ({ one: 'Desactivar tasa', other: 'Desactivar tasas', }), diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 2b4146002fec..32946b300d3b 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -211,7 +211,7 @@ function WorkspaceTaxesPage({ if (selectedTaxesIDs.some((taxID) => !policy?.taxRates?.taxes[taxID]?.isDisabled)) { options.push({ icon: Expensicons.Close, - text: translate('workspace.taxes.actions.disableTaxTitle', {count: enabledRatesCount}), + text: translate('workspace.taxes.actions.disableTaxRates', {count: enabledRatesCount}), value: CONST.POLICY.BULK_ACTION_TYPES.DISABLE, onSelected: () => toggleTaxes(false), }); @@ -221,7 +221,7 @@ function WorkspaceTaxesPage({ if (selectedTaxesIDs.some((taxID) => policy?.taxRates?.taxes[taxID]?.isDisabled)) { options.push({ icon: Expensicons.Checkmark, - text: translate('workspace.taxes.actions.enableTaxTitle', {count: disabledRatesCount}), + text: translate('workspace.taxes.actions.disableTaxRates', {count: disabledRatesCount}), value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE, onSelected: () => toggleTaxes(true), }); From 0ebafb0691fd62f5a3bffe34e0155b00dd75cd98 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:43:05 +0530 Subject: [PATCH 3/4] Update src/pages/workspace/taxes/WorkspaceTaxesPage.tsx --- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 32946b300d3b..c5dd3dd3fc3c 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -221,7 +221,7 @@ function WorkspaceTaxesPage({ if (selectedTaxesIDs.some((taxID) => policy?.taxRates?.taxes[taxID]?.isDisabled)) { options.push({ icon: Expensicons.Checkmark, - text: translate('workspace.taxes.actions.disableTaxRates', {count: disabledRatesCount}), + text: translate('workspace.taxes.actions.enableTaxRates', {count: disabledRatesCount}), value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE, onSelected: () => toggleTaxes(true), }); From f9d1a5bc4142887c8dad0c804cbb67aaf129d450 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:44:22 +0530 Subject: [PATCH 4/4] Update src/languages/es.ts --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index f8f6429a2b5c..a8b5414ccb7c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3614,7 +3614,7 @@ const translations = { deleteMultiple: 'Eliminar tasas', enable: 'Activar tasa', disable: 'Desactivar tasa', - disableTaxRates: () => ({ + enableTaxRates: () => ({ one: 'Activar tasa', other: 'Activar tasas', }),