'use client' import React from 'react' import { useTheme } from '@/lib/ThemeContext' import { useNativeLanguage } from '@/lib/useNativeLanguage' import { exerciseExplanations } from '@/lib/exerciseExplanations' interface ExerciseLayoutProps { /** Main exercise content (2/3 left) */ children: React.ReactNode /** Native language helper content for the right panel */ nativeHelper?: React.ReactNode /** Explanation text for parents (shown above native words) */ exerciseExplanation?: string /** Exercise type key for auto-explanation lookup (e.g. 'match', 'flashcards') */ exerciseType?: string /** Title for the exercise in the header */ title: string /** Progress: current / total */ progress?: { current: number; total: number } /** Back button handler */ onBack?: () => void /** Score display */ score?: React.ReactNode } // Explanations imported from exerciseExplanations.ts (26 languages each) /** * Standard exercise layout: 2/3 work area (left) + 1/3 native helper (right). * The right panel only appears for non-DE/EN speakers. */ export function ExerciseLayout({ children, nativeHelper, exerciseExplanation, exerciseType, title, progress, onBack, score, }: ExerciseLayoutProps) { const { isDark } = useTheme() const { nativeLang, isThirdLanguage, t } = useNativeLanguage() const glassCard = isDark ? 'bg-white/10 backdrop-blur-xl border border-white/10' : 'bg-white/80 backdrop-blur-xl border border-black/5' const typeKey = exerciseType || title.toLowerCase() const explanation = exerciseExplanation || exerciseExplanations[typeKey]?.[nativeLang] || exerciseExplanations[typeKey]?.['en'] || exerciseExplanations[typeKey]?.['de'] || '' return ( <> {/* Header */}
{onBack ? ( ) : }

{title}

{score || }
{/* Progress bar */} {progress && (
{progress.current}/{progress.total}
)} {/* Main content: 2/3 left + 1/3 right */}
{/* Left: Exercise area (2/3 or full) */}
{children}
{/* Divider line */} {isThirdLanguage && (
)} {/* Right: Native language helper (1/3) — only for migrants */} {isThirdLanguage && (
{/* Explanation card */} {explanation && (

💡 {nativeLang.toUpperCase()} · {t('english')} · {t('german')}

{explanation}

)} {/* Native words */} {nativeHelper}
)}
) } export { explanations as exerciseExplanations }