Skip to content

Commit

Permalink
min vp
Browse files Browse the repository at this point in the history
  • Loading branch information
subject026 committed Jun 28, 2024
1 parent cded0c2 commit 70d1f07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/app/governance/GovernancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export function GovernancePage() {
? true
: false;

console.log({ minRequiredVotingPower });

if (
currentVotingDistribution.status === "ERROR" ||
cycleEndDate.status === "ERROR" ||
Expand Down Expand Up @@ -121,6 +119,7 @@ export function GovernancePage() {

<div className="col-span-12 row-start-4 lg:col-start-1 lg:col-span-8 lg:row-start-2">
<VotingPower
minRequiredVotingPower={minRequiredVotingPower}
userVotingPower={userVotingPower}
userHasVoted={userHasVoted}
cycleEndDate={cycleEndDate}
Expand Down
13 changes: 9 additions & 4 deletions src/app/governance/components/VotingPower.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { CycleEndDateState } from "../useCycleEndDate";
import { CycleLengthSuccess } from "../useCycleLength";

export function VotingPower({
minRequiredVotingPower,
userVotingPower,
userHasVoted,
userCanVote,
cycleEndDate,
cycleLength,
user,
}: {
minRequiredVotingPower: bigint | null;
userVotingPower: number | null;
userHasVoted: boolean;
userCanVote: boolean;
Expand Down Expand Up @@ -50,8 +52,11 @@ export function VotingPower({
<div className="pt-6 sm:p-0">
{userHasVoted ? (
<UserHasVoted cycleEndDate={cycleEndDate} />
) : !userCanVote && userVotingPower === 0 ? (
<NoPower />
) : !userCanVote &&
minRequiredVotingPower &&
userVotingPower &&
userVotingPower < minRequiredVotingPower ? (
<NotEnoughPower />
) : null}
</div>
</section>
Expand All @@ -60,11 +65,11 @@ export function VotingPower({
const widgetBaseClasses =
"py-3 sm:py-2 px-4 sm:w-[215px] flex flex-col items-center justify-center rounded-xl border-2";

function NoPower() {
function NotEnoughPower() {
return (
<div className={clsx(widgetBaseClasses, "border-status-danger")}>
<span className="dark:text-breadgray-ultra-white font-bold text-xl">
No Voting Power
No Power
</span>
<a
className="font-bold text-breadpink-shaded"
Expand Down

0 comments on commit 70d1f07

Please sign in to comment.