Fifth revision: share-link AI safety, sturdier generation, cleaner UI
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s

- Malformed model JSON is sent back for repair, then retried; a failed job
  starts over once before it fails. Visitors can dismiss failed sets.
- Generated sets get a short distinct name and description; flashcards are
  atomic and have no hints; standard study shows known/learning counts.
- Share links: "In progress" list, finished sets join the normal lists with a
  "New" tag, plain progress steps, newest exam first.
- Share-link AI expires after a week, can be limited to the US or Arizona
  (DB-IP Lite or Cloudflare headers) and is locked by abuse protection
  (migration 8).
- The assistant never answers from general knowledge; MCP and web search
  tools load without a manual test.
- Plain-text copy, no question count in exam mode, filler text removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 09:17:50 -07:00
parent d8df5edf30
commit 85d5c9186d
46 changed files with 1242 additions and 283 deletions

View file

@ -42,7 +42,8 @@ function useStartOptions(quizId: string, total: number, active: boolean) {
source: { type: 'quiz', quizId },
shuffleQuestions: prefs.shuffleQuestions,
shuffleOptions: prefs.shuffleOptions,
count: count < total ? count : undefined,
// An exam is always the whole quiz.
count: prefs.mode === 'practice' && count < total ? count : undefined,
// A time limit is an exam option only; practice sessions are never timed.
timeLimitMin: prefs.mode === 'exam' && timed ? minutes : null,
});
@ -53,35 +54,27 @@ function StartOptionsFields({ o }: { o: ReturnType<typeof useStartOptions> }) {
const { prefs, setPrefs, count, setCount, timed, setTimed, minutes, setMinutes, total } = o;
return (
<div className="space-y-5">
<div className="grid grid-cols-2 gap-2" role="radiogroup" aria-label="Mode">
{(
[
{ v: 'practice', title: 'Practice', body: 'Check each answer as you go and read the rationale right away.' },
{ v: 'exam', title: 'Exam', body: 'No feedback until you submit. Flag questions and come back to them.' },
] as const
).map((m) => (
<button
key={m.v}
type="button"
role="radio"
aria-checked={prefs.mode === m.v}
onClick={() => setPrefs((p) => ({ ...p, mode: m.v }))}
className={cx('rounded-xl border p-3.5 text-left transition-colors', prefs.mode === m.v ? 'border-accent bg-accent-soft' : 'border-line-strong hover:border-ink-3')}
>
<div className="font-semibold">{m.title}</div>
<div className="mt-1 text-[13px] leading-snug text-ink-2">{m.body}</div>
</button>
))}
</div>
<Field label={`Questions: ${count === total ? `all ${total}` : `${count} of ${total}`}`}>
<input type="range" min={1} max={total} value={count} onChange={(e) => setCount(Number(e.target.value))} className="mt-1 w-full accent-[var(--accent)]" disabled={total <= 1} />
</Field>
<Segmented
label="Mode"
value={prefs.mode}
onChange={(mode) => setPrefs((p) => ({ ...p, mode }))}
options={[
{ value: 'practice', label: 'Practice' },
{ value: 'exam', label: 'Exam' },
]}
className="w-full"
/>
{prefs.mode === 'practice' && (
<Field label={`Questions: ${count === total ? `all ${total}` : `${count} of ${total}`}`}>
<input type="range" min={1} max={total} value={count} onChange={(e) => setCount(Number(e.target.value))} className="mt-1 w-full accent-[var(--accent)]" disabled={total <= 1} />
</Field>
)}
<div className="space-y-4 rounded-xl border border-line p-4">
<Switch checked={prefs.shuffleQuestions} onChange={(v) => setPrefs((p) => ({ ...p, shuffleQuestions: v }))} label="Shuffle questions" />
<Switch checked={prefs.shuffleOptions} onChange={(v) => setPrefs((p) => ({ ...p, shuffleOptions: v }))} label="Shuffle answer choices" description='"All of the above" style choices stay last.' />
<Switch checked={prefs.shuffleOptions} onChange={(v) => setPrefs((p) => ({ ...p, shuffleOptions: v }))} label="Shuffle answer choices" />
{prefs.mode === 'exam' && (
<>
<Switch checked={timed} onChange={setTimed} label="Time limit" description="The exam submits itself when time runs out." />
<Switch checked={timed} onChange={setTimed} label="Time limit" />
{timed && (
<div className="flex items-center gap-2">
<Timer className="size-4 text-ink-3" />