diff --git a/packages/webapp/src/components/Drawer/DrawerHeaderContent.tsx b/packages/webapp/src/components/Drawer/DrawerHeaderContent.tsx index 91517087e..60b19b948 100644 --- a/packages/webapp/src/components/Drawer/DrawerHeaderContent.tsx +++ b/packages/webapp/src/components/Drawer/DrawerHeaderContent.tsx @@ -4,9 +4,10 @@ import { FormattedMessage as T } from '@/components'; import { Classes, Icon, H4, Button } from '@blueprintjs/core'; import withDrawerActions from '@/containers/Drawer/withDrawerActions'; +import { useDrawerContext } from './DrawerProvider'; -import styled from 'styled-components'; import { compose } from '@/utils'; +import styled from 'styled-components'; /** * Drawer header content. @@ -16,18 +17,15 @@ function DrawerHeaderContentRoot(props) { icon, title = , subTitle, - onClose, - name, closeDrawer, } = props; + const { name } = useDrawerContext(); if (title == null) { return null; } - const handleClose = (event) => { closeDrawer(name); - onClose && onClose(event); }; return ( diff --git a/packages/webapp/src/constants/drawers.ts b/packages/webapp/src/constants/drawers.ts index 843212d8e..340df6cbd 100644 --- a/packages/webapp/src/constants/drawers.ts +++ b/packages/webapp/src/constants/drawers.ts @@ -31,5 +31,6 @@ export enum DRAWERS { RECEIPT_CUSTOMIZE = 'RECEIPT_CUSTOMIZE', CREDIT_NOTE_CUSTOMIZE = 'CREDIT_NOTE_CUSTOMIZE', PAYMENT_RECEIVED_CUSTOMIZE = 'PAYMENT_RECEIVED_CUSTOMIZE', - BRANDING_TEMPLATES = 'BRANDING_TEMPLATES' + BRANDING_TEMPLATES = 'BRANDING_TEMPLATES', + PAYMENT_INVOICE_PREVIEW = 'PAYMENT_INVOICE_PREVIEW' } diff --git a/packages/webapp/src/containers/PaymentPortal/PaymentPortal.tsx b/packages/webapp/src/containers/PaymentPortal/PaymentPortal.tsx index aca789007..ae0dd24d1 100644 --- a/packages/webapp/src/containers/PaymentPortal/PaymentPortal.tsx +++ b/packages/webapp/src/containers/PaymentPortal/PaymentPortal.tsx @@ -3,10 +3,17 @@ import clsx from 'classnames'; import { Box, Group, Stack } from '@/components'; import styles from './PaymentPortal.module.scss'; import { usePaymentPortalBoot } from './PaymentPortalBoot'; +import { useDrawerActions } from '@/hooks/state'; +import { DRAWERS } from '@/constants/drawers'; export function PaymentPortal() { + const { openDrawer } = useDrawerActions(); const { sharableLinkMeta } = usePaymentPortalBoot(); + const handleInvoicePreviewBtnClick = () => { + openDrawer(DRAWERS.PAYMENT_INVOICE_PREVIEW); + }; + return ( @@ -85,6 +92,7 @@ export function PaymentPortal() { Download Invoice