diff --git a/ts/features/pn/components/LegacyMessageDetails.tsx b/ts/features/pn/components/LegacyMessageDetails.tsx index 063aea1d982..600590dec80 100644 --- a/ts/features/pn/components/LegacyMessageDetails.tsx +++ b/ts/features/pn/components/LegacyMessageDetails.tsx @@ -41,7 +41,7 @@ import { MessageDetailsSection } from "./MessageDetailsSection"; import { MessageTimeline } from "./MessageTimeline"; import { MessageTimelineCTA } from "./MessageTimelineCTA"; import { LegacyMessageF24 } from "./LegacyMessageF24"; -import { LegacyMessageFooter } from "./LegacyMessageFooter"; +import { MessageFooter } from "./MessageFooter"; import { LegacyMessagePayments } from "./LegacyMessagePayments"; import { MessagePaymentBottomSheet } from "./MessagePaymentBottomSheet"; @@ -194,7 +194,7 @@ export const LegacyMessageDetails = ({ /> )} - - {canShowMorePaymentsLink(isCancelled, payments) && ( + + {shouldUseBottomSheetForPayments(isCancelled, payments) && ( | undefined; maxVisiblePaymentCount: number; @@ -33,13 +36,15 @@ type LegacyMessageFooterProps = { presentPaymentsBottomSheetRef: MutableRefObject<(() => void) | undefined>; }; -export const LegacyMessageFooter = ({ +export const MessageFooter = ({ messageId, payments, maxVisiblePaymentCount, isCancelled, presentPaymentsBottomSheetRef -}: LegacyMessageFooterProps) => { +}: MessageFooterProps) => { + const safeAreaInsets = useSafeAreaInsets(); + const isDesignSystemEnabled = useIOSelector(isDesignSystemEnabledSelector); const buttonState = useIOSelector(state => paymentsButtonStateSelector( state, @@ -54,7 +59,10 @@ export const LegacyMessageFooter = ({ canNavigateToPaymentFromMessageSelector(state) ); const onFooterPressCallback = useCallback(() => { - if (payments?.length === 1) { + if (shouldUseBottomSheetForPayments(false, payments)) { + trackPNShowAllPayments(); + presentPaymentsBottomSheetRef.current?.(); + } else if (payments) { const firstPayment = payments[0]; const paymentId = getRptIdStringFromPayment(firstPayment); initializeAndNavigateToWalletForPayment( @@ -67,9 +75,6 @@ export const LegacyMessageFooter = ({ true, () => toast.error(I18n.t("genericError")) ); - } else { - trackPNShowAllPayments(); - presentPaymentsBottomSheetRef.current?.(); } }, [ canNavigateToPayment, @@ -83,7 +88,23 @@ export const LegacyMessageFooter = ({ return null; } const isLoading = buttonState === "visibleLoading"; - return ( + return isDesignSystemEnabled ? ( + + + + ) : ( maxVisiblePaymentCount; const morePaymentsLabel = payments ? `${I18n.t("features.pn.details.paymentSection.morePayments")} (${ payments.length @@ -184,7 +183,7 @@ export const MessagePayments = ({ /> ); })} - {showMorePaymentsLink && ( + {canShowMorePaymentsLink(isCancelled, payments) && ( <> {paymentsButtonStatus === "visibleLoading" && ( diff --git a/ts/features/pn/components/__test__/LegacyMessageFooter.test.tsx b/ts/features/pn/components/__test__/MessageFooter.test.tsx similarity index 95% rename from ts/features/pn/components/__test__/LegacyMessageFooter.test.tsx rename to ts/features/pn/components/__test__/MessageFooter.test.tsx index c69e9f3d332..81539a40c07 100644 --- a/ts/features/pn/components/__test__/LegacyMessageFooter.test.tsx +++ b/ts/features/pn/components/__test__/MessageFooter.test.tsx @@ -5,11 +5,11 @@ import { preferencesDesignSystemSetEnabled } from "../../../../store/actions/per import { appReducer } from "../../../../store/reducers"; import { renderScreenWithNavigationStoreContext } from "../../../../utils/testWrapper"; import { UIMessageId } from "../../../messages/types"; -import { LegacyMessageFooter } from "../LegacyMessageFooter"; +import { MessageFooter } from "../MessageFooter"; import * as standardPayments from "../../../messages/store/reducers/payments"; import * as payments from "../../store/reducers/payments"; -describe("LegacyMessageFooter", () => { +describe("MessageFooter", () => { beforeEach(() => { jest.resetAllMocks(); jest.clearAllMocks(); @@ -64,7 +64,7 @@ const renderScreen = ( return renderScreenWithNavigationStoreContext( () => ( - `; -exports[`LegacyMessageFooter should match snapshot for hidden button 1`] = ` +exports[`MessageFooter should match snapshot for hidden button 1`] = `