Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/waight.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import { createResource, Show } from "solid-js";import { openDatabase, type Database, type Entry } from "./data";
async function loadDebugData(database: Database) { await database.clear("entries");
const debugEntries: Entry[] = [ { weight: 83.6, timestamp: new Date("2025-08-12T10:56:00.000+02:00"), }, { weight: 84.6, timestamp: new Date("2025-08-13T09:23:00.000+02:00"), }, { weight: 84.1, timestamp: new Date("2025-08-13T10:30:00.000+02:00"), }, { weight: 84, timestamp: new Date("2025-08-14T09:28:00.000+02:00"), }, { weight: 83.6, timestamp: new Date("2025-08-15T13:38:00.000+02:00"), }, { weight: 83.9, timestamp: new Date("2025-08-16T10:20:00.000+02:00"), }, { weight: 84.1, timestamp: new Date("2025-08-17T10:28:00.000+02:00"), }, ];
const adds = debugEntries.map((entry) => database.add("entries", entry, entry.timestamp.getTime()) ); await Promise.all(adds);}export default function Debug() { const [database] = createResource(openDatabase);
return ( <main class="items-start max-w-xl mx-auto bg-gray-200 h-full p-4 text-emerald-950"> <h1 class="text-2xl font-light mb-3">Debug</h1>
<Show when={database()}> {(database) => ( <button onClick={() => loadDebugData(database())}> Load debug data </button> )} </Show> </main> );}