fix logic for buttons on detailed view
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
83dc5ea8e9
commit
44f927faf8
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.5.24",
|
||||
"version": "0.5.25",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -175,19 +175,19 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore);
|
||||
}
|
||||
|
||||
setIsPending(true);
|
||||
setIsPending(false);
|
||||
}
|
||||
|
||||
const handleExecute = async () => {
|
||||
setIsPending(true);
|
||||
await executeProposal(chainId, address, proposalId);
|
||||
setIsPending(true);
|
||||
setIsPending(false);
|
||||
}
|
||||
|
||||
const handleRelease = async (proposalId) => {
|
||||
setIsPending(true);
|
||||
await releaseLocked(chainId, address, proposalId);
|
||||
setIsPending(true);
|
||||
setIsPending(false);
|
||||
}
|
||||
|
||||
return (
|
||||
@ -343,6 +343,7 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
isProposer={proposalProposer === address}
|
||||
chainId={chainId}
|
||||
proposalId={id}
|
||||
isPending={isPending}
|
||||
/>
|
||||
</Paper>
|
||||
</Box>
|
||||
@ -380,7 +381,7 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
)
|
||||
}
|
||||
|
||||
const VotingTimeline = ({ connect, handleExecute, handleRelease, proposalLocked, proposalId, chainId, state, address, isProposer }) => {
|
||||
const VotingTimeline = ({ connect, handleExecute, handleRelease, proposalLocked, proposalId, chainId, state, address, isProposer, isPending }) => {
|
||||
const { delay: propsalVotingDelay } = useProposalVotingDelay(chainId, proposalId);
|
||||
const { snapshot: proposalSnapshot } = useProposalSnapshot(chainId, proposalId);
|
||||
const { deadline: proposalDeadline } = useProposalDeadline(chainId, proposalId);
|
||||
@ -400,19 +401,19 @@ const VotingTimeline = ({ connect, handleExecute, handleRelease, proposalLocked,
|
||||
<VotingTimelineItem chainId={chainId} occured={proposalDeadline} message="Voting ends" />
|
||||
</Timeline>
|
||||
<Box width="100%" display="flex" gap="10px">
|
||||
{isProposer && <SecondaryButton
|
||||
{(isProposer || (proposalLocked?._value ?? 0n) > 0n) && <SecondaryButton
|
||||
fullWidth
|
||||
disabled={(proposalLocked?._value ?? 0n) === 0n || state < 2}
|
||||
disabled={isPending || state < 2}
|
||||
onClick={() => address === "" ? connect() : handleRelease()}
|
||||
>
|
||||
{address === "" ? "Connect" : "Release"}
|
||||
</SecondaryButton>}
|
||||
<SecondaryButton
|
||||
fullWidth
|
||||
disabled={state !== 4}
|
||||
disabled={isPending || state !== 4}
|
||||
onClick={() => address === "" ? connect() : handleExecute()}
|
||||
>
|
||||
{address === "" ? "Connect" : "Execute"}
|
||||
{address === "" ? "Connect" : convertStatusToLabel(state)}
|
||||
</SecondaryButton>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user