// Prodz — Set Moments as 24h Stories. The Home rail shows only people you // follow; tapping one opens this full-screen viewer and you move horizontally // through their frames (and on into the next person). Tap right / left to // advance, or swipe. Each frame links back to its bound production. function StoryViewer({ start = 0 }) { const { L } = useL(); const nav = useNav(); const { Avatar } = window.ProdzDesignSystem_d0b87b; // flatten every followed person's frames into one horizontal reel const flat = []; STORIES.forEach((s, si) => s.frames.forEach((f, fi) => flat.push({ ...f, person: s.person, time: s.time, si, fi, count: s.frames.length }))); const startFrame = Math.max(0, flat.findIndex((f) => f.si === start && f.fi === 0)); const ref = useRefS(null); const [active, setActive] = useStateS(startFrame); useEffectS(() => { const el = ref.current; if (el) el.scrollLeft = startFrame * el.clientWidth; }, []); const onScroll = () => { const el = ref.current; if (!el) return; const i = Math.round(el.scrollLeft / el.clientWidth); if (i !== active) setActive(i); }; const go = (dir) => { const el = ref.current; if (!el) return; const i = Math.min(flat.length - 1, Math.max(0, active + dir)); el.scrollTo({ left: i * el.clientWidth, behavior: 'smooth' }); }; const cur = flat[active] || flat[0]; const person = PEOPLE[cur.person]; const prod = PRODUCTIONS.find((p) => p.id === cur.prod); return (
{/* horizontal reel */}
{flat.map((f, i) => (
))}
{/* tap zones */}
{/* caption + production link */}
{cur.caption &&
{tr(L, cur.caption)}
} {prod && ( )}
); } Object.assign(window, { StoryViewer });