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
+67
-2
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { lessons, type GrammarEx, type Lesson } from "@/data/grammatik";
|
||||
import { allGrammarExercises, lessons, type GrammarEx, type Lesson } from "@/data/grammatik";
|
||||
import Ar from "@/components/Ar";
|
||||
import SpeakButton from "@/components/SpeakButton";
|
||||
import ResultCard from "@/components/ResultCard";
|
||||
@@ -10,14 +10,33 @@ import { sfx } from "@/lib/sfx";
|
||||
|
||||
export default function GrammatikPage() {
|
||||
const [lesson, setLesson] = useState<Lesson | null>(null);
|
||||
const [drill, setDrill] = useState(0);
|
||||
const p = useProgress();
|
||||
if (drill > 0) return <Drill key={drill} onBack={() => setDrill(0)} onAgain={() => setDrill((d) => d + 1)} />;
|
||||
if (lesson) return <LessonView key={lesson.id} lesson={lesson} onBack={() => setLesson(null)} />;
|
||||
return (
|
||||
<div>
|
||||
<h1>🧩 Grammatik</h1>
|
||||
<p className="sub">
|
||||
Die wichtigsten B1-Themen – auf Arabisch erklärt, mit Übungen. <Ar>أهم مواضيع B1 – مشروحة بالعربية مع تمارين.</Ar>
|
||||
{lessons.length} B1-Themen mit {allGrammarExercises.length} Übungen – auf Arabisch erklärt. <Ar>مواضيع B1 مشروحة بالعربية مع تمارين كثيرة.</Ar>
|
||||
</p>
|
||||
<button
|
||||
className="tile"
|
||||
style={{ background: "linear-gradient(135deg, var(--purple), var(--blue))", color: "#fff", marginBottom: 12 }}
|
||||
onClick={() => setDrill(1)}
|
||||
>
|
||||
<div className="row">
|
||||
<span className="emoji">🎲</span>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div className="t" style={{ marginTop: 0 }}>
|
||||
Zufalls-Drill: 20 gemischte Fragen
|
||||
</div>
|
||||
<div className="s" style={{ color: "#fff", opacity: 0.9 }}>
|
||||
Aus allen Themen – jedes Mal anders! • تمرين عشوائي من كل المواضيع
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<div className="grid grid-2">
|
||||
{lessons.map((l) => {
|
||||
const score = p.done[l.id];
|
||||
@@ -127,6 +146,52 @@ function LessonView({ lesson, onBack }: { lesson: Lesson; onBack: () => void })
|
||||
);
|
||||
}
|
||||
|
||||
function Drill({ onBack, onAgain }: { onBack: () => void; onAgain: () => void }) {
|
||||
const items = useMemo(() => [...allGrammarExercises].sort(() => Math.random() - 0.5).slice(0, 20), []);
|
||||
const [results, setResults] = useState<(boolean | null)[]>(() => items.map(() => null));
|
||||
const [done, setDone] = useState<{ c: number; xp: number } | null>(null);
|
||||
const answered = results.filter((r) => r !== null).length;
|
||||
|
||||
const onAnswer = (i: number, ok: boolean) => {
|
||||
const next = results.map((r, j) => (j === i ? ok : r));
|
||||
setResults(next);
|
||||
if (next.every((r) => r !== null) && !done) {
|
||||
const c = next.filter(Boolean).length;
|
||||
const xp = 10 + c * 2;
|
||||
recordResult("grammatik-drill", "grammatik", (c / next.length) * 100, xp);
|
||||
setDone({ c, xp });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button className="btn secondary small" style={{ marginTop: 16 }} onClick={onBack}>
|
||||
← Zurück
|
||||
</button>
|
||||
<h1 style={{ fontSize: 24 }}>🎲 Zufalls-Drill</h1>
|
||||
<div className="row">
|
||||
<span className="pill">
|
||||
{answered} / {items.length}
|
||||
</span>
|
||||
<span className="pill green">✅ {results.filter((r) => r === true).length}</span>
|
||||
</div>
|
||||
<div className="bar" style={{ marginTop: 8 }}>
|
||||
<div style={{ width: `${(answered / items.length) * 100}%` }} />
|
||||
</div>
|
||||
{items.map((it, i) => (
|
||||
<div key={i} className="card" style={{ marginTop: 12 }}>
|
||||
<div className="row" style={{ marginBottom: 6 }}>
|
||||
<span className="pill">{i + 1}</span>
|
||||
<span className="small muted">{it.lessonTitle}</span>
|
||||
</div>
|
||||
{it.ex.kind === "mc" ? <McEx ex={it.ex} onAnswer={(ok) => onAnswer(i, ok)} /> : <OrderEx ex={it.ex} onAnswer={(ok) => onAnswer(i, ok)} />}
|
||||
</div>
|
||||
))}
|
||||
{done && <ResultCard correct={done.c} total={items.length} xp={done.xp} onRetry={onAgain} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function McEx({ ex, onAnswer }: { ex: Extract<GrammarEx, { kind: "mc" }>; onAnswer: (ok: boolean) => void }) {
|
||||
const [chosen, setChosen] = useState<number | null>(null);
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user