Skip to content

Commit 1d22634

Browse files
committed
style(dashboard): fix all Biome lint violations
Cleanup pass bringing dashboard/src to zero Biome errors: Auto-fixable (`biome check --write`): - Import sort, trailing commas, semicolons - Single quotes to double quotes (matching plugin + config rule) - Single-line object/expr expansion to line-width 100 - Arrow param parens (s => ... -> (s) => ...) Manual a11y fixes: - <button type="button"> on every button (useButtonType) - Clickable cards / category headers / closeable spans: <div onClick> -> <button type="button"> with matching 'cursor: pointer; text-align: left; width: 100%' styling (noStaticElementInteractions, useSemanticElements) - Where button semantics don't fit: role="button", tabindex="0", and onKeyDown handlers mirroring onClick for Enter/Space (useKeyWithClickEvents) Manual noNonNullAssertion fixes: - Solid <Show when={x}>{(t) => ...}</Show> callback pattern to replace `x!` downstream - `x ?? fallback` for string/number defaults - Early return guards replacing `x!.field` patterns Other: - Explicit `type` annotation on `let` declarations (noImplicitAnyLet) - One CSS selector reorder to fix noDescendingSpecificity - Removed a duplicate JSX prop (noDuplicateJsxProps) - <label>s without inputs converted to <span> or given `for=` 18 files changed, +2493/-1115 lines — the bulk is auto-formatting (single-line object literals expanded to multi-line under line-width 100). Whitespace-ignoring diff is much smaller (substantive logic unchanged). Verification: 0 Biome errors, dashboard build clean, cargo check clean, plugin test suite (679 passing) unaffected.
1 parent d5cd0bc commit 1d22634

18 files changed

Lines changed: 2492 additions & 1115 deletions

File tree

packages/dashboard/src/App.tsx

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { createSignal, createResource, Show, onMount, onCleanup, ErrorBoundary } from "solid-js";
2-
import type { NavSection, DbHealth } from "./lib/types";
3-
import { getDbHealth, getAvailableModels } from "./lib/api";
4-
import { checkForUpdate, installAndRelaunch, runUpdater } from "./lib/updater";
51
import { listen } from "@tauri-apps/api/event";
2+
import { createResource, createSignal, ErrorBoundary, onCleanup, onMount, Show } from "solid-js";
3+
import CacheDiagnostics from "./components/CacheDiagnostics/CacheDiagnostics";
4+
import ConfigEditor from "./components/ConfigEditor/ConfigEditor";
5+
import DreamerPanel from "./components/DreamerPanel/DreamerPanel";
66
import Sidebar from "./components/Layout/Sidebar";
77
import StatusBar from "./components/Layout/StatusBar";
8+
import LogViewer from "./components/LogViewer/LogViewer";
89
import MemoryBrowser from "./components/MemoryBrowser/MemoryBrowser";
910
import SessionViewer from "./components/SessionViewer/SessionViewer";
10-
import CacheDiagnostics from "./components/CacheDiagnostics/CacheDiagnostics";
11-
import DreamerPanel from "./components/DreamerPanel/DreamerPanel";
1211
import UserMemories from "./components/UserMemories/UserMemories";
13-
import ConfigEditor from "./components/ConfigEditor/ConfigEditor";
14-
import LogViewer from "./components/LogViewer/LogViewer";
12+
import { getAvailableModels, getDbHealth } from "./lib/api";
13+
import type { NavSection } from "./lib/types";
14+
import { checkForUpdate, installAndRelaunch, runUpdater } from "./lib/updater";
1515

1616
const MODELS_CACHE_KEY = "mc_dashboard_models_cache";
1717
const UPDATE_POLL_INTERVAL = 10 * 60 * 1000; // 10 minutes
@@ -20,7 +20,9 @@ function loadCachedModels(): string[] {
2020
try {
2121
const raw = localStorage.getItem(MODELS_CACHE_KEY);
2222
return raw ? JSON.parse(raw) : [];
23-
} catch { return []; }
23+
} catch {
24+
return [];
25+
}
2426
}
2527

2628
export default function App() {
@@ -33,10 +35,16 @@ export default function App() {
3335

3436
// Background model refresh
3537
onMount(() => {
36-
getAvailableModels().then((fresh) => {
37-
setAvailableModels(fresh);
38-
try { localStorage.setItem(MODELS_CACHE_KEY, JSON.stringify(fresh)); } catch {}
39-
}).catch(() => { /* keep cached */ });
38+
getAvailableModels()
39+
.then((fresh) => {
40+
setAvailableModels(fresh);
41+
try {
42+
localStorage.setItem(MODELS_CACHE_KEY, JSON.stringify(fresh));
43+
} catch {}
44+
})
45+
.catch(() => {
46+
/* keep cached */
47+
});
4048
});
4149

4250
// Background update polling
@@ -52,16 +60,22 @@ export default function App() {
5260
poll();
5361
updateInterval = setInterval(poll, UPDATE_POLL_INTERVAL);
5462
});
55-
onCleanup(() => { if (updateInterval) clearInterval(updateInterval); });
63+
onCleanup(() => {
64+
if (updateInterval) clearInterval(updateInterval);
65+
});
5666

5767
// Listen for "Check for Updates" tray menu event
5868
let unlistenUpdate: (() => void) | undefined;
5969
onMount(() => {
6070
listen("check-for-updates", () => {
6171
runUpdater({ alertOnFail: true });
62-
}).then((unlisten) => { unlistenUpdate = unlisten; });
72+
}).then((unlisten) => {
73+
unlistenUpdate = unlisten;
74+
});
75+
});
76+
onCleanup(() => {
77+
unlistenUpdate?.();
6378
});
64-
onCleanup(() => { unlistenUpdate?.(); });
6579

6680
const handleInstall = async () => {
6781
setUpdateInstalling(true);
@@ -87,29 +101,31 @@ export default function App() {
87101
</div>
88102
<div class="update-toast-actions">
89103
<button
104+
type="button"
90105
class="btn primary sm"
91106
disabled={updateInstalling()}
92107
onClick={handleInstall}
93108
>
94109
{updateInstalling() ? "Installing..." : "Install & Restart"}
95110
</button>
96-
<button
97-
class="btn sm"
98-
onClick={() => setUpdateDismissed(true)}
99-
>
111+
<button type="button" class="btn sm" onClick={() => setUpdateDismissed(true)}>
100112
Later
101113
</button>
102114
</div>
103115
</div>
104116
</Show>
105117

106-
<ErrorBoundary fallback={(err, reset) => (
107-
<div class="error-boundary">
108-
<h2>Something went wrong</h2>
109-
<p>{err?.message || "An unexpected error occurred"}</p>
110-
<button class="btn primary" onClick={reset}>Try Again</button>
111-
</div>
112-
)}>
118+
<ErrorBoundary
119+
fallback={(err, reset) => (
120+
<div class="error-boundary">
121+
<h2>Something went wrong</h2>
122+
<p>{err?.message || "An unexpected error occurred"}</p>
123+
<button type="button" class="btn primary" onClick={reset}>
124+
Try Again
125+
</button>
126+
</div>
127+
)}
128+
>
113129
<Show when={activeSection() === "memories"}>
114130
<MemoryBrowser />
115131
</Show>

0 commit comments

Comments
 (0)