|
1 | 1 | import { useEffect } from "react"; |
2 | | -import { useLocation, useNavigate, type NavigateFunction } from "react-router-dom"; |
| 2 | +import { useLocation } from "react-router-dom"; |
3 | 3 | import { readPersistedState } from "./usePersistedState"; |
4 | 4 | import { SELECTED_WORKSPACE_KEY } from "@/common/constants/storage"; |
5 | 5 | import type { WorkspaceSelection } from "@/browser/components/ProjectSidebar"; |
@@ -79,42 +79,3 @@ export function useRouterUrlSync(): void { |
79 | 79 | } |
80 | 80 | }, [location.pathname, location.search]); |
81 | 81 | } |
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