Files
X4Lo 1f1d28a34d 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.
2026-11-05 19:11:46 +00:00

34 lines
993 B
TypeScript

"use client";
import { useState } from "react";
import { useProgress } from "@/lib/progress";
/** Arabische Übersetzung. Wenn „Arabisch ausblenden“ aktiv ist, erscheint sie erst nach Antippen. */
export default function Ar({ children, block = false, always = false }: { children: React.ReactNode; block?: boolean; always?: boolean }) {
const { showArabic } = useProgress();
const [revealed, setRevealed] = useState(false);
const Tag = block ? "div" : "span";
if (!showArabic && !always && !revealed) {
return (
<Tag>
<button
type="button"
onClick={(e) => {
e.stopPropagation();
setRevealed(true);
}}
className="pill purple"
style={{ border: "none", cursor: "pointer" }}
>
👁 عربي
</button>
</Tag>
);
}
return (
<Tag className="ar" lang="ar" dir="rtl" style={block ? { display: "block" } : undefined}>
{children}
</Tag>
);
}