Skip to content

Commit

Permalink
commit modal
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrohba1 committed Dec 12, 2023
1 parent 1371f43 commit 65a2ad5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions front-end/components/CommitButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useAccount } from "wagmi";
import abi from "@/abi/RandomnessSource.json";
import { useEffect } from "react";
import { useCommit } from "@/lib/wagmi/useCommit";
import { useDisclosure } from "@chakra-ui/react";
import { BaseModal } from "../BaseModal";

interface IVotedButton {
addedParticipants: AddedParticipant[];
Expand All @@ -14,7 +16,8 @@ export const CommitButton = ({ addedParticipants, randSrc }: IVotedButton) => {
const { address } = useAccount();
console.log({ randSrc, abi });

const { write, error } = useCommit({ randSrc, _commit: "asaofsdaifj" });
const { /* write */ error } = useCommit({ randSrc, _commit: "asaofsdaifj" });
const { onClose, onOpen, isOpen } = useDisclosure();

useEffect(() => {
if (error) {
Expand All @@ -32,12 +35,22 @@ export const CommitButton = ({ addedParticipants, randSrc }: IVotedButton) => {
<button
className="bg-[#0096FF] text-white font-bold py-2 px-4 rounded cursor-pointer"
onClick={() => {
write?.();
onOpen();
}}
disabled={!write}
// disabled={!write}
>
commit
</button>

<BaseModal title="teste" isOpen={isOpen} onClose={onClose}>
{/* TODO:
Colocar um input, uma checkbox para salvar nos cookies,
// e o botão final para fazer o commit
*/}
<p> teste</p>
</BaseModal>
</div>
);
else return <div></div>;
Expand Down

0 comments on commit 65a2ad5

Please sign in to comment.