Skip to content

Commit

Permalink
Merge pull request #2609 from BibliothecaDAO/next
Browse files Browse the repository at this point in the history
button
  • Loading branch information
ponderingdemocritus authored Dec 27, 2024
2 parents a56bbbc + c9c9e41 commit 7183016
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions client/src/ui/modules/rewards/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Button from "@/ui/elements/Button";
import { formatTime, getEntityIdFromKeys } from "@/ui/utils/utils";
import { ContractAddress, WORLD_CONFIG_ID } from "@bibliothecadao/eternum";
import { useComponentValue, useEntityQuery } from "@dojoengine/react";
import { getComponentValue, Has, runQuery } from "@dojoengine/recs";
import { Has, getComponentValue, runQuery } from "@dojoengine/recs";
import { useCallback, useEffect, useMemo, useState } from "react";
import { shortString } from "starknet";
import { formatEther } from "viem";
Expand Down Expand Up @@ -186,19 +186,21 @@ export const Rewards = () => {
</div>
</Compartment>

<div className=" flex gap-4">
<Button variant="primary" isLoading={isLoading} disabled={!registrationClosed} onClick={claimRewards}>
{registrationClosed ? "Claim Rewards" : "Waiting for registration period to end"}
</Button>

<Button
disabled={registrationClosed}
variant="primary"
isLoading={isLoading}
onClick={registerToLeaderboard}
>
Register to Leaderboard
</Button>
</div>
{/* Action button */}
<Button
variant="primary"
isLoading={isLoading}
disabled={!registrationClosed && registrationStatus === "registered"}
onClick={registrationClosed ? claimRewards : registerToLeaderboard}
>
{registrationClosed
? "Claim Rewards"
: registrationStatus === "unregistered"
? "Register to Leaderboard"
: "Wait for claim period to start"}
</Button>
</div>
</div>
</OSWindow>
Expand All @@ -207,7 +209,11 @@ export const Rewards = () => {

const Compartment = ({ children, isCountdown }: { children: React.ReactNode; isCountdown?: boolean }) => {
return (
<div className={`flex flex-col w-full justify-center border-b border-brown/50 p-4 rounded-md ${isCountdown ? 'bg-brown/70' : 'bg-brown/50'} bg-hex m-auto h-28 ${isCountdown ? 'border-2 border-danger/50' : ''}`}>
<div
className={`flex flex-col w-full justify-center border-b border-brown/50 p-4 rounded-md ${
isCountdown ? "bg-brown/70" : "bg-brown/50"
} bg-hex m-auto h-28 ${isCountdown ? "border-2 border-danger/50" : ""}`}
>
{children}
</div>
);
Expand Down

0 comments on commit 7183016

Please sign in to comment.