// The single home for per-verse tools: original words, cross-references, // commentary, and people & places, plus bookmark / copy. import { useEffect, useState } from 'react'; import Sheet from './Sheet.jsx'; import { CommentaryTab, PeoplePlacesTab } from '../StudyPanel.jsx'; import { BookmarkIcon, CopyIcon } from '../../utils/bibleUtils.jsx'; import { formatCrossRef, speakOriginalWord } from '../../utils/wordStudy.js'; const TABS = [['commentary', 'Commentary'], ['original', 'Original'], ['refs', 'Cross-refs'], ['people', 'People & places']]; function OriginalTab({ words }) { if (!words) return

No original-language data for this verse.

; return (
{words.map((w, i) => { const isHebrew = w.s?.startsWith('H'); const canSpeak = isHebrew || w.s?.startsWith('G'); return (
{w.o}
{w.t}
{w.g}
{w.p &&
{w.p}
} {w.s &&
{w.s}
} {canSpeak && ( )}
); })}
); } function RefsTab({ refs, loading, onJump }) { if (loading && !refs) return

Loading…

; if (!refs?.length) return

No cross-references for this verse.

; return (
{refs.slice(0, 20).map((ref, i) => ( ))}
); } export default function VerseSheet({ verse, book, bookName, chapter, translation, words, crossRefs, crossRefsLoading, onLoadCrossRefs, bookmarkColor, onToggleBookmark, onCycleColor, onJump, onClose, }) { const [tab, setTab] = useState('commentary'); const [copied, setCopied] = useState(false); useEffect(() => { if (verse && tab === 'refs') onLoadCrossRefs(); }, [verse?.number, tab]); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { setCopied(false); }, [verse?.number]); if (!verse) return null; const copy = () => { navigator.clipboard?.writeText(`${bookName} ${chapter}:${verse.number} ${translation} — ${verse.text}`); setCopied(true); window.setTimeout(() => setCopied(false), 1500); }; const actionBtn = 'rounded-lg p-1.5 hover:bg-black/5'; return ( {bookmarkColor && ( )} )} >
{TABS.map(([id, label]) => ( ))}
{tab === 'commentary' && } {tab === 'original' && } {tab === 'refs' && } {tab === 'people' && }
); }