From 6956101aff64fc7b882b2ba31ca7fa7e008423cb Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Fri, 17 Nov 2023 19:32:47 -0800 Subject: [PATCH] [PAY-2174] Support mobile web properly in add funds flows (#6740) --- packages/common/src/models/PurchaseContent.ts | 2 +- .../components/action-drawer/ActionDrawer.tsx | 11 +++- .../components/add-funds/AddFunds.module.css | 4 ++ .../web/src/components/add-funds/AddFunds.tsx | 15 ++++- .../components/address-tile/AddressTile.tsx | 2 +- .../MobileFilterButton.tsx | 59 +++++++++++++++++++ .../PurchaseContentFormFields.module.css | 9 +++ .../components/PurchaseContentFormFields.tsx | 56 +++++++++++------- .../components/summary-table/SummaryTable.tsx | 20 +++---- .../USDCManualTransfer.tsx | 5 +- packages/web/src/utils/zIndex.ts | 3 +- 11 files changed, 144 insertions(+), 42 deletions(-) create mode 100644 packages/web/src/components/mobile-filter-button/MobileFilterButton.tsx diff --git a/packages/common/src/models/PurchaseContent.ts b/packages/common/src/models/PurchaseContent.ts index 2de4f7107d3..4ec6caf737a 100644 --- a/packages/common/src/models/PurchaseContent.ts +++ b/packages/common/src/models/PurchaseContent.ts @@ -5,5 +5,5 @@ export enum PurchaseMethod { } export enum Vendors { - STRIPE = 'stripe' + STRIPE = 'Stripe' } diff --git a/packages/web/src/components/action-drawer/ActionDrawer.tsx b/packages/web/src/components/action-drawer/ActionDrawer.tsx index a8b7b2113f4..12c057d1e36 100644 --- a/packages/web/src/components/action-drawer/ActionDrawer.tsx +++ b/packages/web/src/components/action-drawer/ActionDrawer.tsx @@ -24,6 +24,7 @@ type ActionSheetModalProps = { title?: string renderTitle?: () => ReactNode classes?: { actionItem?: string } + zIndex?: number } // `ActionDrawer` is a drawer that presents a list of clickable rows with text @@ -35,13 +36,19 @@ const ActionDrawer = ({ onClose, title, renderTitle, - classes = {} + classes = {}, + zIndex }: ActionSheetModalProps) => { const isDark = isDarkMode() const headerId = id ? `${id}-header` : undefined return ( - +
diff --git a/packages/web/src/components/add-funds/AddFunds.module.css b/packages/web/src/components/add-funds/AddFunds.module.css index 44ef65155b4..6765087eade 100644 --- a/packages/web/src/components/add-funds/AddFunds.module.css +++ b/packages/web/src/components/add-funds/AddFunds.module.css @@ -18,3 +18,7 @@ flex-direction: column; align-items: flex-start; } + +.summaryTableRowValue { + width: 100%; +} diff --git a/packages/web/src/components/add-funds/AddFunds.tsx b/packages/web/src/components/add-funds/AddFunds.tsx index 91f799cfc9c..748daa4d023 100644 --- a/packages/web/src/components/add-funds/AddFunds.tsx +++ b/packages/web/src/components/add-funds/AddFunds.tsx @@ -2,6 +2,7 @@ import { ChangeEvent, useCallback, useState } from 'react' import { BNUSDC, + Vendors, decimalIntegerToHumanReadable, formatUSDCWeiToFloorCentsNumber, useCreateUserbankIfNeeded, @@ -22,10 +23,12 @@ import { import { BN } from 'bn.js' import cn from 'classnames' +import { MobileFilterButton } from 'components/mobile-filter-button/MobileFilterButton' import { SummaryTable, SummaryTableItem } from 'components/summary-table' import { track } from 'services/analytics' import { audiusBackendInstance } from 'services/audius-backend/audius-backend-instance' import { isMobile } from 'utils/clientUtil' +import { zIndex } from 'utils/zIndex' import styles from './AddFunds.module.css' @@ -62,11 +65,18 @@ export const AddFunds = ({ id: 'card', label: messages.withCard, icon: IconCreditCard, - value: ( + value: mobile ? ( + {}} + options={[{ label: Vendors.STRIPE }]} + zIndex={zIndex.ADD_FUNDS_VENDOR_SELECTION_DRAWER} + /> + ) : ( {}} initialSelectionIndex={0} variant={FilterButtonType.REPLACE_LABEL} - options={[{ label: 'Stripe' }]} + options={[{ label: Vendors.STRIPE }]} /> ) }, @@ -114,6 +124,7 @@ export const AddFunds = ({ onRadioChange={handleChangeOption} selectedRadioOption={selectedMethod} rowClassName={mobile ? styles.summaryTableRow : undefined} + rowValueClassName={mobile ? styles.summaryTableRowValue : undefined} />