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",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.24",
|
"version": "0.5.25",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -175,19 +175,19 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore);
|
localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsPending(true);
|
setIsPending(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleExecute = async () => {
|
const handleExecute = async () => {
|
||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
await executeProposal(chainId, address, proposalId);
|
await executeProposal(chainId, address, proposalId);
|
||||||
setIsPending(true);
|
setIsPending(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRelease = async (proposalId) => {
|
const handleRelease = async (proposalId) => {
|
||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
await releaseLocked(chainId, address, proposalId);
|
await releaseLocked(chainId, address, proposalId);
|
||||||
setIsPending(true);
|
setIsPending(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -343,6 +343,7 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
isProposer={proposalProposer === address}
|
isProposer={proposalProposer === address}
|
||||||
chainId={chainId}
|
chainId={chainId}
|
||||||
proposalId={id}
|
proposalId={id}
|
||||||
|
isPending={isPending}
|
||||||
/>
|
/>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Box>
|
</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 { delay: propsalVotingDelay } = useProposalVotingDelay(chainId, proposalId);
|
||||||
const { snapshot: proposalSnapshot } = useProposalSnapshot(chainId, proposalId);
|
const { snapshot: proposalSnapshot } = useProposalSnapshot(chainId, proposalId);
|
||||||
const { deadline: proposalDeadline } = useProposalDeadline(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" />
|
<VotingTimelineItem chainId={chainId} occured={proposalDeadline} message="Voting ends" />
|
||||||
</Timeline>
|
</Timeline>
|
||||||
<Box width="100%" display="flex" gap="10px">
|
<Box width="100%" display="flex" gap="10px">
|
||||||
{isProposer && <SecondaryButton
|
{(isProposer || (proposalLocked?._value ?? 0n) > 0n) && <SecondaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={(proposalLocked?._value ?? 0n) === 0n || state < 2}
|
disabled={isPending || state < 2}
|
||||||
onClick={() => address === "" ? connect() : handleRelease()}
|
onClick={() => address === "" ? connect() : handleRelease()}
|
||||||
>
|
>
|
||||||
{address === "" ? "Connect" : "Release"}
|
{address === "" ? "Connect" : "Release"}
|
||||||
</SecondaryButton>}
|
</SecondaryButton>}
|
||||||
<SecondaryButton
|
<SecondaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={state !== 4}
|
disabled={isPending || state !== 4}
|
||||||
onClick={() => address === "" ? connect() : handleExecute()}
|
onClick={() => address === "" ? connect() : handleExecute()}
|
||||||
>
|
>
|
||||||
{address === "" ? "Connect" : "Execute"}
|
{address === "" ? "Connect" : convertStatusToLabel(state)}
|
||||||
</SecondaryButton>
|
</SecondaryButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user