Files
HaBit/components/daily-quiz/daily-quiz-link-button.tsx
Harkamal Randhawa 93af01dec1 Rename daily quiz to check-in and add collapsible journal calendar.
Replace user-facing quiz wording with daily check-in, add journal history on the Bit page with month browsing and read-only entry modals, and keep legacy quiz routes redirecting to the new anchor.
2026-05-24 10:20:03 -06:00

37 lines
912 B
TypeScript

"use client";
import Link from "next/link";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { hasCompletedDailyQuizToday } from "@/lib/daily-quiz-storage";
import { routes } from "@/lib/routes";
export function DailyQuizLinkButton() {
const [isCompleted, setIsCompleted] = useState(false);
const [isReady, setIsReady] = useState(false);
useEffect(() => {
async function loadStatus() {
setIsCompleted(await hasCompletedDailyQuizToday());
setIsReady(true);
}
void loadStatus();
}, []);
if (!isReady || isCompleted) {
return (
<Button className="w-full" variant="outline" disabled>
Open daily check-in
</Button>
);
}
return (
<Button asChild className="w-full" variant="outline">
<Link href={`${routes.avatar}#bit-daily-check-in`}>Open daily check-in</Link>
</Button>
);
}