import { useState } from "preact/hooks"; import { Database } from "types"; import { Head } from "$fresh/runtime.ts"; import { DEFAULT_STYLE } from "style"; import ConversationLink from "components/ConversationLink.tsx"; import WithStyleSheet from "components/WithStyleSheet.tsx"; import { fetch_db } from "db"; import { URL } from "utils"; export default function Home({ db }: { db: Database }) { const [data, setData] = useState(db); const links = Object.keys(data.conversations) .reverse() .map(c => ); return ( <> Freshter Logs

freshter logs

(await fetch_db()).map(db => setData(db))} /> {links}
by mehbark
); } function MakeConversation({ onsubmit }: { onsubmit?: () => void }) { const [name, setName] = useState(""); const [desc, setDesc] = useState(""); async function handleClick() { await fetch(`${URL}/api/conv`, { method: "PUT", body: JSON.stringify({ name, description: desc }), }); setName(""); setDesc(""); onsubmit && onsubmit(); } return ( <>
setName(e.target.value)} className="mc-name" placeholder="name" />