diff --git a/src/components/SendFlow/Tez/FormPage.tsx b/src/components/SendFlow/Tez/FormPage.tsx index fb7c385d8a..0be17e8ea6 100644 --- a/src/components/SendFlow/Tez/FormPage.tsx +++ b/src/components/SendFlow/Tez/FormPage.tsx @@ -43,7 +43,10 @@ const toOperation = (formValues: FormValues): TezTransfer => ({ recipient: parsePkh(formValues.recipient), }); -const FormPage: React.FC> = props => { +const FormPage: React.FC & { showPreview?: boolean }> = ({ + showPreview = true, + ...props +}) => { const openSignPage = useOpenSignPageFormAction({ SignPage, signPageExtraData: undefined, @@ -126,6 +129,7 @@ const FormPage: React.FC> = props => { isValid={isValid} onSingleSubmit={handleSubmit(onSingleSubmit)} onAddToBatch={handleSubmit(onBatchSubmit)} + showPreview={showPreview} /> diff --git a/src/components/SendFlow/utils.test.tsx b/src/components/SendFlow/utils.test.tsx index 1996a4d8db..ebe5ad602e 100644 --- a/src/components/SendFlow/utils.test.tsx +++ b/src/components/SendFlow/utils.test.tsx @@ -54,6 +54,33 @@ describe("SendFlow utils", () => { fireEvent.click(screen.getByText("Insert Into Batch")); expect(mockSingle).toHaveBeenCalled(); }); + + it("shows preview button by default", () => { + render( + {}} + onAddToBatch={async () => {}} + /> + ); + + expect(screen.getByText("Preview")).toBeInTheDocument(); + }); + + it("hides preview button", () => { + render( + {}} + onAddToBatch={async () => {}} + /> + ); + + expect(screen.queryByText("Preview")).not.toBeInTheDocument(); + }); }); describe("smallestUnit", () => { diff --git a/src/components/SendFlow/utils.tsx b/src/components/SendFlow/utils.tsx index 7b31034519..522ca7e771 100644 --- a/src/components/SendFlow/utils.tsx +++ b/src/components/SendFlow/utils.tsx @@ -51,26 +51,30 @@ export const FormSubmitButtons = ({ isValid, onSingleSubmit, onAddToBatch, + showPreview = true, }: { isLoading: boolean; isValid: boolean; onSingleSubmit: () => Promise; onAddToBatch: () => Promise; + showPreview?: boolean; }) => { return ( <> - + {showPreview && ( + + )} +