import type { Config, Item, Page } from "#/lib/config/types.ts"; import { useState } from "preact/hooks"; interface MagicPageProps { config: Config; page: Page; } export default function MagicPage(props: MagicPageProps) { const {page, config} = props const [iframeUrl, setIframeUrl]= useState(undefined) return (
{ page?.categories?.map((category, idx) => { return (

{category.name}

{ category.items?.map((item,idx) => { return (
{ console.log("click event", e) if(e.buttons === 4) { globalThis.window.open(item.href, "_blank") } else if(e.buttons === 1) { if(item.iframe) { setIframeUrl(item.href) } else{ globalThis.window.open(item.href, "_blank") } } }}>

{item.iframe && "!"}{item.name}

); }) }
); }) }
{iframeUrl && }
); }