quiz seo image and authguard
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user