Skip to content

Commit

Permalink
Add From Lable and use FormPageHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago committed Sep 12, 2023
1 parent 955ae70 commit 3cfeb63
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
17 changes: 13 additions & 4 deletions src/components/SendFlow/Batch/SignPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { mockImplicitAccount, mockMultisigAccount } from "../../../mocks/factories";
import { mockImplicitAccount, mockMultisigAccount, mockNFT } from "../../../mocks/factories";
import { render, screen } from "../../../mocks/testUtils";
import SignPage from "./SignPage";
import BigNumber from "bignumber.js";
import { TEZ } from "../../../utils/tezos";
import { makeAccountOperations } from "../../sendForm/types";
import { makeMultisigApproveOrExecuteOperation } from "../../../types/Operation";
import { useSignPageHelpers } from "../utils";
import store from "../../../utils/redux/store";
import accountsSlice from "../../../utils/redux/slices/accountsSlice";
import { parseContractPkh } from "../../../types/Address";

const account = mockImplicitAccount(0);
const multisig = mockMultisigAccount(1);
const operation = makeAccountOperations(account, account, [
makeMultisigApproveOrExecuteOperation(multisig.address, "execute", "3"),
{
type: "fa2",
amount: "1",
sender: account.address,
recipient: mockImplicitAccount(1).address,
contract: parseContractPkh(mockNFT(1).contract),
tokenId: mockNFT(1).tokenId,
},
]);
const fee = new BigNumber(1234567);

const fee = BigNumber(1234567);
const fixture = () => {
return <SignPage initialFee={fee} initialOperations={operation} />;
};
Expand All @@ -34,7 +43,7 @@ describe("<SignPage />", () => {
describe("number of transactions", () => {
it("displays the correct number of transactions", () => {
render(fixture());
expect(screen.getByTestId("transaction-length")).toHaveTextContent("1");
expect(screen.getByTestId("transaction-length")).toHaveTextContent("2");
});
});
});
14 changes: 4 additions & 10 deletions src/components/SendFlow/BatchModalBody.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";

import { ModalHeader, ModalBody, Text, Flex, ModalCloseButton } from "@chakra-ui/react";
import { ModalBody, Text, Flex, FormLabel } from "@chakra-ui/react";

import { BigNumber } from "bignumber.js";
import colors from "../../style/colors";
import { HeaderWrapper } from "./FormPageHeader";
import FormPageHeader from "./FormPageHeader";
import AddressTile from "../AddressTile/AddressTile";
import SignPageFee from "./SignPageFee";
import { ImplicitAddress } from "../../types/Address";
Expand All @@ -17,15 +17,9 @@ export const BatchModalBody: React.FC<{
}> = ({ title, fee, transactionCount, signerAddress }) => {
return (
<>
<ModalCloseButton />
<HeaderWrapper>
<ModalHeader textAlign="center">{title}</ModalHeader>
<Text textAlign="center" size="sm" color={colors.gray[400]}>
Enter your password to confirm this transaction.
</Text>
</HeaderWrapper>

<FormPageHeader title={title} subTitle=" Enter your password to confirm this transaction." />
<ModalBody>
<FormLabel>From</FormLabel>
<AddressTile address={signerAddress} />
<Flex my="12px" px="4px" alignItems="center" justifyContent="space-between">
<Flex>
Expand Down
21 changes: 11 additions & 10 deletions src/components/SendFlow/Multisig/SignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ export const SignPage: React.FC<{

return (
<ModalContent>
<BatchModalBody
fee={fee}
title={title}
signerAddress={signer.address}
transactionCount={transactionCount}
/>
<form>
<BatchModalBody
fee={fee}
title={title}
signerAddress={signer.address}
transactionCount={transactionCount}
/>

<ModalFooter>
<SignButton onSubmit={approveOrExecute} signer={signer} text={title} />
</ModalFooter>
<ModalFooter>
<SignButton onSubmit={approveOrExecute} signer={signer} text={title} />
</ModalFooter>
</form>
</ModalContent>
);
};

export default SignPage;

0 comments on commit 3cfeb63

Please sign in to comment.