Skip to content

Commit 781e8f8

Browse files
committed
refactor: remove unused routing helpers
Dead code from initial implementation: - workspaceUrl() - only used internally - projectUrl() - only used internally - useAppNavigate() - never imported; RouterContext has same logic
1 parent f1ab428 commit 781e8f8

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/browser/hooks/useRouterUrlSync.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from "react";
2-
import { useLocation, useNavigate, type NavigateFunction } from "react-router-dom";
2+
import { useLocation } from "react-router-dom";
33
import { readPersistedState } from "./usePersistedState";
44
import { SELECTED_WORKSPACE_KEY } from "@/common/constants/storage";
55
import type { WorkspaceSelection } from "@/browser/components/ProjectSidebar";
@@ -79,42 +79,3 @@ export function useRouterUrlSync(): void {
7979
}
8080
}, [location.pathname, location.search]);
8181
}
82-
83-
/**
84-
* Creates URL for navigating to a workspace
85-
*/
86-
export function workspaceUrl(workspaceId: string): string {
87-
return `/workspace/${encodeURIComponent(workspaceId)}`;
88-
}
89-
90-
/**
91-
* Creates URL for the project page (workspace creation)
92-
*/
93-
export function projectUrl(projectPath: string): string {
94-
return `/project?path=${encodeURIComponent(projectPath)}`;
95-
}
96-
97-
/**
98-
* Hook that returns typed navigation helpers
99-
*/
100-
export function useAppNavigate(): {
101-
navigate: NavigateFunction;
102-
toWorkspace: (workspaceId: string) => void;
103-
toProject: (projectPath: string) => void;
104-
toHome: () => void;
105-
} {
106-
const navigate = useNavigate();
107-
108-
return {
109-
navigate,
110-
toWorkspace: (workspaceId: string) => {
111-
void navigate(workspaceUrl(workspaceId), { replace: true });
112-
},
113-
toProject: (projectPath: string) => {
114-
void navigate(projectUrl(projectPath), { replace: true });
115-
},
116-
toHome: () => {
117-
void navigate("/", { replace: true });
118-
},
119-
};
120-
}

0 commit comments

Comments
 (0)