Fourth revision: OpenRouter, live tool stages, Explain layout, share sections
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
- Interactive blocks are encouraged by default; Explain gets a reduced library and never writes practice questions. - Assistant tool steps breathe while running, show live stages from generation and the Python check, and read in the past tense when done. - The assistant asks before searching the web when class materials do not cover a question; clarifying questions list every class's exams and never ask about format (always NCLEX). - Explain opens beside the question from 900px wide, moving the question left while open and back on the next one. - Generate dialog drops the practice set/exam switch (presets cover it) and the Generate buttons lose their icon. - Python check notes are green when every check passed, applied fixes neutral. - Share pages group by exam, then Quizzes, Flashcards, Notes, Class Materials, hiding empty groups; the class page uses the same order. "Documents" is now "Class Materials". - OpenRouter provider replaces the Ollama type; migration 6 turns Ollama connections into OpenAI-compatible ones at /v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c595e0ff2c
commit
25bc03ea75
45 changed files with 663 additions and 329 deletions
|
|
@ -418,8 +418,8 @@ export default function ClassPage() {
|
|||
};
|
||||
|
||||
// Inside each section, items are grouped under a subheading per type.
|
||||
const KIND_ORDER = ['quiz', 'deck', 'document', 'note'] as const;
|
||||
const KIND_HEADING = { quiz: 'Quizzes', deck: 'Flashcards', document: 'Documents', note: 'Notes' } as const;
|
||||
const KIND_ORDER = ['quiz', 'deck', 'note', 'document'] as const;
|
||||
const KIND_HEADING = { quiz: 'Quizzes', deck: 'Flashcards', document: 'Class Materials', note: 'Notes' } as const;
|
||||
const KIND_HEADING_ICON = { quiz: <BookOpen />, deck: <Layers />, document: <FileText />, note: <NotebookPen /> } as const;
|
||||
const canSort = sort === 'manual' && !query.trim();
|
||||
const persistOrder = (kind: Item['kind']) => async (ids: string[]) => {
|
||||
|
|
@ -500,7 +500,7 @@ export default function ClassPage() {
|
|||
</MenuItem>
|
||||
<MenuSeparator />
|
||||
<MenuItem icon={<Upload />} onSelect={() => fileRef.current?.click()}>
|
||||
Upload documents
|
||||
Upload class materials
|
||||
</MenuItem>
|
||||
<MenuItem icon={<FileText />} onSelect={() => setPasteOpen(true)}>
|
||||
Paste text as a document
|
||||
|
|
@ -555,7 +555,7 @@ export default function ClassPage() {
|
|||
Review {data.due.total}
|
||||
</Button>
|
||||
)}
|
||||
<Button icon={<Sparkles />} onClick={() => setGenerate({})}>
|
||||
<Button onClick={() => setGenerate({})}>
|
||||
Generate
|
||||
</Button>
|
||||
{addMenu}
|
||||
|
|
@ -601,7 +601,7 @@ export default function ClassPage() {
|
|||
action={
|
||||
<>
|
||||
<Button variant="primary" icon={<Upload />} onClick={() => fileRef.current?.click()}>
|
||||
Upload documents
|
||||
Upload class materials
|
||||
</Button>
|
||||
<Button icon={<FileUp />} onClick={() => setImportOpen(true)}>
|
||||
Import
|
||||
|
|
@ -643,8 +643,8 @@ export default function ClassPage() {
|
|||
['all', 'All'],
|
||||
['quiz', 'Quizzes'],
|
||||
['deck', 'Flashcards'],
|
||||
['document', 'Documents'],
|
||||
['note', 'Notes'],
|
||||
['document', 'Class Materials'],
|
||||
] as const
|
||||
).map(([v, label]) => (
|
||||
<button
|
||||
|
|
@ -706,9 +706,9 @@ export default function ClassPage() {
|
|||
action={
|
||||
<>
|
||||
<Button variant="primary" icon={<Upload />} onClick={() => fileRef.current?.click()}>
|
||||
Upload documents
|
||||
Upload class materials
|
||||
</Button>
|
||||
<Button icon={<Sparkles />} onClick={() => setGenerate({})}>
|
||||
<Button onClick={() => setGenerate({})}>
|
||||
Generate
|
||||
</Button>
|
||||
</>
|
||||
|
|
@ -917,7 +917,7 @@ function ExamTabs({
|
|||
return (
|
||||
<div className="mb-4 flex flex-wrap items-center gap-3 rounded-[14px] border border-dashed border-line-strong px-4 py-3 text-[13.5px] text-ink-2">
|
||||
<FolderIcon className="size-4 shrink-0 text-tab" />
|
||||
<span className="min-w-0 flex-1">Divide this class into {noun}s so each keeps its own documents, quizzes and flashcards, and generating uses only that {noun}'s material.</span>
|
||||
<span className="min-w-0 flex-1">Divide this class into {noun}s so each keeps its own class materials, quizzes and flashcards, and generating uses only that {noun}'s material.</span>
|
||||
<Button size="sm" icon={<Plus />} onClick={onNew}>
|
||||
New {noun}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ export default function DeckPage() {
|
|||
{cards.length === 0 ? (
|
||||
<div className="card mb-3 border-dashed">
|
||||
<EmptyState icon={<Layers />} title="No cards yet">
|
||||
Add your first card below, paste a list, or generate cards from your class documents.
|
||||
Add your first card below, paste a list, or generate cards from your class materials.
|
||||
</EmptyState>
|
||||
</div>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
|
||||
import { BookOpen, ChevronRight, Columns2, Download, FileText, FolderInput, Layers, MessageSquare, MoreHorizontal, NotebookPen, Pencil, RefreshCw, ScanText, Share2, Sparkles, Trash2, TriangleAlert } from 'lucide-react';
|
||||
import { BookOpen, ChevronRight, Columns2, Download, FileText, FolderInput, Layers, MessageSquare, MoreHorizontal, NotebookPen, Pencil, RefreshCw, ScanText, Share2, Trash2, TriangleAlert } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link, useNavigate, useParams, useSearchParams } from 'react-router';
|
||||
import { toast } from 'sonner';
|
||||
|
|
@ -186,7 +186,7 @@ export default function DocumentPage() {
|
|||
</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Button variant="primary" icon={<Sparkles />} disabled={!ready || doc.chunkCount === 0} onClick={() => setGenerate({ documentIds: [doc.id] })}>
|
||||
<Button variant="primary" disabled={!ready || doc.chunkCount === 0} onClick={() => setGenerate({ documentIds: [doc.id] })}>
|
||||
Generate
|
||||
</Button>
|
||||
<Button icon={<MessageSquare />} disabled={!ready || doc.chunkCount === 0} onClick={() => assistant.open({ documentIds: [doc.id], classId: doc.classId, newChat: true })}>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { BookOpen, Check, ChevronRight, CircleAlert, Eye, FileText, Layers, NotebookPen, Pencil, Plus, Sparkles, Trash2, TriangleAlert } from 'lucide-react';
|
||||
import { BookOpen, Check, ChevronRight, CircleAlert, CircleCheck, Eye, FileText, Layers, NotebookPen, Pencil, Plus, Sparkles, Trash2, TriangleAlert, Wrench } from 'lucide-react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router';
|
||||
import { toast } from 'sonner';
|
||||
|
|
@ -269,11 +269,14 @@ export default function DraftPage() {
|
|||
{draft.error} What was written before that is below.
|
||||
</Callout>
|
||||
)}
|
||||
{(draft.meta.notes ?? []).map((n, i) => (
|
||||
<Callout key={i} tone="warn" icon={<TriangleAlert />} className="mb-4 py-2.5">
|
||||
{n}
|
||||
</Callout>
|
||||
))}
|
||||
{(draft.meta.notes ?? []).map((n, i) => {
|
||||
const tone = noteTone(n);
|
||||
return (
|
||||
<Callout key={i} tone={tone} icon={tone === 'good' ? <CircleCheck /> : tone === 'neutral' ? <Wrench /> : <TriangleAlert />} className="mb-4 py-2.5">
|
||||
{n}
|
||||
</Callout>
|
||||
);
|
||||
})}
|
||||
{badItems.size > 0 && (
|
||||
<Callout
|
||||
tone="bad"
|
||||
|
|
@ -512,3 +515,14 @@ export default function DraftPage() {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generation notes are plain strings. A clean Python check reads as good news, a fix that was
|
||||
* applied as information, and everything else (failed checks, skipped batches) as a warning.
|
||||
*/
|
||||
function noteTone(note: string): 'good' | 'neutral' | 'warn' {
|
||||
const checked = /^Checked with Python[^:]*: (\d+) of (\d+) checks passed/.exec(note);
|
||||
if (checked) return checked[1] === checked[2] ? 'good' : 'warn';
|
||||
if (/^Question \d+( removed|: (answer|type|topic))/.test(note) && !/not applied|incomplete|does not exist/.test(note)) return 'neutral';
|
||||
return 'warn';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function Onboarding({ hasClass, aiReady, onNewClass }: { hasClass: boolean; aiRe
|
|||
const steps = [
|
||||
{ done: hasClass, title: 'Create a class', body: 'One for each course. Everything else lives inside it.', action: <Button size="sm" variant="primary" icon={<Plus />} onClick={onNewClass}>New class</Button> },
|
||||
{ done: false, title: 'Add material', body: 'Import quizzes and flashcards, write your own, or upload lecture slides and notes.', action: hasClass ? <span className="text-[13px] text-ink-3">Open a class to add material</span> : null },
|
||||
{ done: aiReady, title: 'Connect an AI model', body: 'Optional. Lets Study Desk write questions from your documents and explain answers.', action: <Link to="/settings/ai" className="text-[13px] font-medium text-accent hover:underline">Open AI settings</Link> },
|
||||
{ done: aiReady, title: 'Connect an AI model', body: 'Optional. Lets Study Desk write questions from your class materials and explain answers.', action: <Link to="/settings/ai" className="text-[13px] font-medium text-accent hover:underline">Open AI settings</Link> },
|
||||
];
|
||||
return (
|
||||
<div className="card overflow-hidden">
|
||||
|
|
|
|||
|
|
@ -598,12 +598,12 @@ export default function QuizPage() {
|
|||
Paste several
|
||||
</Button>
|
||||
<Button icon={<Sparkles />} onClick={() => navigate(`/classes/${quiz.classId}`)}>
|
||||
Generate from documents
|
||||
Generate from class materials
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
Write questions one at a time, paste a batch as text, or generate them from your class documents.
|
||||
Write questions one at a time, paste a batch as text, or generate them from your class materials.
|
||||
</EmptyState>
|
||||
</div>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ function SharingSettings() {
|
|||
))}
|
||||
</ul>
|
||||
)}
|
||||
<p className="mt-2.5 text-xs text-ink-3">Visitors can only read and study what a link points to. They cannot edit anything, see other content, or affect your progress. Uploaded documents are shared only when you share the document itself.</p>
|
||||
<p className="mt-2.5 text-xs text-ink-3">Visitors can only read and study what a link points to. They cannot edit anything, see other content, or affect your progress. Class materials are shared only with the class or exam they belong to, or when you share the file itself.</p>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
|
@ -425,7 +425,7 @@ function DataSettings() {
|
|||
['Classes', sys.counts.classes],
|
||||
['Questions', sys.counts.questions],
|
||||
['Flashcards', sys.counts.cards],
|
||||
['Documents', sys.counts.documents],
|
||||
['Class materials', sys.counts.documents],
|
||||
].map(([k, v]) => (
|
||||
<div key={k as string}>
|
||||
<dt className="text-ink-3">{k}</dt>
|
||||
|
|
|
|||
|
|
@ -480,8 +480,13 @@ function SharedDocument({ doc, token, nested, back }: { doc: PublicDocument; tok
|
|||
|
||||
const ITEM_ICON = { quiz: <BookOpen />, deck: <Layers />, note: <NotebookPen />, document: <FileText /> };
|
||||
|
||||
/** The same order and names as the owner's class page; a type with nothing in it is left out. */
|
||||
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 }) {
|
||||
const groups = [{ id: null as string | null, name: '' }, ...data.folders].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);
|
||||
// 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 (
|
||||
<Frame>
|
||||
<div className={cx('border-l-[5px] border-tab pl-4', `tab-${data.color}`)}>
|
||||
|
|
@ -493,22 +498,36 @@ function SharedCollection({ data, token }: { data: PublicCollection; token: stri
|
|||
<div className="card mt-8 p-6 text-sm text-ink-2">Nothing has been added here yet.</div>
|
||||
) : (
|
||||
groups.map((g) => (
|
||||
<section key={g.id ?? 'none'} className="mt-7">
|
||||
{g.name && <h2 className="eyebrow mb-2.5">{g.name}</h2>}
|
||||
<ul className="card divide-y divide-line overflow-hidden">
|
||||
{g.items.map((i) => (
|
||||
<li key={`${i.kind}:${i.id}`}>
|
||||
<Link to={`/s/${token}/${i.kind}/${i.id}`} className="flex items-center gap-3 px-4 py-3.5 hover:bg-ink/4">
|
||||
<span className={cx('grid size-10 shrink-0 place-items-center rounded-[11px] [&>svg]:size-[18px]', i.kind === 'quiz' ? 'bg-accent-soft text-accent' : i.kind === 'deck' ? 'bg-marker/45 text-ink dark:bg-marker/20 dark:text-marker' : i.kind === 'document' ? 'bg-sunken text-ink-2' : 'bg-good-soft text-good')}>{ITEM_ICON[i.kind]}</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-[15px] font-medium">{i.title}</span>
|
||||
<span className="text-xs text-ink-3">{i.kind === 'quiz' ? plural(i.count, 'question') : i.kind === 'deck' ? plural(i.count, 'card') : i.kind === 'document' ? `Document${i.count ? ` · ${plural(i.count, 'page')}` : ''}` : 'Note'}</span>
|
||||
</span>
|
||||
<ChevronRight className="size-4 text-ink-3" />
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<section key={g.id ?? 'none'} className="mt-7" aria-label={g.name || undefined}>
|
||||
{g.name && groups.length > 1 && <h2 className="mb-2.5 text-[17px] font-semibold">{g.name}</h2>}
|
||||
<div className="card overflow-hidden">
|
||||
{KIND_ORDER.filter((k) => g.items.some((i) => i.kind === k)).map((k, n) => {
|
||||
const items = g.items.filter((i) => i.kind === k);
|
||||
return (
|
||||
<section key={k} aria-label={KIND_HEADING[k]}>
|
||||
<h3 className={cx('eyebrow flex items-center gap-2 border-b border-line bg-sunken/60 px-4 py-2 [&>svg]:size-3.5', n > 0 && 'border-t')}>
|
||||
{ITEM_ICON[k]}
|
||||
{KIND_HEADING[k]}
|
||||
<span className="num font-normal">{items.length}</span>
|
||||
</h3>
|
||||
<ul className="divide-y divide-line">
|
||||
{items.map((i) => (
|
||||
<li key={`${i.kind}:${i.id}`}>
|
||||
<Link to={`/s/${token}/${i.kind}/${i.id}`} className="flex items-center gap-3 px-4 py-3.5 hover:bg-ink/4">
|
||||
<span className={cx('grid size-10 shrink-0 place-items-center rounded-[11px] [&>svg]:size-[18px]', i.kind === 'quiz' ? 'bg-accent-soft text-accent' : i.kind === 'deck' ? 'bg-marker/45 text-ink dark:bg-marker/20 dark:text-marker' : i.kind === 'document' ? 'bg-sunken text-ink-2' : 'bg-good-soft text-good')}>{ITEM_ICON[i.kind]}</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-[15px] font-medium">{i.title}</span>
|
||||
<span className="text-xs text-ink-3">{i.kind === 'quiz' ? plural(i.count, 'question') : i.kind === 'deck' ? plural(i.count, 'card') : i.kind === 'document' ? (i.count ? plural(i.count, 'page') : 'File') : 'Note'}</span>
|
||||
</span>
|
||||
<ChevronRight className="size-4 text-ink-3" />
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
))
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue