diff --git a/frontend/src/components/AdminProjectSidebar/index.tsx b/frontend/src/components/AdminProjectSidebar/index.tsx index 9fedc11..fecc452 100644 --- a/frontend/src/components/AdminProjectSidebar/index.tsx +++ b/frontend/src/components/AdminProjectSidebar/index.tsx @@ -1,5 +1,5 @@ import { ResizablePanel, ResizableHandle } from '../ui/resizable'; -import { Link, useLocation, useParams } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; import { SquarePen } from 'lucide-react'; import useProjectListQuery from '@/queries/projects/useProjectListQuery'; import useCreateProjectQuery from '@/queries/projects/useCreateProjectQuery'; @@ -11,6 +11,7 @@ import { cn } from '@/lib/utils'; export default function AdminProjectSidebar(): JSX.Element { const location = useLocation(); + const navigate = useNavigate(); const { workspaceId } = useParams<{ workspaceId: string }>(); const profile = useAuthStore((state) => state.profile); const memberId = profile?.id || 0; @@ -33,6 +34,13 @@ export default function AdminProjectSidebar(): JSX.Element { const selectedProjectId = new URLSearchParams(location.search).get('projectId'); + const handleHeaderClick = () => { + navigate({ + pathname: location.pathname, + search: '', + }); + }; + return ( <>

{ - window.history.replaceState({}, '', location.pathname); - }} + onClick={handleHeaderClick} > {workspaceTitle}

diff --git a/frontend/src/pages/WorkspaceBrowseDetail.tsx b/frontend/src/pages/WorkspaceBrowseDetail.tsx index 82b99c2..9d15422 100644 --- a/frontend/src/pages/WorkspaceBrowseDetail.tsx +++ b/frontend/src/pages/WorkspaceBrowseDetail.tsx @@ -1,4 +1,4 @@ -import { Link, useParams } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; import ProjectCard from '@/components/ProjectCard'; import { Smile } from 'lucide-react'; import ProjectCreateModal from '../components/ProjectCreateModal'; @@ -14,6 +14,7 @@ export default function WorkspaceBrowseDetail() { const workspaceId = Number(params.workspaceId); const { profile } = useAuthStore(); const memberId = profile?.id ?? 0; + const navigate = useNavigate(); const { data: workspaceData } = useWorkspaceQuery(workspaceId, memberId); const { data: projectsResponse, isError } = useProjectListQuery(workspaceId, memberId); @@ -42,6 +43,7 @@ export default function WorkspaceBrowseDetail() { )} @@ -84,7 +86,14 @@ function EmptyStateMessage({ workspaceId }: { workspaceId: number }) { ); } -function ProjectList({ projects, workspaceId }: { projects: ProjectResponse[]; workspaceId: number }) { +function ProjectList({ + projects, + workspaceId, +}: { + projects: ProjectResponse[]; + workspaceId: number; + navigate: ReturnType; +}) { if (projects.length === 0) { return (
@@ -100,7 +109,7 @@ function ProjectList({ projects, workspaceId }: { projects: ProjectResponse[]; w return (
{projects.map((project: ProjectResponse) => ( -