diff --git a/src/components/Countdown.tsx b/src/components/Countdown.tsx index 87119f6..26d688a 100644 --- a/src/components/Countdown.tsx +++ b/src/components/Countdown.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; -const TARGET = new Date("2026-07-03T18:30:00+05:30").getTime(); +const TARGET = new Date("2026-07-03T19:30:00+05:30").getTime(); function getParts(msLeft: number) { const clamped = Math.max(msLeft, 0); @@ -16,36 +16,53 @@ function getParts(msLeft: number) { export default function Countdown() { const [parts, setParts] = useState | null>(null); + const [isDone, setIsDone] = useState(false); useEffect(() => { - const tick = () => setParts(getParts(TARGET - Date.now())); + const tick = () => { + const msLeft = TARGET - Date.now(); + setParts(getParts(msLeft)); + if (msLeft <= 0) { + setIsDone(true); + } + }; tick(); const id = setInterval(tick, 1000); return () => clearInterval(id); }, []); + // Don't render anything until we know the state, and hide entirely once done. + if (parts === null || isDone) { + return null; + } + const units = [ - { label: "Days", value: parts?.days }, - { label: "Hours", value: parts?.hours }, - { label: "Min", value: parts?.minutes }, - { label: "Sec", value: parts?.seconds }, + { label: "Days", value: parts.days }, + { label: "Hours", value: parts.hours }, + { label: "Min", value: parts.minutes }, + { label: "Sec", value: parts.seconds }, ]; return ( -
- {units.map((u) => ( -
- - {u.value !== undefined ? String(u.value).padStart(2, "0") : "--"} - - - {u.label} - -
- ))} +
+

+ Counting down to installation +

+
+ {units.map((u) => ( +
+ + {String(u.value).padStart(2, "0")} + + + {u.label} + +
+ ))} +
); } \ No newline at end of file diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index 2b76e7c..ec106c0 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -99,10 +99,7 @@ export default function Hero() {
-
-

- Counting down to installation -

+