Add much more practice content to every section
Hoeren 28 exercises, Lesen 22 texts, Schreiben 24 tasks, Sprechen 20 topics + 8 planning tasks + 10 presentations, Grammatik 20 lessons with ~260 exercises and a random drill, 332 words with gap-fill, plural and hat/ist drills.
This commit is contained in:
1 parent
1f1d28a34d
commit
c754477f07
16 files changed
+2054
-17
No files matched your search
+100
-1
@@ -9,12 +9,16 @@ import { addXp, getProgress, recordResult, reviewCard, todayStr, useProgress } f
|
||||
import { speak } from "@/lib/speech";
|
||||
import { sfx } from "@/lib/sfx";
|
||||
import { fireConfetti } from "@/components/AppShell";
|
||||
import { gapFillQuestions, perfektQuestions, pluralQuestions, type DrillQ } from "@/lib/drills";
|
||||
|
||||
type Mode = "karten" | "quiz" | "artikel" | "memory" | "liste";
|
||||
type Mode = "karten" | "quiz" | "luecke" | "plural" | "perfekt" | "artikel" | "memory" | "liste";
|
||||
|
||||
const modes: { id: Mode; de: string; ar: string }[] = [
|
||||
{ id: "karten", de: "🃏 Karteikarten", ar: "البطاقات" },
|
||||
{ id: "quiz", de: "🎯 Quiz", ar: "اختبار" },
|
||||
{ id: "luecke", de: "✏️ Lückentext", ar: "املأ الفراغ" },
|
||||
{ id: "plural", de: "🔢 Plural", ar: "الجمع" },
|
||||
{ id: "perfekt", de: "⏮️ hat/ist", ar: "الماضي التام" },
|
||||
{ id: "artikel", de: "⚡ der/die/das", ar: "لعبة الأدوات" },
|
||||
{ id: "memory", de: "🧠 Memory", ar: "لعبة الذاكرة" },
|
||||
{ id: "liste", de: "📚 Wortliste", ar: "قائمة الكلمات" },
|
||||
@@ -84,6 +88,8 @@ export default function WortschatzPage() {
|
||||
<Flashcards words={words} onRestart={() => setKey((k) => k + 1)} />
|
||||
) : mode === "quiz" ? (
|
||||
<VocabQuiz words={words} topic={topic} onRestart={() => setKey((k) => k + 1)} />
|
||||
) : mode === "luecke" || mode === "plural" || mode === "perfekt" ? (
|
||||
<McDrill words={words} mode={mode} onRestart={() => setKey((k) => k + 1)} />
|
||||
) : mode === "artikel" ? (
|
||||
<ArticleGame words={words} onRestart={() => setKey((k) => k + 1)} />
|
||||
) : mode === "memory" ? (
|
||||
@@ -317,6 +323,99 @@ function VocabQuiz({ words, topic, onRestart }: { words: Word[]; topic: string;
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------- Generierte Drills (Lückentext, Plural, hat/ist) ----------------
|
||||
const drillInfo = {
|
||||
luecke: { title: "Welches Wort fehlt?", ar: "أي كلمة ناقصة؟", make: gapFillQuestions },
|
||||
plural: { title: "Plural", ar: "الجمع", make: pluralQuestions },
|
||||
perfekt: { title: "Perfekt mit hat oder ist?", ar: "hat أم ist؟", make: perfektQuestions },
|
||||
} as const;
|
||||
|
||||
function McDrill({ words, mode, onRestart }: { words: Word[]; mode: keyof typeof drillInfo; onRestart: () => void }) {
|
||||
const info = drillInfo[mode];
|
||||
const qs = useMemo(() => {
|
||||
let list = info.make(words);
|
||||
if (list.length < 5) list = info.make(allWords); // Thema hat zu wenige passende Wörter
|
||||
return shuffle(list).slice(0, 15);
|
||||
}, [info, words]);
|
||||
const [i, setI] = useState(0);
|
||||
const [chosen, setChosen] = useState<number | null>(null);
|
||||
const [correct, setCorrect] = useState(0);
|
||||
const [result, setResult] = useState<{ xp: number } | null>(null);
|
||||
|
||||
if (result) return <ResultCard correct={correct} total={qs.length} xp={result.xp} onRetry={onRestart} />;
|
||||
const q: DrillQ | undefined = qs[i];
|
||||
if (!q) return null;
|
||||
|
||||
const pick = (k: number) => {
|
||||
if (chosen !== null) return;
|
||||
setChosen(k);
|
||||
const ok = k === q.answer;
|
||||
if (ok) {
|
||||
sfx.correct();
|
||||
setCorrect((c) => c + 1);
|
||||
} else sfx.wrong();
|
||||
if (q.speak) speak(q.speak, { rate: 0.9 });
|
||||
};
|
||||
|
||||
const next = () => {
|
||||
if (i + 1 >= qs.length) {
|
||||
const xp = 5 + correct * 2;
|
||||
recordResult(`vocab-${mode}`, "wortschatz", (correct / qs.length) * 100, xp);
|
||||
setResult({ xp });
|
||||
} else {
|
||||
setI(i + 1);
|
||||
setChosen(null);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card fade-in" key={i}>
|
||||
<div className="row small muted">
|
||||
<span>
|
||||
{info.title} • <span className="ar">{info.ar}</span>
|
||||
</span>
|
||||
<span className="spacer" />
|
||||
<span>
|
||||
{i + 1} / {qs.length} • ✅ {correct}
|
||||
</span>
|
||||
</div>
|
||||
<div className="bar" style={{ margin: "8px 0 16px" }}>
|
||||
<div style={{ width: `${(i / qs.length) * 100}%` }} />
|
||||
</div>
|
||||
<div style={{ fontSize: 21, fontWeight: 800, textAlign: "center" }}>{q.prompt}</div>
|
||||
<Ar block>
|
||||
<div className="muted" style={{ textAlign: "center" }}>
|
||||
{q.hintAr}
|
||||
</div>
|
||||
</Ar>
|
||||
<div className={q.options.length === 2 ? "grid grid-2" : ""}>
|
||||
{q.options.map((o, k) => {
|
||||
let cls = "option";
|
||||
if (chosen !== null && k === q.answer) cls += " correct";
|
||||
else if (chosen === k) cls += " wrong";
|
||||
return (
|
||||
<button key={k} className={cls} disabled={chosen !== null} onClick={() => pick(k)} style={q.options.length === 2 ? { justifyContent: "center", fontSize: 20 } : undefined}>
|
||||
{q.options.length > 2 && <span className="key">{"abcd"[k]}</span>}
|
||||
<span>{o}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{chosen !== null && (
|
||||
<>
|
||||
<div className={`feedback ${chosen === q.answer ? "ok" : "no"}`}>
|
||||
{chosen === q.answer ? "Richtig! 🎉" : `Richtig: ${q.options[q.answer]}`}
|
||||
{q.explain && <span style={{ fontWeight: 600 }}> – {q.explain}</span>}
|
||||
</div>
|
||||
<button className="btn blue block" style={{ marginTop: 12 }} onClick={next}>
|
||||
{i + 1 >= qs.length ? "Ergebnis 🏁" : "Weiter →"}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------- Artikel-Spiel ----------------
|
||||
function ArticleGame({ words, onRestart }: { words: Word[]; onRestart: () => void }) {
|
||||
const nouns = useMemo(() => {
|
||||
|
||||
Reference in new issue
Block a user