Skip to content

Commit

Permalink
Merge pull request #46020 from software-mansion-labs/Guccio163/45949-…
Browse files Browse the repository at this point in the history
…divide_workflows

#45949 & #45950 Divide workflows page into three sections & Update payment section with bank icon
  • Loading branch information
tgolen authored Jul 30, 2024
2 parents bcd283d + 3a4acd2 commit a2091d7
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 75 deletions.
9 changes: 6 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1242,19 +1242,20 @@ export default {
workflowTitle: 'Spend',
workflowDescription: 'Configure a workflow from the moment spend occurs, including approval and payment.',
delaySubmissionTitle: 'Delay submissions',
delaySubmissionDescription: 'Expenses are shared right away for better spend visibility. Set a slower cadence if needed.',
delaySubmissionDescription: 'Delay expense submissions based on a custom schedule, or keep this option disabled to maintain realtime spend visibility.',
submissionFrequency: 'Submission frequency',
submissionFrequencyDateOfMonth: 'Date of month',
addApprovalsTitle: 'Add approvals',
addApprovalButton: 'Add approval workflow',
approver: 'Approver',
connectBankAccount: 'Connect bank account',
addApprovalsDescription: 'Require additional approval before authorizing a payment.',
makeOrTrackPaymentsTitle: 'Payments',
makeOrTrackPaymentsDescription: 'Add an authorized payer for payments made in Expensify, or track payments made elsewhere.',
makeOrTrackPaymentsTitle: 'Make or track payments',
makeOrTrackPaymentsDescription: 'Add an authorized payer for payments made in Expensify, or simply track payments made elsewhere.',
editor: {
submissionFrequency: 'Choose how long Expensify should wait before sharing error-free spend.',
},
frequencyDescription: 'Choose how often you’d like expenses to submit automatically, or make it manual',
frequencies: {
weekly: 'Weekly',
monthly: 'Monthly',
Expand Down Expand Up @@ -1293,6 +1294,8 @@ export default {
title: 'Authorized payer',
genericErrorMessage: 'The authorized payer could not be changed. Please try again.',
admins: 'Admins',
payer: 'Payer',
paymentAccount: 'Payment account',
},
reportFraudPage: {
title: 'Report virtual card fraud',
Expand Down
9 changes: 6 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1251,19 +1251,20 @@ export default {
workflowTitle: 'Gasto',
workflowDescription: 'Configure un flujo de trabajo desde el momento en que se produce el gasto, incluida la aprobación y el pago',
delaySubmissionTitle: 'Retrasar envíos',
delaySubmissionDescription: 'Los gastos se comparten de inmediato para una mejor visibilidad del gasto. Establece una cadencia más lenta si es necesario.',
delaySubmissionDescription: 'Retrasa la presentación de gastos en base a un calendario personalizado, o mantén esta opción desactivada para seguir viendo los gastos en tiempo real.',
submissionFrequency: 'Frecuencia de envíos',
submissionFrequencyDateOfMonth: 'Fecha del mes',
addApprovalsTitle: 'Requerir aprobaciones',
addApprovalButton: 'Añadir flujo de aprobación',
approver: 'Aprobador',
connectBankAccount: 'Conectar cuenta bancaria',
addApprovalsDescription: 'Requiere una aprobación adicional antes de autorizar un pago.',
makeOrTrackPaymentsTitle: 'Pagos',
makeOrTrackPaymentsDescription: 'Añade un pagador autorizado para los pagos realizados en Expensify, o realiza un seguimiento de los pagos realizados en otro lugar.',
makeOrTrackPaymentsTitle: 'Realizar o seguir pagos',
makeOrTrackPaymentsDescription: 'Añade un pagador autorizado para los pagos realizados en Expensify, o simplemente realiza un seguimiento de los pagos realizados en otro lugar.',
editor: {
submissionFrequency: 'Elige cuánto tiempo Expensify debe esperar antes de compartir los gastos sin errores.',
},
frequencyDescription: 'Elige la frecuencia de presentación automática de gastos, o preséntalos manualmente',
frequencies: {
weekly: 'Semanal',
monthly: 'Mensual',
Expand Down Expand Up @@ -1302,6 +1303,8 @@ export default {
title: 'Pagador autorizado',
genericErrorMessage: 'El pagador autorizado no se pudo cambiar. Por favor, inténtalo mas tarde.',
admins: 'Administradores',
payer: 'Pagador',
paymentAccount: 'Cuenta de pago',
},
reportFraudPage: {
title: 'Reportar fraude con la tarjeta virtual',
Expand Down
9 changes: 7 additions & 2 deletions src/libs/PaymentUtils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type {ValueOf} from 'type-fest';
import getBankIcon from '@components/Icon/BankIcons';
import type {ThemeStyles} from '@styles/index';
import CONST from '@src/CONST';
import type BankAccount from '@src/types/onyx/BankAccount';
import type Fund from '@src/types/onyx/Fund';
import type PaymentMethod from '@src/types/onyx/PaymentMethod';
import type {ACHAccount} from '@src/types/onyx/Policy';
import * as Localize from './Localize';
import BankAccountModel from './models/BankAccount';

type AccountType = BankAccount['accountType'] | Fund['accountType'];
type AccountType = ValueOf<typeof CONST.PAYMENT_METHODS> | undefined;

/**
* Check to see if user has either a debit card or personal bank account added that can be used with a wallet.
Expand All @@ -25,11 +27,14 @@ function hasExpensifyPaymentMethod(fundList: Record<string, Fund>, bankAccountLi
return validBankAccount || (shouldIncludeDebitCard && validDebitCard);
}

function getPaymentMethodDescription(accountType: AccountType, account: BankAccount['accountData'] | Fund['accountData']): string {
function getPaymentMethodDescription(accountType: AccountType, account: BankAccount['accountData'] | Fund['accountData'] | ACHAccount): string {
if (account) {
if (accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && 'accountNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.accountLastFour')} ${account.accountNumber?.slice(-4)}`;
}
if (accountType === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT && 'accountNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.accountLastFour')} ${account.accountNumber?.slice(-4)}`;
}
if (accountType === CONST.PAYMENT_METHODS.DEBIT_CARD && 'cardNumber' in account) {
return `${Localize.translateLocal('paymentMethodList.cardLastFour')} ${account.cardNumber?.slice(-4)}`;
}
Expand Down
19 changes: 17 additions & 2 deletions src/pages/workspace/workflows/ToggleSettingsOptionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type ToggleSettingOptionRowProps = {
/** Used to apply styles to the Title */
titleStyle?: StyleProp<TextStyle>;

/** Used to apply styles to the Subtitle */
subtitleStyle?: StyleProp<TextStyle>;

/** Whether the option is enabled or not */
isActive: boolean;

Expand Down Expand Up @@ -76,6 +79,7 @@ function ToggleSettingOptionRow({
title,
customTitle,
subtitle,
subtitleStyle,
switchAccessibilityLabel,
shouldPlaceSubtitleBelowSwitch,
shouldEscapeText = undefined,
Expand Down Expand Up @@ -119,8 +123,19 @@ function ToggleSettingOptionRow({
</View>
);
}
return <Text style={[styles.mutedNormalTextLabel, shouldPlaceSubtitleBelowSwitch ? styles.mt1 : {...styles.mt1, ...styles.mr5}]}>{subtitle}</Text>;
}, [subtitle, shouldParseSubtitle, styles.mutedNormalTextLabel, styles.mt1, styles.mr5, styles.flexRow, styles.renderHTML, shouldPlaceSubtitleBelowSwitch, processedSubtitle]);
return <Text style={[styles.mutedNormalTextLabel, shouldPlaceSubtitleBelowSwitch ? styles.mt1 : {...styles.mt1, ...styles.mr5}, subtitleStyle]}>{subtitle}</Text>;
}, [
subtitle,
shouldParseSubtitle,
styles.mutedNormalTextLabel,
styles.mt1,
styles.mr5,
styles.flexRow,
styles.renderHTML,
shouldPlaceSubtitleBelowSwitch,
subtitleStyle,
processedSubtitle,
]);

return (
<OfflineWithFeedback
Expand Down
Loading

0 comments on commit a2091d7

Please sign in to comment.