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,27 @@
|
||||
"use client";
|
||||
|
||||
import { speak, stopSpeaking } from "@/lib/speech";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function SpeakButton({ text, gender = "f", rate = 0.9, label }: { text: string; gender?: "f" | "m"; rate?: number; label?: string }) {
|
||||
const [on, setOn] = useState(false);
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="btn secondary small"
|
||||
aria-label="Vorlesen"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (on) {
|
||||
stopSpeaking();
|
||||
setOn(false);
|
||||
return;
|
||||
}
|
||||
setOn(true);
|
||||
speak(text, { gender, rate, onEnd: () => setOn(false) });
|
||||
}}
|
||||
>
|
||||
{on ? "⏹" : "🔊"} {label}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user