feat(app): apply theme from daemon config on load and live
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -7,9 +7,9 @@ import { Wizard } from "./Wizard";
|
|||||||
import { ConfirmDelete } from "./ConfirmDelete";
|
import { ConfirmDelete } from "./ConfirmDelete";
|
||||||
import { EventCenter } from "./EventCenter";
|
import { EventCenter } from "./EventCenter";
|
||||||
import { maybeNotify } from "./notify";
|
import { maybeNotify } from "./notify";
|
||||||
import { COLORS } from "./theme";
|
import { COLORS, applyTheme } from "./theme";
|
||||||
import { getStatusFull, applyPreset, onDaemonEvent, onDaemonRawEvent, setWorkspaceMeta, focusSurface, getEventLog, markEventsRead, getHealth, closeWorkspaceCmd } from "./socketBridge";
|
import { getStatusFull, applyPreset, onDaemonEvent, onDaemonRawEvent, setWorkspaceMeta, focusSurface, getEventLog, markEventsRead, getHealth, closeWorkspaceCmd, getConfig } from "./socketBridge";
|
||||||
import type { EventRecord, DaemonHealth } from "./socketBridge";
|
import type { EventRecord, DaemonHealth, ConfigView } from "./socketBridge";
|
||||||
import { leafIds } from "./layoutTypes";
|
import { leafIds } from "./layoutTypes";
|
||||||
import type { Group, WorkspaceView, SurfaceState } from "./layoutTypes";
|
import type { Group, WorkspaceView, SurfaceState } from "./layoutTypes";
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ export function App() {
|
|||||||
const [eventsOpen, setEventsOpen] = useState(() => loadFlag("spacesh.eventsOpen", true));
|
const [eventsOpen, setEventsOpen] = useState(() => loadFlag("spacesh.eventsOpen", true));
|
||||||
const [sidebarOpen, setSidebarOpen] = useState(() => loadFlag("spacesh.sidebarOpen", true));
|
const [sidebarOpen, setSidebarOpen] = useState(() => loadFlag("spacesh.sidebarOpen", true));
|
||||||
const [health, setHealth] = useState<DaemonHealth | null>(null);
|
const [health, setHealth] = useState<DaemonHealth | null>(null);
|
||||||
|
const [config, setConfigState] = useState<ConfigView | null>(null);
|
||||||
const [connected, setConnected] = useState(false);
|
const [connected, setConnected] = useState(false);
|
||||||
const [focusedId, setFocusedId] = useState<string | null>(null);
|
const [focusedId, setFocusedId] = useState<string | null>(null);
|
||||||
const [searchSurfaceId, setSearchSurfaceId] = useState<string | null>(null);
|
const [searchSurfaceId, setSearchSurfaceId] = useState<string | null>(null);
|
||||||
@@ -78,6 +79,7 @@ export function App() {
|
|||||||
void refresh();
|
void refresh();
|
||||||
void seedEvents();
|
void seedEvents();
|
||||||
void loadHealth();
|
void loadHealth();
|
||||||
|
void getConfig().then((c) => { setConfigState(c); applyTheme(c.theme, c.accent); }).catch(() => {});
|
||||||
const unlisten = onDaemonEvent((evt) => {
|
const unlisten = onDaemonEvent((evt) => {
|
||||||
if (evt.evt === "event") {
|
if (evt.evt === "event") {
|
||||||
const rec = evt.data.record;
|
const rec = evt.data.record;
|
||||||
@@ -93,6 +95,10 @@ export function App() {
|
|||||||
void refresh();
|
void refresh();
|
||||||
} else if (evt.evt === "exit") {
|
} else if (evt.evt === "exit") {
|
||||||
void refresh();
|
void refresh();
|
||||||
|
} else if (evt.evt === "config_changed") {
|
||||||
|
const c = evt.data.config;
|
||||||
|
setConfigState(c);
|
||||||
|
applyTheme(c.theme, c.accent);
|
||||||
} else {
|
} else {
|
||||||
void refresh();
|
void refresh();
|
||||||
}
|
}
|
||||||
@@ -102,6 +108,7 @@ export function App() {
|
|||||||
void refresh();
|
void refresh();
|
||||||
void seedEvents();
|
void seedEvents();
|
||||||
void loadHealth();
|
void loadHealth();
|
||||||
|
void getConfig().then((c) => { setConfigState(c); applyTheme(c.theme, c.accent); }).catch(() => {});
|
||||||
});
|
});
|
||||||
return () => { void unlisten.then((f) => f()); void reconnect.then((f) => f()); };
|
return () => { void unlisten.then((f) => f()); void reconnect.then((f) => f()); };
|
||||||
}, [refresh, seedEvents, loadHealth]);
|
}, [refresh, seedEvents, loadHealth]);
|
||||||
|
|||||||
Reference in New Issue
Block a user