Skip to content

Commit

Permalink
claimed state
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Jul 1, 2024
1 parent 7d206fd commit 232fc47
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Deed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ export const DeedComponent = ({ id, name, value, owner, isExact }: Props) => {
if (!isMatchingOwner) return { disabled: true, children: "Cannot claim" } as const;

if (isPrepareLoading) return { disabled: true, children: "Preparing", loading: true } as const;
if (!preparedRequest)
return { disabled: false, children: "Prepare", onClick: prepare, colorStyle: "accentSecondary" } as const;

if (isPending) return { disabled: true, children: "Waiting for wallet", loading: true } as const;
if (transactionReceipt) {
if (transactionReceipt.status === "reverted")
return { disabled: false, children: "Try again", onClick: () => claim(), colorStyle: "redPrimary" } as const;
return { disabled: true, children: "Claimed" } as const;
}

if (!preparedRequest)
return { disabled: false, children: "Prepare", onClick: prepare, colorStyle: "accentSecondary" } as const;

if (isPending) return { disabled: true, children: "Waiting for wallet", loading: true } as const;
if (hash) return { disabled: true, children: "Claiming", loading: true } as const;

return { disabled: false, children: "Claim", onClick: () => claim(), colorStyle: "accentPrimary" } as const;
Expand Down

0 comments on commit 232fc47

Please sign in to comment.