Skip to content

Commit 8756c0e

Browse files
authored
fix: only navigate to settings, dont toggle (#714)
1 parent 239fd2c commit 8756c0e

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

apps/twig/src/renderer/components/GlobalEventHandlers.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function GlobalEventHandlers({
2424
onToggleShortcutsSheet,
2525
commandMenuOpen,
2626
}: GlobalEventHandlersProps) {
27-
const toggleSettings = useNavigationStore((state) => state.toggleSettings);
27+
const openSettings = useNavigationStore((state) => state.openSettings);
2828
const navigateToTaskInput = useNavigationStore(
2929
(state) => state.navigateToTaskInput,
3030
);
@@ -76,8 +76,8 @@ export function GlobalEventHandlers({
7676
);
7777

7878
const handleOpenSettings = useCallback(() => {
79-
toggleSettings();
80-
}, [toggleSettings]);
79+
openSettings();
80+
}, [openSettings]);
8181

8282
const handleFocusTaskMode = useCallback(
8383
(data?: unknown) => {

apps/twig/src/renderer/components/SettingsToggle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { useNavigationStore } from "@stores/navigationStore";
44

55
export function SettingsToggle() {
66
const view = useNavigationStore((s) => s.view);
7-
const toggleSettings = useNavigationStore((s) => s.toggleSettings);
7+
const openSettings = useNavigationStore((s) => s.openSettings);
88
const isSettingsOpen = view.type === "settings";
99

1010
return (
1111
<Tooltip content="Settings">
1212
<IconButton
1313
size="1"
1414
variant="ghost"
15-
onClick={toggleSettings}
15+
onClick={openSettings}
1616
style={{
1717
color: isSettingsOpen ? "var(--blue-9)" : "var(--gray-9)",
1818
}}

apps/twig/src/renderer/stores/navigationStore.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ describe("navigationStore", () => {
6565
});
6666
});
6767

68-
it("navigates to settings and back via toggle", () => {
69-
getStore().toggleSettings();
68+
it("navigates to settings", () => {
69+
getStore().openSettings();
7070
expect(getView().type).toBe("settings");
71-
72-
getStore().toggleSettings();
73-
expect(getView().type).toBe("task-input");
7471
});
7572

7673
it("navigates to task input with folderId", () => {

apps/twig/src/renderer/stores/navigationStore.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface NavigationStore {
2929
navigateToTaskInput: (folderId?: string) => void;
3030
navigateToSettings: () => void;
3131
navigateToFolderSettings: (folderId: string) => void;
32-
toggleSettings: () => void;
32+
openSettings: () => void;
3333
goBack: () => void;
3434
goForward: () => void;
3535
canGoBack: () => boolean;
@@ -145,13 +145,8 @@ export const useNavigationStore = create<NavigationStore>()(
145145
navigate({ type: "folder-settings", folderId });
146146
},
147147

148-
toggleSettings: () => {
149-
const current = get().view;
150-
if (current.type === "settings") {
151-
get().navigateToTaskInput();
152-
} else {
153-
get().navigateToSettings();
154-
}
148+
openSettings: () => {
149+
get().navigateToSettings();
155150
},
156151

157152
goBack: () => {

0 commit comments

Comments
 (0)