Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 284 additions & 1 deletion bun.lock

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
"id": "10c6b36e-5eb7-4ecf-ad47-a0fe883a8ade",
"id": "371fbe16-12a2-4f5d-ae54-cd465106824b",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"cells": {
Expand Down
4 changes: 2 additions & 2 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "6",
"when": 1749396093238,
"tag": "0000_bitter_wallflower",
"when": 1749995282393,
"tag": "0000_dark_earthquake",
"breakpoints": true
}
]
Expand Down
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Solid + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚡</text></svg>"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Reactive SQLite Demo</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Binary file modified local.db
Binary file not shown.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
"@solid-primitives/scheduled": "^1.5.1",
"@solid-primitives/storage": "^4.3.2",
"@solid-primitives/virtual": "^0.2.1",
"@solid-primitives/websocket": "^1.3.1",
"@solidjs/router": "^0.15.3",
"@sqlite.org/sqlite-wasm": "^3.49.2-build1",
"@tailwindcss/vite": "^4.1.8",
"comlink": "^4.4.2",
"drizzle-orm": "^0.44.1",
"ky": "^1.8.1",
"madge": "^8.0.0",
"solid-js": "^1.9.5",
"sqlite-parser": "^1.0.1",
"tailwindcss": "^4.1.8",
Expand Down
2 changes: 0 additions & 2 deletions src/components/ChangeLog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { createVirtualList } from '@solid-primitives/virtual'
import { sql } from 'drizzle-orm'
import { createSignal, For, onMount, Show, type Component } from 'solid-js'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const Data = () => {
<h3 class="text-xl font-medium">{post.title}</h3>
<p class="text-gray-700 mt-1">{post.body}</p>
<p class="text-sm text-gray-500 mt-2">
Author ID: {post.authorId} | Post ID: {post.id}
Author ID: {post.author_id} | Post ID: {post.id}
</p>
</li>
)}
Expand Down
12 changes: 5 additions & 7 deletions src/components/GameOfLifeCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { and, eq, sql } from 'drizzle-orm'
import {
createEffect,
Expand All @@ -17,14 +15,14 @@ import Button from './ui/Button'
import { isDarkMode } from '../routes/Home'

export function GameOfLifeCanvas() {
const gridSize = { width: 42, height: 5 }
const gridSize = { width: 50, height: 10 }
const cellSize = 20

const [cells, lastChanges, loading] = useCells({ ...gridSize })
const { db } = useDb()
const [running, setRunning] = createSignal(false)
let timeoutId: ReturnType<typeof setTimeout>
let canvasRef!: HTMLCanvasElement
const cellSize = 20
const aliveColor = createMemo(() =>
isDarkMode() ? 'rgb(219, 39, 119)' : 'rgb(236, 72, 153)'
)
Expand Down Expand Up @@ -74,7 +72,7 @@ export function GameOfLifeCanvas() {
}
}
await database.batch(updates)
timeoutId = setTimeout(runLoop, 300)
timeoutId = setTimeout(runLoop, 1)
}

function runLoop() {
Expand Down Expand Up @@ -217,14 +215,14 @@ export function GameOfLifeCanvas() {
<Button
onClick={clearGrid}
disabled={loading()}
class="bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-800 dark:text-white"
class="bg-gray-700 hover:bg-gray-600 text-white"
>
Clear Grid
</Button>
<Button
onClick={seedDemo}
disabled={loading()}
class="bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-800 dark:text-white"
class="bg-gray-700 hover:bg-gray-600 text-white"
>
Reset Demo
</Button>
Expand Down
2 changes: 0 additions & 2 deletions src/components/Users/AddUser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { createSignal, type Component } from 'solid-js'
import Button from '../ui/Button'

Expand Down
7 changes: 4 additions & 3 deletions src/components/Users/ManageUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ export const ManageUsers: Component = () => {
setError(null)
setSuccess(null)
try {
await (await db).insert(schema.users).values({
const database = await db
await database.insert(schema.users).values({
name: name.trim(),
email: email.trim(),
bio: bio.trim(),
location: location.trim(),
picture: getRandomRobot(users.length + 1),
isActive: true,
createdAt: new Date().toISOString()
is_active: true,
created_at: new Date().toISOString()
})

setSuccess('User added successfully.')
Expand Down
6 changes: 2 additions & 4 deletions src/components/Users/UserTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { eq } from 'drizzle-orm'
import { createSignal, For, type Component } from 'solid-js'
import { useDb } from '../../context/DbProvider'
Expand Down Expand Up @@ -300,12 +298,12 @@ export const UsersTable: Component<{
<td class="px-6 py-4 whitespace-nowrap">
<span
class={`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${
user.isActive
user.is_active
? 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300'
: 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
}`}
>
{user.isActive ? 'Active' : 'Inactive'}
{user.is_active ? 'Active' : 'Inactive'}
</span>
</td>

Expand Down
Loading