2025-10-18 21:09:39 +03:00
|
|
|
import { JSX } from "preact/jsx-runtime";
|
2025-10-18 21:01:31 +03:00
|
|
|
import FNote from "./entities/fnote";
|
2025-10-18 21:09:39 +03:00
|
|
|
import { render } from "preact";
|
2025-10-18 21:01:31 +03:00
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
|
const noteId = window.location.pathname.split("/")[2];
|
|
|
|
|
const froca = (await import("./services/froca")).default;
|
|
|
|
|
const note = await froca.getNote(noteId);
|
|
|
|
|
|
|
|
|
|
if (!note) return;
|
|
|
|
|
|
2025-10-18 21:09:39 +03:00
|
|
|
let el: JSX.Element | null = null;
|
2025-10-18 21:01:31 +03:00
|
|
|
if (note.type === "book") {
|
2025-10-18 21:09:39 +03:00
|
|
|
el = handleCollection(note);
|
2025-10-18 21:01:31 +03:00
|
|
|
}
|
2025-10-18 21:09:39 +03:00
|
|
|
|
|
|
|
|
render(el, document.body);
|
2025-10-18 21:01:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleCollection(note: FNote) {
|
2025-10-18 21:09:39 +03:00
|
|
|
return (
|
|
|
|
|
<h1>{note.title}</h1>
|
|
|
|
|
);
|
2025-10-18 21:01:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main();
|