Replace IPA/syllable checkboxes with full dropdowns in vocab-worksheet
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 47s
CI / test-go-edu-search (push) Successful in 47s
CI / test-python-klausur (push) Failing after 2m41s
CI / test-python-agent-core (push) Successful in 39s
CI / test-nodejs-website (push) Successful in 42s

Vocab worksheet now has the same IPA/syllable mode options as the
OCR pipeline grid editor: Auto, nur EN, nur DE, Alle, Aus.
Previously only had on/off checkboxes mapping to auto/none.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-12 10:10:22 +02:00
parent 0f17eb3cd9
commit bf9d24e108

View File

@@ -157,8 +157,8 @@ export default function VocabWorksheetPage() {
const [includeSolutions, setIncludeSolutions] = useState(true)
const [lineHeight, setLineHeight] = useState('normal')
const [selectedFormat, setSelectedFormat] = useState<WorksheetFormat>('standard')
const [showIpa, setShowIpa] = useState(false)
const [showSyllables, setShowSyllables] = useState(false)
const [ipaMode, setIpaMode] = useState<'auto' | 'en' | 'de' | 'all' | 'none'>('none')
const [syllableMode, setSyllableMode] = useState<'auto' | 'en' | 'de' | 'all' | 'none'>('none')
// Export state
const [worksheetId, setWorksheetId] = useState<string | null>(null)
@@ -440,9 +440,7 @@ export default function VocabWorksheetPage() {
const API_BASE = getApiBase()
try {
const ipaParam = showIpa ? 'auto' : 'none'
const syllableParam = showSyllables ? 'auto' : 'none'
const res = await fetch(`${API_BASE}/api/v1/vocab/sessions/${session!.id}/process-single-page/${pageIndex}?ipa_mode=${ipaParam}&syllable_mode=${syllableParam}`, {
const res = await fetch(`${API_BASE}/api/v1/vocab/sessions/${session!.id}/process-single-page/${pageIndex}?ipa_mode=${ipaMode}&syllable_mode=${syllableMode}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ocr_prompts: ocrPrompts }),
@@ -1965,21 +1963,35 @@ export default function VocabWorksheetPage() {
{/* OCR display options */}
<div className={`p-4 rounded-xl border ${isDark ? 'bg-white/5 border-white/10' : 'bg-gray-50 border-gray-200'} space-y-3`}>
<h4 className={`text-sm font-medium ${isDark ? 'text-white/70' : 'text-slate-600'}`}>Anzeigeoptionen</h4>
<div className="flex flex-col gap-2">
<label className={`flex items-center gap-3 cursor-pointer ${isDark ? 'text-white' : 'text-slate-900'}`}>
<input type="checkbox" checked={showIpa} onChange={(e) => setShowIpa(e.target.checked)} className="w-5 h-5 rounded border-2 border-purple-500 text-purple-500 focus:ring-purple-500" />
<div>
<span>Lautschrift (IPA) anzeigen</span>
<p className={`text-xs ${isDark ? 'text-white/40' : 'text-slate-400'}`}>z.B. achieve [əˈtʃiːv]</p>
</div>
</label>
<label className={`flex items-center gap-3 cursor-pointer ${isDark ? 'text-white' : 'text-slate-900'}`}>
<input type="checkbox" checked={showSyllables} onChange={(e) => setShowSyllables(e.target.checked)} className="w-5 h-5 rounded border-2 border-purple-500 text-purple-500 focus:ring-purple-500" />
<div>
<span>Silbentrennung anzeigen</span>
<p className={`text-xs ${isDark ? 'text-white/40' : 'text-slate-400'}`}>z.B. Schmet|ter|ling</p>
</div>
</label>
<div className="flex flex-col gap-3">
<div>
<label className={`block text-sm mb-1 ${isDark ? 'text-white/60' : 'text-slate-500'}`}>Lautschrift (IPA)</label>
<select
value={ipaMode}
onChange={(e) => setIpaMode(e.target.value as typeof ipaMode)}
className={`w-full px-3 py-2 rounded-lg border text-sm ${isDark ? 'bg-white/10 border-white/20 text-white' : 'bg-white border-gray-200 text-slate-900'}`}
>
<option value="none">Aus</option>
<option value="auto">Auto (erkannte EN-Woerter)</option>
<option value="en">Nur Englisch</option>
<option value="de">Nur Deutsch</option>
<option value="all">Alle (EN + DE)</option>
</select>
</div>
<div>
<label className={`block text-sm mb-1 ${isDark ? 'text-white/60' : 'text-slate-500'}`}>Silbentrennung</label>
<select
value={syllableMode}
onChange={(e) => setSyllableMode(e.target.value as typeof syllableMode)}
className={`w-full px-3 py-2 rounded-lg border text-sm ${isDark ? 'bg-white/10 border-white/20 text-white' : 'bg-white border-gray-200 text-slate-900'}`}
>
<option value="none">Aus</option>
<option value="auto">Original (nur wo im Scan vorhanden)</option>
<option value="en">Nur Englisch</option>
<option value="de">Nur Deutsch</option>
<option value="all">Alle</option>
</select>
</div>
</div>
</div>