Skip to content

Commit 4ee7404

Browse files
masseaterclaude
andcommitted
refactor(ops-harbor): separate settings into dedicated page
Extract settings UI and logic from DashboardPage into a standalone SettingsPage with hash-based routing (#/settings), simplifying the dashboard and improving navigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ea439f4 commit 4ee7404

9 files changed

Lines changed: 394 additions & 293 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
import { useEffect, useState } from "react";
12
import { DashboardPage } from "../pages/dashboard";
3+
import { SettingsPage } from "../pages/settings";
4+
5+
function useHashRoute(): string {
6+
const [hash, setHash] = useState(window.location.hash);
7+
useEffect(() => {
8+
const handler = () => setHash(window.location.hash);
9+
window.addEventListener("hashchange", handler);
10+
return () => window.removeEventListener("hashchange", handler);
11+
}, []);
12+
return hash;
13+
}
214

315
export function App() {
16+
const hash = useHashRoute();
17+
18+
if (hash === "#/settings") {
19+
return <SettingsPage />;
20+
}
421
return <DashboardPage />;
522
}

apps/ops-harbor/src/client/app/styles.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,38 @@ input:focus {
768768
margin-bottom: 14px;
769769
}
770770

771+
/* ─── Settings Page Layout ─── */
772+
.settings-layout {
773+
min-height: 100vh;
774+
display: flex;
775+
flex-direction: column;
776+
}
777+
778+
.page-header {
779+
display: flex;
780+
align-items: center;
781+
gap: 16px;
782+
padding: 16px 24px;
783+
background: var(--bg-base);
784+
border-bottom: 1px solid var(--border-default);
785+
}
786+
787+
.page-header h1 {
788+
flex: 1;
789+
margin: 0;
790+
}
791+
792+
.settings-main {
793+
flex: 1;
794+
padding: 24px;
795+
max-width: 900px;
796+
margin: 0 auto;
797+
width: 100%;
798+
display: flex;
799+
flex-direction: column;
800+
gap: 20px;
801+
}
802+
771803
/* ─── Empty State ─── */
772804
.empty {
773805
color: var(--text-tertiary);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export async function fetchJson<T>(input: string, init?: RequestInit): Promise<T> {
2+
const response = await fetch(input, init);
3+
if (!response.ok) {
4+
throw new Error(await response.text());
5+
}
6+
return (await response.json()) as T;
7+
}

apps/ops-harbor/src/client/pages/dashboard/model/settings.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)