mast/mast-react-vite/src/main.tsx
Anish Lakhwara 55b73f8be4 now it looks reasonable, and I think I understand what I was doing wrong
I needed a main element, that was using tailwind classes, so that
everything inside that class, followed the same structure
2024-11-06 22:34:15 -08:00

38 lines
956 B
TypeScript

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from "./App.tsx";
import initWasm from '@vlcn.io/crsqlite-wasm';
import wasmUrl from '@vlcn.io/crsqlite-wasm/crsqlite.wasm?url';
import tblrx from '@vlcn.io/rx-tbl';
const sqlite = await initWasm(() => wasmUrl);
const db = await sqlite.open("todo.db");
await db.exec(`
CREATE TABLE IF NOT EXISTS todos (
id BLOB PRIMARY KEY NOT NULL,
description TEXT,
project text,
tags text,
due text,
wait text,
priority text,
urgency real,
completed INTEGER NOT NULL DEFAULT 0
);
SELECT crsql_as_crr('todos');
`);
const rx = tblrx(db);
const ctx = { db, rx };
document.getElementById("root")!.classList.add("dark");
createRoot(document.getElementById("root") as HTMLElement).render(
<main className="min-h-screen flex flex-col py-12 bg-background text-gray-200">
<App ctx={ctx} />
</main>
);