import { Link, useParams } from "@tanstack/react-router"; import { useEffect } from "react"; import { Live } from "../Live"; import { Capture, Windows, isCaptured } from "../Native"; import { all, chapters } from "../data"; import { NotFound } from "./NotFound"; export function Story() { const { page, story } = useParams({ strict: false }); const chapter = chapters.find((c) => c.slug === page); const found = chapter?.stories.find((s) => s.slug === story); useEffect(() => { if (chapter && found) document.title = `${found.title} · ${chapter.title} · Ely`; }, [chapter, found]); if (!chapter || !found) return ; const at = all.findIndex((e) => e.story === found); const [prev, next] = [all[at - 1], all[at + 1]]; return (
{chapter.title}

{found.title}

{isCaptured(chapter.slug, found.slug) ? ( ) : ( <> )}
); }