// A verse's "study aids" from IQ Bible: chapter overview, topics, places, people, textual notes, Gospel // parallels and timeline. Each section loads only when opened, so nothing is spent on what isn't read. import { useState } from 'react'; import { useIq } from '../../hooks/useIq.js'; import { listOf } from '../../utils/iqbible.js'; const muted = 'text-xs text-[var(--r-sub,#64748b)]'; const GOSPELS = ['MAT', 'MRK', 'LUK', 'JHN']; function Aid({ title, path, query, children, empty = 'Nothing recorded here.' }) { const [open, setOpen] = useState(false); const { status, data, error } = useIq(open ? path : null, query); return (
setOpen(e.currentTarget.open)} className="rounded-xl bg-[var(--r-bg,#ffffff)] px-3 py-2"> {title}
{status === 'loading' &&

Loading…

} {status === 'error' &&

{error}

} {status === 'empty' &&

{empty}

} {status === 'ready' && children(data)}
); } function PersonProfile({ ustrong }) { const { status, data } = useIq(`bible-characters/by-ustrong/${ustrong}`); const p = data?.data; if (status === 'loading') return

Loading…

; if (!p) return

No profile.

; return (

{p.brief || p.briefest || p.description}

{p.tribe_nation &&

{p.tribe_nation}

} {p.first_appearance &&

First appears {p.first_appearance.book} {p.first_appearance.chapter}:{p.first_appearance.verse}

}
); } function People({ data, verse }) { const [open, setOpen] = useState(null); const people = listOf(data); return ( ); } function Places({ data }) { const places = listOf(data); return ( ); } function Variants({ data }) { const items = listOf(data); return ( ); } function Harmony({ data, book, chapter }) { const items = listOf(data); return ( ); } export default function IqStudyAids({ book, chapter, verse, onTag }) { return (
{(d) => ( <>

{d.summary}

{d.source_author &&

{d.source_author}{d.source_year ? `, ${d.source_year}` : ''}

} )}
{(d) => (
{listOf(d).slice(0, 40).map((t, i) => ( onTag ? : {t.name} ))}
)}
{(d) => } {(d) => } {(d) => } {GOSPELS.includes(book) && ( {(d) => } )} {(d) => ( <>

{d.placement ?? `${d.date ?? ''}`}

{d.preceding?.length > 0 &&

Before: {d.preceding.map((e) => `${e.event} (${e.date})`).join('; ')}

} {d.following?.length > 0 &&

After: {d.following.map((e) => `${e.event} (${e.date})`).join('; ')}

} )}

Study aids via IQ Bible.

); }