quiz seo image and authguard

This commit is contained in:
gosangam
2026-10-15 21:09:37 +05:30
parent 6a6143ceb2
commit 0e2e0d7300
8 changed files with 602 additions and 447 deletions
+7 -3
View File
@@ -6,7 +6,8 @@
* - "tile": a card that leads the search page's "Start here" row.
* - "banner": a full-width row for the homepage, under sādhana / vāṇī.
*
* Renders nothing until there is at least one published quiz; with
* Signed-in readers only, like quizzes themselves. Renders nothing until
* there is at least one published quiz; with
* `pendingOnly` it also hides once every quiz has been finished, so the
* homepage only nudges when there's something left to do.
*/
@@ -28,9 +29,11 @@ export function QuizzesCTA({
className?: string;
}) {
const { user } = useAuth();
const userId = user?.id;
const [cards, setCards] = useState<QuizCard[] | null>(null);
useEffect(() => {
if (!userId) return;
let cancelled = false;
quiz
.list()
@@ -44,9 +47,10 @@ export function QuizzesCTA({
cancelled = true;
};
// Refetch on sign-in/out: progress is per user.
}, [user?.id]);
}, [userId]);
if (!cards?.length) return null;
// Cards left over from before sign-out are ignored rather than cleared.
if (!user || !cards?.length) return null;
if (pendingOnly && cards.every((c) => c.my.state === "completed")) {
return null;