Add B1 Meister: OeSD B1 exam trainer (German-Arabic)
Next.js app with Hoeren, Lesen, Schreiben, Sprechen, Grammatik and Wortschatz sections, flashcards with spaced repetition, speaking chat, XP/streaks/badges, daily reminders (PWA) and Docker Compose setup for Coolify.
This commit is contained in:
commit
1f1d28a34d
42 files changed
+8879
No files matched your search
@@ -0,0 +1,44 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { fireConfetti } from "./AppShell";
|
||||
import { sfx } from "@/lib/sfx";
|
||||
|
||||
export function scoreMessage(pct: number) {
|
||||
if (pct === 100) return { emoji: "🏆", de: "Perfekt! Du bist bereit für die Prüfung!", ar: "ممتاز! أنت جاهز للامتحان!" };
|
||||
if (pct >= 80) return { emoji: "🌟", de: "Sehr gut! Weiter so!", ar: "جيد جداً! استمر هكذا!" };
|
||||
if (pct >= 60) return { emoji: "👍", de: "Bestanden! (60 % reichen in der Prüfung)", ar: "ناجح! (60% تكفي في الامتحان)" };
|
||||
return { emoji: "💪", de: "Noch nicht ganz – versuch es noch einmal!", ar: "ليس بعد – حاول مرة أخرى!" };
|
||||
}
|
||||
|
||||
export default function ResultCard({ correct, total, xp, onRetry, children }: { correct: number; total: number; xp: number; onRetry?: () => void; children?: React.ReactNode }) {
|
||||
const pct = total ? Math.round((correct / total) * 100) : 0;
|
||||
const m = scoreMessage(pct);
|
||||
useEffect(() => {
|
||||
if (pct >= 80) {
|
||||
fireConfetti();
|
||||
sfx.win();
|
||||
}
|
||||
}, [pct]);
|
||||
return (
|
||||
<div className="card fade-in" style={{ marginTop: 16, textAlign: "center", borderColor: pct >= 60 ? "var(--green)" : "var(--orange)" }}>
|
||||
<div style={{ fontSize: 52 }}>{m.emoji}</div>
|
||||
<div style={{ fontSize: 30, fontWeight: 900 }}>
|
||||
{correct} / {total} <span className="muted" style={{ fontSize: 18 }}>({pct} %)</span>
|
||||
</div>
|
||||
<div style={{ fontWeight: 800, marginTop: 4 }}>{m.de}</div>
|
||||
<div className="ar muted">{m.ar}</div>
|
||||
<div className="pill purple" style={{ marginTop: 8 }}>
|
||||
+{xp} XP
|
||||
</div>
|
||||
{children}
|
||||
{onRetry && (
|
||||
<div style={{ marginTop: 14 }}>
|
||||
<button type="button" className="btn secondary" onClick={onRetry}>
|
||||
🔁 Nochmal
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user