// Inline study panel shown under a verse in the Reader: commentary from several // public-domain / open sources, plus the people, places and events tied to the verse. import { useState } from 'react'; import { useApp } from '../context/AppContext.js'; import { useIqAvailable } from '../hooks/useIq.js'; import IqCommentary from './iq/IqCommentary.jsx'; import { COMMENTARIES, loadCommentary, loadTheographic, loadPerson, pickCommentaryEntry, useAsync, } from '../hooks/useVerseStudy.js'; export function CommentaryTab({ book, chapter, verse }) { const iq = useIqAvailable(); const [more, setMore] = useState(() => { try { return localStorage.getItem('iq-commentary-mode') === '1'; } catch { return false; } }); const setMode = (on) => { setMore(on); try { localStorage.setItem('iq-commentary-mode', on ? '1' : '0'); } catch { /* storage unavailable */ } }; const chip = (on) => `rounded-full border px-2.5 py-0.5 text-[11px] ${on ? 'border-[var(--r-text,#334155)] bg-[var(--r-text,#334155)] text-[var(--r-bg,#ffffff)]' : 'border-[var(--r-line,#cbd5e1)] text-[var(--r-sub,#64748b)]'}`; return (
Loading…
} {status === 'empty' &&{source.name} has no notes for this chapter.
} {status === 'ready' && !entry &&No notes at or before this verse in {source.name}.
} {status === 'ready' && entry && ( <> {entry.number !== verse && (Notes on the passage starting at verse {entry.number}.
)}{source.credit}
Loading…
; if (status === 'empty') returnNo details available.
; const era = (y) => `${Math.abs(y)}${y < 0 ? ' BC' : ' AD'}`; return ({d}
)} {!data.description?.length &&No description available.
} {data.minYear != null && (Lived approx. {era(data.minYear)}{data.maxYear != null && data.maxYear !== data.minYear ? ` – ${era(data.maxYear)}` : ''}
)}Loading…
; if (status === 'empty') returnNo people or places data for this chapter.
; const here = (list) => list.filter((x) => x.verses?.includes(verse)); // Theographic lists some places twice (variant spellings) — collapse by name. const places = [...new Map(here(data.places).map((p) => [p.name, p])).values()]; const people = here(data.people); const events = here(data.events); if (!people.length && !places.length && !events.length) { returnNothing tagged on verse {verse}.
; } return (People
Places
Events
People, places and events: Theographic Bible Metadata, licensed CC BY-SA 4.0.