feat: quiz

This commit is contained in:
gosangam
2026-10-15 20:07:01 +05:30
parent 9f67da37a6
commit 6a6143ceb2
12 changed files with 982 additions and 16 deletions
+40 -1
View File
@@ -8,13 +8,23 @@
*/
import { useEffect, useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { ChevronRight } from "lucide-react";
import { useAuth } from "@/components/auth/auth-provider";
import { sadhna, type SadhnaDashboard } from "@/lib/sadhna";
import { StreakFlame } from "@/components/sadhna/streak-flame";
export function SadhnaStreakCTA() {
export function SadhnaStreakCTA({
compact = false,
}: {
/**
* Icon-only tile for the homepage row beside Vāṇī of the Day. The streak
* and today's status move into the accessible label and tooltip, and the
* tile tints while a streak is running.
*/
compact?: boolean;
} = {}) {
const { user, loading } = useAuth();
const authed = !loading && !!user;
const [dash, setDash] = useState<SadhnaDashboard | null>(null);
@@ -55,6 +65,35 @@ export function SadhnaStreakCTA() {
? "One offering done — finish today"
: "Chant and post a quote to complete today";
if (compact) {
const active = streak > 0;
return (
<Link
href="/sadhna-streak"
aria-label={`${title}. ${subtitle}`}
title={`${title} — ${subtitle}`}
className={
// An explicit square matching the homepage row's h-24. Deriving the
// width from height (aspect-square + h-full) collapses to the icon in
// Safari, so both sides are fixed.
"group p-2 flex flex-col size-24 shrink-0 items-center justify-center rounded-2xl border transition-colors " +
(active
? "border-primary/30 bg-primary/10 hover:border-primary/50"
: "border-border bg-card hover:border-primary/40 hover:bg-muted/40")
}
>
<Image
src="/icons/chanting-beads.svg"
alt=""
width={44}
height={44}
className="size-12 transition-transform group-hover:scale-105"
unoptimized
/>
</Link>
);
}
return (
<Link
href="/sadhna-streak"