Skip to content

Commit

Permalink
Merge pull request #2415 from BibliothecaDAO/raschel-landing
Browse files Browse the repository at this point in the history
add back counter
  • Loading branch information
RedBeardEth authored Dec 11, 2024
2 parents c36f4ad + ba94e29 commit e9e6b62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
21 changes: 11 additions & 10 deletions landing/src/hooks/use-season-start.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { configManager } from "@/dojo/setup";
import { useState } from "react";
import { useEffect, useState } from "react";

export const useSeasonStart = () => {
const seasonStart = BigInt(configManager.getSeasonConfig().startAt || 0);
const nextBlockTimestamp = BigInt(Math.floor(Date.now() / 1000));

const [countdown, setCountdown] = useState<bigint>(0n);
// useEffect(() => {
// if (nextBlockTimestamp === 0n || seasonStart === 0n) return;

// const initialCountdown = seasonStart - nextBlockTimestamp;
// setCountdown(initialCountdown);
useEffect(() => {
if (nextBlockTimestamp === 0n || seasonStart === 0n) return;

// const timer = setInterval(() => {
// setCountdown((prev) => prev - 1n);
// }, 1000);
const initialCountdown = seasonStart - nextBlockTimestamp;
setCountdown(initialCountdown);

// return () => clearInterval(timer);
// }, [nextBlockTimestamp, seasonStart]);
const timer = setInterval(() => {
setCountdown((prev) => prev - 1n);
}, 1000);

return () => clearInterval(timer);
}, [nextBlockTimestamp, seasonStart]);

return { seasonStart, countdown, nextBlockTimestamp };
};
10 changes: 8 additions & 2 deletions landing/src/routes/index.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { AnimatedGrid } from "@/components/modules/animated-grid";
import { DataCard, DataCardProps } from "@/components/modules/data-card";
import { Leaderboard } from "@/components/modules/leaderboard";
import { PRIZE_POOL_ACHIEVEMENTS, PRIZE_POOL_GUILDS, PRIZE_POOL_INDIVIDUAL_LEADERBOARD } from "@/constants";
import {
PRIZE_POOL_ACHIEVEMENTS,
PRIZE_POOL_CONTENT_CREATORS,
PRIZE_POOL_GUILDS,
PRIZE_POOL_INDIVIDUAL_LEADERBOARD,
} from "@/constants";
import { useDonkeysBurned } from "@/hooks/use-donkeys-burned";
import { useLordsBridgeBalance } from "@/hooks/use-lords-bridged";
import { usePlayerCount } from "@/hooks/use-player-count";
Expand Down Expand Up @@ -81,7 +86,8 @@ function Index() {
PRIZE_POOL_GUILDS +
Number(formatEther(prizePoolPlayers)) +
PRIZE_POOL_ACHIEVEMENTS +
PRIZE_POOL_INDIVIDUAL_LEADERBOARD,
PRIZE_POOL_INDIVIDUAL_LEADERBOARD +
PRIZE_POOL_CONTENT_CREATORS,
0,
),
icon: <Coins />,
Expand Down

0 comments on commit e9e6b62

Please sign in to comment.