freezmo/components/homework/HomeworkLoading.tsx
Martin Dvorak 2d4d4ee776 One loading screen everywhere (the deck wizard's)
The deck wizard had the good one — app icon, rotating stage message as the
headline, progress bar, stage checklist, tip, Cancel — while homework showed
a spinner with a title and route loads a pulsing icon with a smaller line.
All of them now render components/LoadingState:

- the wizard passes its vision/generation stages and keeps its deck tips;
- homework passes the same shape with homework wording (no tips: they are
  deck-specific);
- route screens (review/stats/exam loading boundaries + the link overlay)
  pass a single message, no stages or progress.

Cancel stays a 44px touch target, the icon animation respects
prefers-reduced-motion, and the unused homework.loading.title string is
gone from both languages.

Suites: freeze-loading 6/6, review 18/18, wizard 88/88, mobile 105/105,
regression 38/38, native 31/31, phase-2 62/62, phase-3 30/30, i18n 13/13.
README: decision 60. SW -> freezmo-v47.
2026-10-12 18:43:53 +00:00

43 lines
1.2 KiB
TypeScript

"use client";
import { LoadingState, type LoadingStage } from "@/components/LoadingState";
import type { HomeworkProgress } from "@/lib/client-api";
import type { HomeworkMode } from "@/lib/schemas";
/**
* Loading state while the assignment is read and answered — the same screen
* as the deck wizard (components/LoadingState), with the homework wording.
*/
export function HomeworkLoading({
progress,
mode,
onCancel,
}: {
progress: HomeworkProgress;
mode: HomeworkMode;
onCancel: () => void;
}) {
const generationKey =
mode === "make" ? "homework.loading.writing" : mode === "check" ? "homework.loading.checking" : "homework.loading.planning";
const stages: LoadingStage[] = [
{
id: "vision",
labelKey: "homework.loading.reading",
messageKeys: ["homework.loading.reading", "homework.loading.vision2"],
},
{
id: "generation",
labelKey: generationKey,
messageKeys: [generationKey, "homework.loading.gen2", "homework.loading.gen3"],
},
];
return (
<LoadingState
stages={stages}
activeStage={progress.stage}
message={progress.message}
onCancel={onCancel}
/>
);
}