Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ui): let the caption back arrow always reach the front page

rubenluetke10-beep0868a60d51c3
diff --git a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
index 1f9594cc64..2a8ddf8009 100644
--- a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
@@ -44,8 +44,8 @@ describe("SectionNavButtons", () => {
}
});
- it("leaves a freshly opened agents section for the front page", () => {
- useEventStore.setState({ activeSection: "agents" });
+ it.each(["agents", "agentic-ide", "profile"] as const)("leaves a freshly opened %s section for the front page", (section) => {
+ useEventStore.setState({ activeSection: section });
render(<SectionNavButtons />);
expect(backButton().disabled).toBe(false);
diff --git a/jarvis/ui/web/frontend/src/hooks/useSectionHistory.test.ts b/jarvis/ui/web/frontend/src/hooks/useSectionHistory.test.ts
index 5e4b2b0f42..71e8a50f1f 100644
--- a/jarvis/ui/web/frontend/src/hooks/useSectionHistory.test.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useSectionHistory.test.ts
@@ -109,8 +109,8 @@ describe("useSectionHistory", () => {
expect(useEventStore.getState().activeSection).toBe("agents");
});
- it("leaves a freshly opened agents section for the front page", () => {
- useEventStore.setState({ activeSection: "agents" });
+ it.each(["agents", "dictation", "board"] as const)("leaves a freshly opened %s section for the front page", (section) => {
+ useEventStore.setState({ activeSection: section });
const { result } = renderHook(() => useSectionHistory());
expect(result.current.canGoBack).toBe(true);
diff --git a/jarvis/ui/web/frontend/src/hooks/useSectionHistory.ts b/jarvis/ui/web/frontend/src/hooks/useSectionHistory.ts
index 172c1c4819..7ad4cf7a8d 100644
--- a/jarvis/ui/web/frontend/src/hooks/useSectionHistory.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useSectionHistory.ts
@@ -11,6 +11,13 @@ import { useEventStore, type SectionId } from "@/store/events";
*/
const MAX_HISTORY = 50;
+/**
+ * The front page. Back always reaches it: every other section can be left
+ * even with no earlier visit (a fresh launch into the IDE, a restored
+ * section), so nobody is ever stranded without a way home.
+ */
+const HOME: SectionId = "chats";
+
interface SectionNavHistoryState {
/** The section the stacks were last reconciled with. Null until observed. */
current: SectionId | null;
@@ -64,20 +71,20 @@ export const useSectionNavHistory = create<SectionNavHistoryState>((set, get) =>
goBack: () => {
const { current, past, future } = get();
const section = current ?? useEventStore.getState().activeSection;
- // Agents has no sidebar. With no earlier visit, back still leaves it
- // for the front page — that is what replaced the sidebar toggle.
- if (section === "agents" && past.length === 0) {
- const home: SectionId[] = ["agents", ...future];
+ // With no earlier visit, back still leaves any section for the front
+ // page — only the front page itself has nowhere further to go.
+ if (past.length === 0) {
+ if (section === HOME) return null;
set({
- current: "chats",
+ current: HOME,
past: [],
- future: home.slice(0, MAX_HISTORY),
+ future: [section, ...future].slice(0, MAX_HISTORY),
navigating: true,
});
- useEventStore.getState().setActiveSection("chats");
- return "chats";
+ useEventStore.getState().setActiveSection(HOME);
+ return HOME;
}
- if (current === null || past.length === 0) return null;
+ if (current === null) return null;
const target = past[past.length - 1];
if (target === current) {
set({ past: past.slice(0, -1) });
@@ -135,8 +142,8 @@ export interface SectionHistory {
* path would cover one. "Back" returns to the previously visited section and
* "forward" only re-applies an undone step: it stays disabled until a step was
* undone, and any new visit clears the redo stack, because a section never
- * visited cannot be gone to. Agents is the exception: it fills the window and
- * has no sidebar, so back leaves it for the front page even on the first visit.
+ * visited cannot be gone to. With no earlier visit, back still leads from any
+ * section to the front page, so there is always a way home.
*/
export function useSectionHistory(): SectionHistory {
const activeSection = useEventStore((s) => s.activeSection);
@@ -151,7 +158,7 @@ export function useSectionHistory(): SectionHistory {
}, [activeSection, record]);
return {
- canGoBack: past.length > 0 || activeSection === "agents",
+ canGoBack: past.length > 0 || activeSection !== HOME,
canGoForward: future.length > 0,
goBack,
goForward,