diff --git a/deno.lock b/deno.lock index 38bb00d..440b518 100644 --- a/deno.lock +++ b/deno.lock @@ -17,7 +17,8 @@ "npm:solid-js@^2.0.0-rc.4": "2.0.0-rc.4", "npm:tailwindcss@^4.3.3": "4.3.3", "npm:typescript@^5.9.2": "5.9.3", - "npm:vite@^8.1.5": "8.2.1" + "npm:vite@^8.1.5": "8.2.1", + "npm:zod@4": "4.4.3" }, "npm": { "@ampproject/remapping@2.3.0": { @@ -2117,6 +2118,9 @@ }, "yocto-queue@0.1.0": { "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + }, + "zod@4.4.3": { + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==" } }, "workspace": { @@ -2138,7 +2142,8 @@ "npm:solid-js@^2.0.0-rc.4", "npm:tailwindcss@^4.3.3", "npm:typescript@^5.9.2", - "npm:vite@^8.1.5" + "npm:vite@^8.1.5", + "npm:zod@4" ] } } diff --git a/package.json b/package.json index 2da8169..47ace2c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "@solidjs/diagnostics": "^2.0.0-rc.4", "@solidjs/vite-plugin": "^3.0.0-next.35", "eslint-plugin-solid": "~0.17.0", - "filesystem-routing": "0.2.1", "oxlint": "~1.79.0", "typescript": "^5.9.2", "vite": "^8.1.5" @@ -29,6 +28,7 @@ "@vitejs/plugin-basic-ssl": "^2.3.0", "matrix-js-sdk": "^42.3.0", "solid-js": "^2.0.0-rc.4", + "zod": "^4.0.0", "tailwindcss": "^4.3.3" } } diff --git a/src/App.tsx b/src/App.tsx index ddc226d..a9383e0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,29 +1,26 @@ -import './App.css'; -import { Loading } from 'solid-js'; -import { pageRoutes } from 'virtual:file-routes'; -import { createRouter } from '@solidjs/router'; -import { fileRoutes } from '@solidjs/router/fs'; +import '@/App.css'; +import { Loading, lazy } from 'solid-js'; +import { createRouter } from "@solidjs/router"; import { MatrixContext, loadMatrixSession, matrixClient, - migrateLegacySingleSession, -} from './matrix'; +} from '@/matrix'; -// Migrate pre-multi-account storage (idempotent, no-op if nothing to do). -migrateLegacySingleSession(); +export const Router = createRouter({ + routes: [ + { path: "/", component: lazy(() => import("./pages/index")) }, + { path: "/status", component: lazy(() => import("./pages/status")) }, + { path: "*404", component: lazy(() => import("./pages/404")) } + ] +}); -export const Router = createRouter({ routes: fileRoutes(pageRoutes) }); - -// Restore the authenticated client from storage. Async because it validates -// tokens and refreshes them if expired, persisting the rotated credentials. +// Restore the authenticated client from storage void loadMatrixSession(); // The app root: the router and the site-wide layout live here. Pages are // the modules under src/routes. export default function App() { - // matrixClient is a solid-signal accessor; its change re-creates the - // provider value and re-renders children through it. return ( {(props) => ( diff --git a/app/*404.tsx b/src/pages/404.tsx similarity index 100% rename from app/*404.tsx rename to src/pages/404.tsx diff --git a/app/auth/callback.tsx b/src/pages/auth/callback.tsx similarity index 99% rename from app/auth/callback.tsx rename to src/pages/auth/callback.tsx index 0436257..6d42ef9 100644 --- a/app/auth/callback.tsx +++ b/src/pages/auth/callback.tsx @@ -1,7 +1,7 @@ import { createSignal, Show } from "solid-js"; import { useNavigate } from "@solidjs/router"; import { OAuth2, createClient } from "matrix-js-sdk"; -import { adoptMatrixClient, setActiveAccountId, upsertSession } from "../../src/matrix"; +import { adoptMatrixClient, setActiveAccountId, upsertSession } from "../../matrix"; // The stored context produced during login (shape matches OAuth2's Context) interface StoredContext { diff --git a/app/auth/login.tsx b/src/pages/auth/login.tsx similarity index 100% rename from app/auth/login.tsx rename to src/pages/auth/login.tsx diff --git a/app/index.tsx b/src/pages/index.tsx similarity index 100% rename from app/index.tsx rename to src/pages/index.tsx diff --git a/app/status.tsx b/src/pages/status.tsx similarity index 97% rename from app/status.tsx rename to src/pages/status.tsx index 298d710..e2287db 100644 --- a/app/status.tsx +++ b/src/pages/status.tsx @@ -16,7 +16,7 @@ import { setActiveAccountId, type StoredSession, matrixClient, -} from "../src/matrix"; +} from "../matrix"; function keyParts(s: StoredSession): string { return `${s.homeserverUrl}/${s.userId}`; @@ -204,12 +204,12 @@ export default function Status() { value={keyParts(s)} selected={keyParts(s) === activeId()} > - {s.userId} — {s.homeserverUrl} + {s.userId} - {s.homeserverUrl} )} - + Add account + [+] Add account

diff --git a/tsconfig.json b/tsconfig.json index 6539e6d..0f8a3a1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,11 @@ // Type Checking & Safety "strict": true, "skipLibCheck": true, - "types": ["vite/client"] + "types": ["vite/client"], + + // Alias + "paths": { + "@/*": ["./src/*"] + } } } diff --git a/vite.config.ts b/vite.config.ts index 600e29b..6098a3e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -import { fileRoutes } from "filesystem-routing/vite"; import { defineConfig } from "vite"; import solid from "@solidjs/vite-plugin"; import tailwindcss from "@tailwindcss/vite"; @@ -12,7 +11,6 @@ export default defineConfig({ // `extensions` makes @solidjs/vite-plugin also compile the `?pick=` route // modules the fileRoutes plugin emits (their ids end in a query string). solid({ start: true, extensions: [".jsx", ".tsx"], diagnostics: true }), // add `ssr: true` for streaming SSR - fileRoutes({ types: true, dir: "app" }), tailwindcss(), ], server: { @@ -23,4 +21,9 @@ export default defineConfig({ // Keep images as asset files instead of inlining them into the JS bundle. assetsInlineLimit: 0, }, + resolve: { + alias: { + "@": "/src", + }, + }, });