feat: add daily vani
This commit is contained in:
+3
-2
@@ -87,9 +87,10 @@ export default function HomePage() {
|
|||||||
— it's free.
|
— it's free.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Daily sādhana streak — a simple entry point for visitors. */}
|
{/* Daily sādhana streak + Vāṇī of the day — entry points for visitors. */}
|
||||||
<div className="mt-6 w-full max-w-md">
|
<div className="mt-6 w-full max-w-md flex flex-col gap-3">
|
||||||
<SadhnaStreakCTA />
|
<SadhnaStreakCTA />
|
||||||
|
<VaniOfTheDayCTA />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -10,9 +10,24 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { ChevronRight, Quote } from "lucide-react";
|
import { ChevronRight } from "lucide-react";
|
||||||
import { getVaniOfTheDay, type Vani } from "@/lib/vani";
|
import { getVaniOfTheDay, type Vani } from "@/lib/vani";
|
||||||
|
|
||||||
|
/** Quote-marks glyph (svgrepo). Inherits color via `currentColor`. */
|
||||||
|
function QuotesIcon({ className }: { className?: string }) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 32 32"
|
||||||
|
fill="currentColor"
|
||||||
|
className={className}
|
||||||
|
aria-hidden
|
||||||
|
>
|
||||||
|
<path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1C9.3,11.8,11,11,13,11z" />
|
||||||
|
<path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5S25.8,13,23,13z" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function VaniOfTheDayCTA() {
|
export function VaniOfTheDayCTA() {
|
||||||
const [vani, setVani] = useState<Vani | null>(null);
|
const [vani, setVani] = useState<Vani | null>(null);
|
||||||
|
|
||||||
@@ -32,27 +47,29 @@ export function VaniOfTheDayCTA() {
|
|||||||
|
|
||||||
if (!vani) return null;
|
if (!vani) return null;
|
||||||
|
|
||||||
|
// Third line: the book name for a verse/chapter, or the label ("Lecture" /
|
||||||
|
// "Conversation") for a transcript.
|
||||||
|
const source =
|
||||||
|
vani.kind === "transcript" ? vani.label : vani.book_title || vani.label;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
href={vani.href}
|
href={vani.href}
|
||||||
className="group flex w-full max-w-md items-center gap-3.5 rounded-2xl border border-border bg-card p-4 text-left transition-colors hover:border-primary/40 hover:bg-muted/40"
|
className="group flex w-full max-w-md items-center gap-3.5 rounded-2xl border border-border bg-card p-4 text-left transition-colors hover:border-primary/40 hover:bg-muted/40"
|
||||||
>
|
>
|
||||||
<span className="inline-flex size-12 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
|
<span className="inline-flex size-12 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
|
||||||
<Quote className="size-6" />
|
<QuotesIcon className="size-6" />
|
||||||
</span>
|
</span>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="flex items-center gap-1.5 text-[0.7rem] font-medium uppercase tracking-[0.14em] text-primary">
|
<p className="text-[0.7rem] font-medium uppercase tracking-[0.14em] text-primary">
|
||||||
Vāṇī of the day
|
Vāṇī of the day
|
||||||
<span className="rounded bg-muted px-1.5 py-0.5 text-[0.65rem] tracking-normal text-muted-foreground">
|
|
||||||
{vani.label}
|
|
||||||
</span>
|
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-0.5 truncate text-base font-semibold text-foreground leading-snug">
|
<p className="mt-0.5 truncate text-base font-semibold text-foreground leading-snug">
|
||||||
{vani.title}
|
{vani.title}
|
||||||
</p>
|
</p>
|
||||||
{vani.subtitle ? (
|
{source ? (
|
||||||
<p className="truncate text-sm text-muted-foreground leading-snug">
|
<p className="truncate text-sm text-muted-foreground leading-snug">
|
||||||
{vani.subtitle}
|
{source}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user