-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge * working * feat:Vote Timeline graph style interface * WIP:voting timeline summary extended version ui * feat:Implemented live data display in timeline chart * fixes timeline chart * Formatting and updates to sci notation functions * A few minor bugfixes and empty vote display * Reverted tenant-specific avatar changes * wip * Fixed quorum and threshold values * Removed info icons * Misc fixes * Fixed hover issues and a few misc css bugs * Quorum calc --------- Co-authored-by: Andrei Taraschuk <[email protected]> Co-authored-by: andrei <[email protected]>
- Loading branch information
1 parent
34302b4
commit 9780cf8
Showing
18 changed files
with
734 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 9 additions & 35 deletions
44
src/components/Proposals/ProposalPage/OPProposalPage/ProposalVotesBar/ProposalVotesBar.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,16 @@ | ||
import { HStack } from "@/components/Layout/Stack"; | ||
import styles from "./proposalVotesBar.module.scss"; | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from "@/components/ui/tooltip"; | ||
import { TokenAmountDisplay, generateBarsForVote } from "@/lib/utils"; | ||
import { generateBarsForVote } from "@/lib/utils"; | ||
|
||
export default function ProposalVotesBar({ proposal }) { | ||
return ( | ||
<div> | ||
<TooltipProvider delayDuration={10}> | ||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<HStack | ||
justifyContent="justify-around" | ||
className={styles.vote_bar_ticks} | ||
> | ||
{generateBarsForVote( | ||
proposal.proposalResults.for, | ||
proposal.proposalResults.abstain, | ||
proposal.proposalResults.against | ||
).map((value, idx) => { | ||
return <div key={`${idx}`} className={styles[value]} />; | ||
})} | ||
</HStack> | ||
</TooltipTrigger> | ||
<TooltipContent> | ||
<p> | ||
{TokenAmountDisplay({ | ||
amount: proposal.proposalResults.abstain, | ||
})}{" "} | ||
abstained | ||
</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
<div className={`flex flex-row justify-around ${styles.vote_bar_ticks}`}> | ||
{generateBarsForVote( | ||
proposal.proposalResults.for, | ||
proposal.proposalResults.abstain, | ||
proposal.proposalResults.against, | ||
).map((value, idx) => { | ||
return <div key={`${idx}`} className={styles[value]} />; | ||
})} | ||
</div> | ||
); | ||
} |
1 change: 0 additions & 1 deletion
1
...nents/Proposals/ProposalPage/OPProposalPage/ProposalVotesBar/proposalVotesBar.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 60 additions & 39 deletions
99
...nents/Proposals/ProposalPage/OPProposalPage/ProposalVotesSummary/ProposalVotesSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,77 @@ | ||
import { VStack, HStack } from "@/components/Layout/Stack"; | ||
"use client"; | ||
import { useState } from "react"; | ||
import styles from "./proposalVotesSummary.module.scss"; | ||
import ProposalVotesBar from "../ProposalVotesBar/ProposalVotesBar"; | ||
import { Proposal } from "@/app/api/common/proposals/proposal"; | ||
import TokenAmountDisplay from "@/components/shared/TokenAmountDisplay"; | ||
import { ParsedProposalResults } from "@/lib/proposalUtils"; | ||
import ProposalStatusDetail from "@/components/Proposals/ProposalStatus/ProposalStatusDetail"; | ||
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card"; | ||
import ProposalVotesSummaryDetails from "../ProposalVotesSummaryDetails/ProposalVotesSummaryDetails"; | ||
|
||
export default function ProposalVotesSummary({ | ||
proposal, | ||
}: { | ||
proposal, | ||
}: { | ||
proposal: Proposal; | ||
}) { | ||
const [showDetails, setShowDetails] = useState(false); | ||
const results = | ||
proposal.proposalResults as ParsedProposalResults["STANDARD"]["kind"]; | ||
|
||
return ( | ||
<VStack gap={2} className={styles.proposal_votes_summary_container}> | ||
<HStack justifyContent="justify-between" className="mt-2"> | ||
<div className="gl_votes_for"> | ||
FOR <TokenAmountDisplay amount={results.for} /> | ||
</div> | ||
<div className="gl_votes_against"> | ||
AGAINST <TokenAmountDisplay amount={results.against} /> | ||
</div> | ||
</HStack> | ||
<ProposalVotesBar proposal={proposal} /> | ||
<VStack className="font-medium"> | ||
<HStack justifyContent="justify-between" className="text-gray-4f pb-2"> | ||
<> | ||
{proposal.quorum && ( | ||
<div> | ||
Quorum <TokenAmountDisplay amount={proposal.quorum} /> | ||
<HoverCard | ||
open={showDetails} | ||
onOpenChange={setShowDetails} | ||
openDelay={0} | ||
closeDelay={0} | ||
> | ||
<div style={{ position: "relative" }}> | ||
|
||
<HoverCardTrigger className="w-full cursor-pointer block"> | ||
<div className={`flex flex-col gap-2 ${styles.proposal_votes_summary_container}`}> | ||
<div className="flex flex-row justify-between mt-2"> | ||
<div className="gl_votes_for"> | ||
FOR <TokenAmountDisplay amount={results.for} /> | ||
</div> | ||
)} | ||
</> | ||
<> | ||
{proposal.quorum && ( | ||
<div> | ||
<p>{`Threshold ${ | ||
Number(proposal.approvalThreshold) / 100 | ||
}%`}</p> | ||
<div className="gl_votes_against"> | ||
AGAINST <TokenAmountDisplay amount={results.against} /> | ||
</div> | ||
)} | ||
</> | ||
</HStack> | ||
<ProposalStatusDetail | ||
proposalStartTime={proposal.start_time} | ||
proposalEndTime={proposal.end_time} | ||
proposalStatus={proposal.status} | ||
proposalCancelledTime={proposal.cancelled_time} | ||
cancelledTransactionHash={proposal.cancelled_transaction_hash} | ||
/> | ||
</VStack> | ||
</VStack> | ||
</div> | ||
<ProposalVotesBar proposal={proposal} /> | ||
<div className="flex flex-col font-medium"> | ||
<div className="flex flex-row text-gray-4f pb-2 justify-between"> | ||
<> | ||
{proposal.quorum && ( | ||
<div> | ||
Quorum <TokenAmountDisplay amount={proposal.quorum} /> | ||
</div> | ||
)} | ||
</> | ||
<> | ||
{proposal.quorum && ( | ||
<div> | ||
<p>{`Threshold ${ | ||
Number(proposal.approvalThreshold) / 100 | ||
}%`}</p> | ||
</div> | ||
)} | ||
</> | ||
</div> | ||
<ProposalStatusDetail | ||
proposalStartTime={proposal.start_time} | ||
proposalEndTime={proposal.end_time} | ||
proposalStatus={proposal.status} | ||
proposalCancelledTime={proposal.cancelled_time} | ||
cancelledTransactionHash={proposal.cancelled_transaction_hash} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<HoverCardContent className="pb-0 absolute w-auto ml-4 mt-1" side="top" align={"start"}> | ||
<ProposalVotesSummaryDetails proposal={proposal} /> | ||
</HoverCardContent> | ||
</HoverCardTrigger> | ||
</div> | ||
</HoverCard> | ||
); | ||
} |
Oops, something went wrong.