import { useState } from 'react'; import { useApp } from '../context/AppContext.js'; import { buildPronunciationGuide } from '../utils/bibleUtils.jsx'; import { speakOriginalWord } from '../utils/wordStudy.js'; export default function PronunciationPage() { const { project, setCurrentPage } = useApp(); const [search, setSearch] = useState(''); const [copied, setCopied] = useState(false); const chapters = Array.isArray(project?.chapters) ? project.chapters : []; // Collect all words with chapter/chunk context, deduplicated by Strong's number const seen = new Set(); const entries = []; chapters.forEach((ch) => { ch.chunks.forEach((chunk) => { (chunk.greekWords ?? []).forEach((word) => { if (!word.lexeme && !word.transliteration) return; const key = word.strongNumber || `${word.lexeme}__${word.transliteration}`; if (seen.has(key)) return; seen.add(key); entries.push({ word, chapterRef: `${ch.book} ${ch.chapter}` }); }); }); }); const q = search.trim().toLowerCase(); const filtered = q ? entries.filter(({ word }) => (word.englishGloss ?? '').toLowerCase().includes(q) || (word.shortDefinition ?? '').toLowerCase().includes(q) || (word.lexeme ?? '').toLowerCase().includes(q) || (word.transliteration ?? '').toLowerCase().includes(q) || (word.strongNumber ?? '').toLowerCase().includes(q), ) : entries; const greek = filtered.filter(({ word }) => !word.strongNumber?.startsWith('H')); const hebrew = filtered.filter(({ word }) => word.strongNumber?.startsWith('H')); const copyAll = () => { const guide = buildPronunciationGuide(project); navigator.clipboard.writeText(guide).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); }); }; return (
{project.title}
)}{entries.length} unique word{entries.length !== 1 ? 's' : ''} across all chapters
🔤
No words yet
Add Greek or Hebrew words in the Word Studies panel on the Study page.
No words match "{search}"
) : ({word.lexeme}
)} {word.transliteration && ({word.transliteration}
)}{word.englishGloss}
)} {word.shortDefinition && word.shortDefinition !== word.englishGloss && ({word.shortDefinition}
)}