- {quizzes.map((q) => {
- const info = details[q.reference_id];
- const courseInfo = lockedInfo[q.reference_id];
- const isLocked = locked[q.reference_id];
- const isUnavailable = unavailable[q.reference_id];
- const isFetching = fetching[q.reference_id];
- const passed = info?.has_passed || q.completed;
-
- if (isLocked) {
- return (
-
navigate('/plans')}
- className="bg-card rounded-2xl border border-dashed p-4 flex flex-col gap-3 hover:bg-muted/60 hover:shadow-sm transition-all cursor-pointer group w-80 shrink-0 opacity-80"
- >
-
-
{q.title}
-
- Subscribe to {courseInfo?.title ?? 'this course'} to unlock this quiz.
-
-
-
-
-
- );
- }
-
- if (isUnavailable) {
- return (
-
-
-
- Quiz
-
- Unavailable
-
-
-
{q.title}
-
This quiz is no longer available.
-
- );
- }
-
- return (
-
!isFetching && setSelected(q)}
- className={`bg-card rounded-2xl border p-4 flex flex-col gap-3 transition-all w-80 shrink-0 ${
- isFetching ? 'opacity-60 cursor-wait' : 'hover:bg-muted/60 hover:shadow-sm cursor-pointer group'
- }`}
- >
-
-
-
Quiz
-
- {info?.unit?.course?.subscription
- ?
- : isFetching && Loading…
- }
-
-
- {info?.unit?.title && (
-
- in {info.unit.title}
-
- )}
-
{q.title}
-
- {passed ? (
-
- Passed
-
- ) : (
- Not Attempted
- )}
- {info?.passing_score && (
- {info.passing_score}% to pass
- )}
-
-
- );
- })}
-
-