Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useConnectionStore } from "../../stores/connectionStore";
import { useEditorStore } from "../../stores/editorStore";
import { useResultStore } from "../../stores/resultStore";
import { useSettingsStore } from "../../stores/settingsStore";
import { useThemeStore } from "../../stores/themeStore";
import { AIChatPanel } from "../ai/AIChatPanel";
import { BackupDialog } from "../backup/BackupDialog";
import { RestoreDialog } from "../backup/RestoreDialog";
Expand Down Expand Up @@ -161,6 +162,18 @@ export function AppLayout() {
case "check-for-updates":
void useSettingsStore.getState().checkForUpdates();
break;
case "cycle-theme":
// Cycle Dark → Light → System, mirroring Toolbar.cycleTheme so
// macOS users get the same one-click action as everyone else.
// (refs #453)
{
const themeStore = useThemeStore.getState();
const themeOrder = ["dark", "light", "system"] as const;
const idx = themeOrder.indexOf(themeStore.theme);
const next = themeOrder[(idx + 1) % themeOrder.length];
themeStore.setTheme(next);
}
break;
case "about":
setHelpTab("about");
setShowShortcuts(true);
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout/MenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const MENUS: MenuDef[] = [
items: [
{ type: "item", id: "check-for-updates", label: "Check for Updates…" },
{ type: "separator" },
{ type: "item", id: "cycle-theme", label: "Cycle Theme (Dark / Light / System)" },
{ type: "separator" },
{ type: "item", id: "keyboard-shortcuts", label: "Keyboard Shortcuts", shortcut: "F1" },
{ type: "separator" },
{ type: "item", id: "about", label: "About SQLPilot" },
Expand Down
17 changes: 17 additions & 0 deletions src/components/layout/__tests__/MenuBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,21 @@ describe("MenuBar", () => {
expect.objectContaining({ detail: "check-for-updates" }),
);
});

it("includes a 'Cycle Theme' entry under the Help menu (refs #453)", () => {
render(<MenuBar />);

fireEvent.click(screen.getByText("Help"));
expect(screen.getByText(/Cycle Theme/)).toBeInTheDocument();
});

it("dispatches 'cycle-theme' menu-action when the entry is clicked", () => {
render(<MenuBar />);

fireEvent.click(screen.getByText("Help"));
fireEvent.click(screen.getByText(/Cycle Theme/));
expect(dispatchSpy).toHaveBeenCalledWith(
expect.objectContaining({ detail: "cycle-theme" }),
);
});
});
Loading