import sass from "https://deno.land/x/denosass@1.0.6/mod.ts"; import { Story } from "../wattpad.ts"; import { h, PropsWithChildren } from "../jsx.ts"; import Header from "../components/Header.tsx"; import VR from "../components/VerticalLine.tsx"; interface StoryProps { story: Story; currentHref: string; style?: string; stylepath?: string; } export default (props: PropsWithChildren) => { let chaptersInHeader: { name: string; href: string; element?: unknown }[] = [ { name: "Homepage", href: `/` }, { name: "", href: "", element: }, { name: "Details", href: `/story?id=${props.story.id}` }, { name: "", href: "", element: } ]; chaptersInHeader = chaptersInHeader.concat( props.story.storyJSON.parts.map((ch, i) => ({ name: ch.title, href: `/story?id=${props.story.id}&chapter=${i}` })) ); const isChapter = props.currentHref.includes("chapter="); // FIXME: shouldn't be hardcoded const currentURL = new URL( "https://voltpad.ruthenic.com" + props.currentHref ); const chapterNum = Number(currentURL.searchParams.get("chapter") ?? 0); return ( {/* favicon stuff generated with https://realfavicongenerator.net */} {isChapter ? ( ) : ( )} {isChapter ? ( props.story.chapters[0].partJSON.photoUrl ? ( ) : undefined ) : undefined} {isChapter ? ( props.story.chapters[0].partJSON.videoId ? ( ) : undefined ) : undefined} {isChapter ? undefined : ( ", "\n") } /> )} {props.story.name} {(() => { if (!props.style) props.style = ""; if (props.stylepath) props.style += Deno.readTextFileSync(props.stylepath); else return
; return ; })()}
{props.children}
); };