Second revision: MCP servers, shared-link AI, flashcard modes, document previews
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s
Generation - Every quiz is NCLEX style; "Practice exam" writes 50 questions. - Calculation questions only when the material involves calculations (max 5 per exam). - Broad topics: the class's topics are listed in the prompt, a quick grouping call maps narrow labels onto broad ones, and leftover variants are merged. - Exact select-all count per batch; option order shuffled. - Python check: at most 3 runs, fixed problems count as passed, cosmetic remarks ignored. Assistant - Text, tool steps and cards appear in the order they happen, with paragraph breaks between steps. - Optional thinking box: fixed height, follows the newest text, can be scrolled back. - "+" opens a material picker listing recent items; items can be dragged in from class pages; shorter placeholder. MCP servers - Streamable HTTP client; encrypted headers. - Per-server instructions and switches for chat, Explain, generation and the quiz check. - Settings UI. Share links - Optional "Explain this" and "Ask about this material" per link, off by default. - Items are loaded on the server and checked against the share; no tools; rate-limited. - Migration 4 stores the switches. Study and documents - Standard flashcard mode (optionally repeat missed cards until known) next to spaced repetition. - Streak visuals restyled in the app palette. - Side by side / Original document views, with sandboxed previews of Word and PowerPoint files. Other - Built-in embedding model baked into the image; sharp stubbed if it cannot load; real load error shown in Settings. - Python runner blocks network and process modules in JavaScript too. - "View questions and answers" removed from the quiz start screen. - Docs updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ea61c882c
commit
031f7bec31
45 changed files with 2918 additions and 397 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { ArrowLeft, Check, Lightbulb, RotateCcw, Shuffle, SkipForward, X } from 'lucide-react';
|
||||
import { useCallback, useEffect, useId, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';
|
||||
import { ArrowLeft, Check, Flame, Lightbulb, RotateCcw, Shuffle, SkipForward, X } from 'lucide-react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';
|
||||
import { cx, plural, shuffle, useHotkeys } from '@/lib/util';
|
||||
import { Markdown } from '@/ui/Markdown';
|
||||
import { Button, IconButton, ProgressBar } from '@/ui';
|
||||
|
|
@ -14,49 +14,31 @@ export const STREAK_HOT = 5;
|
|||
export const isStreakMilestone = (n: number) => n === 5 || (n >= 10 && n % 10 === 0);
|
||||
export const streakTier = (n: number): StreakTier => (n >= 20 ? 3 : n >= 10 ? 2 : 1);
|
||||
const BURST_MS: Record<StreakTier, number> = { 1: 1600, 2: 1900, 3: 2400 };
|
||||
const BURST_COPY: Record<StreakTier, string> = { 1: 'On fire', 2: 'Blazing', 3: 'Unstoppable' };
|
||||
|
||||
export function FlameIcon({ className }: { className?: string }) {
|
||||
const id = `flame-${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
|
||||
return (
|
||||
<svg className={className} viewBox="0 0 24 24" aria-hidden focusable="false">
|
||||
<defs>
|
||||
<linearGradient id={id} x1="0" y1="1" x2="0" y2="0">
|
||||
<stop offset="0%" stopColor="#ea580c" />
|
||||
<stop offset="55%" stopColor="#fb923c" />
|
||||
<stop offset="100%" stopColor="#fbbf24" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
fill={`url(#${id})`}
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.177A7.547 7.547 0 0 1 6.648 6.61a.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.547 3.75 3.75 0 0 1 3.255 3.719Z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
const BURST_COPY: Record<StreakTier, string> = { 1: 'On a roll', 2: 'Hot streak', 3: 'Unstoppable' };
|
||||
|
||||
export function StreakChip({ streak }: { streak: number }) {
|
||||
if (streak < 2) return null;
|
||||
const hot = streak >= STREAK_HOT;
|
||||
return (
|
||||
<span key={hot ? 'hot' : 'warm'} className={cx('streak-chip inline-flex h-6 items-center gap-1 rounded-full px-2.5 text-xs font-bold whitespace-nowrap', hot ? 'streak-chip-hot' : 'bg-ink/7 text-ink-2')}>
|
||||
{hot && <FlameIcon className="size-3.5 shrink-0" />}
|
||||
<span key={hot ? 'hot' : 'warm'} className={cx('streak-chip num inline-flex h-6 items-center gap-1 rounded-full px-2.5 text-xs font-semibold whitespace-nowrap', hot ? 'streak-chip-hot' : 'bg-ink/7 text-ink-2')}>
|
||||
{hot && <Flame className="size-3.5 shrink-0" strokeWidth={2.4} />}
|
||||
{streak} in a row
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Milestone moment: the count, marked with a highlighter stroke, in the app's own type and colours. */
|
||||
function StreakBurst({ streak, tier }: { streak: number; tier: StreakTier }) {
|
||||
const flame = { 1: 'size-16', 2: 'size-24', 3: 'size-36 md:size-44' }[tier];
|
||||
const heading = { 1: 'text-lg', 2: 'text-2xl', 3: 'text-4xl md:text-5xl' }[tier];
|
||||
const size = { 1: 'text-6xl', 2: 'text-7xl', 3: 'text-8xl md:text-9xl' }[tier];
|
||||
return (
|
||||
<div className="streak-scrim pointer-events-none absolute inset-0 z-30 flex items-center justify-center rounded-[24px]" style={{ '--streak-ms': `${BURST_MS[tier]}ms` } as CSSProperties} role="status" aria-live="polite">
|
||||
<div className="streak-pop flex flex-col items-center">
|
||||
<FlameIcon className={cx('streak-flame', flame)} />
|
||||
<span className={cx('streak-heading mt-1 font-black tracking-wide uppercase', heading)}>{BURST_COPY[tier]}</span>
|
||||
<span className="mt-1 text-sm font-semibold text-ink">{streak} in a row</span>
|
||||
<div className="streak-pop flex flex-col items-center text-center">
|
||||
<span className="flex items-center gap-1.5 text-xs font-semibold tracking-[0.16em] text-accent uppercase">
|
||||
<Flame className="streak-flame size-4" strokeWidth={2.4} />
|
||||
{BURST_COPY[tier]}
|
||||
</span>
|
||||
<span className={cx('streak-mark num mt-2 px-4 leading-none font-semibold tracking-tight text-ink', size)}>{streak}</span>
|
||||
<span className="mt-2 font-serif text-xl text-ink-2 italic">in a row</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -250,6 +232,10 @@ export interface CramState {
|
|||
shuffled: boolean;
|
||||
/** Which pass this is: 1 = whole deck, 2+ = cards still being learned. */
|
||||
round: number;
|
||||
/** Standard mode option: a missed card goes to the back of the pile until it is known. */
|
||||
repeatMissed?: boolean;
|
||||
/** Cards that were missed at least once in this session (repeat mode). */
|
||||
retried?: string[];
|
||||
}
|
||||
|
||||
export interface CramCard {
|
||||
|
|
@ -259,9 +245,9 @@ export interface CramCard {
|
|||
hint?: string;
|
||||
}
|
||||
|
||||
export function freshCramState(cards: CramCard[], shuffled: boolean, round = 1): CramState {
|
||||
export function freshCramState(cards: CramCard[], shuffled: boolean, round = 1, repeatMissed = false): CramState {
|
||||
const ids = cards.map((c) => c.id);
|
||||
return { order: shuffled ? shuffle(ids) : ids, index: 0, known: [], unknown: [], shuffled, round };
|
||||
return { order: shuffled ? shuffle(ids) : ids, index: 0, known: [], unknown: [], shuffled, round, repeatMissed, retried: [] };
|
||||
}
|
||||
|
||||
/** Drops cards that no longer exist and clamps the position, so a saved session survives deck edits. */
|
||||
|
|
@ -277,6 +263,8 @@ export function reconcileCramState(state: CramState | null | undefined, cards: C
|
|||
unknown: (state.unknown ?? []).filter((id) => valid.has(id)),
|
||||
shuffled: Boolean(state.shuffled),
|
||||
round: state.round ?? 1,
|
||||
repeatMissed: Boolean(state.repeatMissed),
|
||||
retried: (state.retried ?? []).filter((id) => valid.has(id)),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -328,9 +316,13 @@ export function CramSession({
|
|||
setLeaving(known ? 'right' : 'left');
|
||||
record(known);
|
||||
onGrade?.(card.id, known);
|
||||
// Repeat mode: a missed card goes to the back of the pile and comes round again.
|
||||
const requeue = !known && state.repeatMissed;
|
||||
const next: CramState = {
|
||||
...state,
|
||||
index: state.index + 1,
|
||||
order: requeue ? [...state.order, card.id] : state.order,
|
||||
retried: requeue ? [...new Set([...(state.retried ?? []), card.id])] : state.retried,
|
||||
known: known ? [...state.known.filter((x) => x !== card.id), card.id] : state.known.filter((x) => x !== card.id),
|
||||
unknown: known ? state.unknown.filter((x) => x !== card.id) : [...state.unknown.filter((x) => x !== card.id), card.id],
|
||||
};
|
||||
|
|
@ -339,7 +331,7 @@ export function CramSession({
|
|||
const move = (delta: number) => !busy && onState({ ...state, index: Math.max(0, Math.min(total, state.index + delta)) });
|
||||
const restart = (shuffled = state.shuffled) => {
|
||||
reset();
|
||||
onState(freshCramState(cards, shuffled));
|
||||
onState(freshCramState(cards, shuffled, 1, state.repeatMissed));
|
||||
};
|
||||
const shuffleRemaining = () => {
|
||||
if (busy) return;
|
||||
|
|
@ -351,7 +343,7 @@ export function CramSession({
|
|||
};
|
||||
const studyUnknown = () => {
|
||||
reset();
|
||||
onState(freshCramState(cards.filter((c) => state.unknown.includes(c.id)), true, state.round + 1));
|
||||
onState(freshCramState(cards.filter((c) => state.unknown.includes(c.id)), true, state.round + 1, state.repeatMissed));
|
||||
};
|
||||
|
||||
useHotkeys({
|
||||
|
|
@ -371,7 +363,7 @@ export function CramSession({
|
|||
<div className="flex min-h-dvh flex-col bg-paper">
|
||||
<StudyTopBar
|
||||
title={title}
|
||||
subtitle={subtitle ?? (state.round > 1 ? `Round ${state.round}: still learning` : 'Browse')}
|
||||
subtitle={subtitle ?? (state.round > 1 ? `Round ${state.round}: still learning` : state.repeatMissed ? 'Standard · missed cards repeat' : 'Standard')}
|
||||
onExit={onExit}
|
||||
exitLabel={exitLabel}
|
||||
progress={total ? Math.min(1, state.index / total) : 0}
|
||||
|
|
@ -398,7 +390,9 @@ export function CramSession({
|
|||
</div>
|
||||
<h2 className="display text-[28px]">{state.unknown.length === 0 ? 'You know them all' : 'Round complete'}</h2>
|
||||
<p className="mt-2 text-[15px] text-ink-2">
|
||||
{state.known.length} known{state.unknown.length > 0 ? `, ${state.unknown.length} still learning` : ''} out of {plural(total, 'card')}.
|
||||
{state.repeatMissed
|
||||
? `All ${plural(state.known.length, 'card')} known${state.retried?.length ? `; ${state.retried.length} took more than one try` : ' on the first try'}.`
|
||||
: `${state.known.length} known${state.unknown.length > 0 ? `, ${state.unknown.length} still learning` : ''} out of ${plural(total, 'card')}.`}
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap justify-center gap-2">
|
||||
{state.unknown.length > 0 && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue