+25
mast-react-vite/src/main.tsx
+25
mast-react-vite/src/main.tsx
···
327
327
completed INTEGER NOT NULL DEFAULT 0
328
328
);
329
329
SELECT crsql_as_crr('todos');
330
+
331
+
CREATE TABLE IF NOT EXISTS metadata (
332
+
key TEXT PRIMARY KEY NOT NULL,
333
+
value TEXT,
334
+
updated_at TEXT
335
+
);
336
+
SELECT crsql_as_crr('metadata');
330
337
CREATE VIEW IF NOT EXISTS active_todos AS
331
338
SELECT
332
339
id,
···
390
397
FROM todos
391
398
WHERE completed = 0;
392
399
`);
400
+
401
+
// Check if onboarding was already done and insert tasks if not
402
+
const onboardingComplete = await db.execA("SELECT value FROM metadata WHERE key = 'onboarding_completed'");
403
+
if (onboardingComplete.length === 0) {
404
+
console.log("Onboarding not completed, inserting onboarding tasks...");
405
+
await db.exec(`
406
+
INSERT INTO todos (id, description, project, tags, due, wait, priority, urgency, completed) VALUES
407
+
(x'00000000000000000000000000000001', 'Create your first task, with the + icon', 'onboarding', '["tutorial"]', '', '', '', 0, 0),
408
+
(x'00000000000000000000000000000002', 'Use attributes like +work or #chores and filter tasks with the search bar', 'onboarding', '["tutorial"]', '', '', '', 0, 0),
409
+
(x'00000000000000000000000000000003', 'Add due dates @2025-01-22 and mark urgent items with !! priority', 'onboarding', '["workflow"]', '', '', '', 0, 0),
410
+
(x'00000000000000000000000000000004', 'Single tap to select, double-tap to edit tasks, swipe right to complete them, try multiple selections!', 'onboarding', '["workflow"]', '', '', '', 0, 0),
411
+
(x'00000000000000000000000000000005', 'Switch rooms in the sidebar for separate workspaces', 'onboarding', '["rooms"]', '', '', '', 0, 0);
412
+
413
+
INSERT INTO metadata (key, value, updated_at) VALUES
414
+
('onboarding_completed', 'true', datetime('now'));
415
+
`);
416
+
}
417
+
393
418
const rx = tblrx(db);
394
419
395
420
// Register the database context