Share-link generation and med math on request
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 34s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 34s
- Visitors of class and exam links can generate NCLEX-style quizzes (default and maximum 50 questions, 25% select-all, Python-checked, optional 5 med math questions) and flashcard sets from chosen class materials, once the owner turns it on for the link. - 4 quizzes and 2 flashcard sets per link per day; failed attempts do not count; "Reset limits" in the share dialog gives a fresh allowance. - Sets are drafts tied to the link (migration 7): listed for every visitor, explainable, kept off the owner's drafts list, and reviewable or savable from the share dialog. - Generate gains "Include med math" with a count (default 5): exactly that many dosage calculation questions at the chosen difficulty, spread through the quiz, even when the material has none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
25bc03ea75
commit
e945f589ce
16 changed files with 807 additions and 44 deletions
|
|
@ -6,9 +6,10 @@ import { isFullyCorrect, scoreQuestion, seededShuffle } from '@shared/content';
|
|||
import { Explain } from '@/features/Explain';
|
||||
import { CramSession, freshCramState, reconcileCramState, type CramState } from '@/features/flashcards';
|
||||
import { SharedAssistant } from '@/features/SharedAssistant';
|
||||
import { SharedGenerate } from '@/features/SharedGenerate';
|
||||
import { QuizResults, QuizRunner } from '@/features/quiz';
|
||||
import { api, ApiError } from '@/lib/api';
|
||||
import type { AnswerState, PublicCollection, PublicDeck, PublicDocument, PublicNote, PublicPayload, PublicQuiz, SnapshotQuestion } from '@/lib/types';
|
||||
import type { AnswerState, PublicCollection, PublicDeck, PublicDocument, PublicNote, PublicPayload, PublicQuiz, ShareAi, SnapshotQuestion } from '@/lib/types';
|
||||
import { cx, formatBytes, plural, useDocumentTitle, useLocalStorage, useMediaQuery, useTheme } from '@/lib/util';
|
||||
import { Markdown } from '@/ui/Markdown';
|
||||
import { Button, EmptyState, IconButton, Input, PageLoading, Segmented, Switch } from '@/ui';
|
||||
|
|
@ -484,7 +485,7 @@ const ITEM_ICON = { quiz: <BookOpen />, deck: <Layers />, note: <NotebookPen />,
|
|||
const KIND_ORDER = ['quiz', 'deck', 'note', 'document'] as const;
|
||||
const KIND_HEADING = { quiz: 'Quizzes', deck: 'Flashcards', note: 'Notes', document: 'Class Materials' } as const;
|
||||
|
||||
function SharedCollection({ data, token }: { data: PublicCollection; token: string }) {
|
||||
function SharedCollection({ data, token }: { data: PublicCollection & { ai?: ShareAi }; token: string }) {
|
||||
// One section per exam in the class's order; material outside any exam comes last.
|
||||
const groups = [...data.folders, { id: null as string | null, name: 'Other' }].map((f) => ({ ...f, items: data.items.filter((i) => (f.id === null ? !i.folderId || !data.folders.some((x) => x.id === i.folderId) : i.folderId === f.id)) })).filter((g) => g.items.length > 0);
|
||||
return (
|
||||
|
|
@ -494,6 +495,7 @@ function SharedCollection({ data, token }: { data: PublicCollection; token: stri
|
|||
<h1 className="display text-[32px] sm:text-[40px]">{data.title}</h1>
|
||||
{data.description && <p className="mt-2 text-[15px] text-ink-2">{data.description}</p>}
|
||||
</div>
|
||||
{data.ai?.generate && <SharedGenerate token={token} data={data} />}
|
||||
{groups.length === 0 ? (
|
||||
<div className="card mt-8 p-6 text-sm text-ink-2">Nothing has been added here yet.</div>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue