Refactor: 페이지 링크 수정
This commit is contained in:
parent
c6fc24c933
commit
a803353449
@ -1,4 +1,4 @@
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import ProjectCard from '@/components/ProjectCard';
|
||||
import { Smile } from 'lucide-react';
|
||||
import ProjectCreateModal from '../components/ProjectCreateModal';
|
||||
@ -14,7 +14,6 @@ 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);
|
||||
@ -43,7 +42,6 @@ export default function WorkspaceBrowseDetail() {
|
||||
<ProjectList
|
||||
projects={projects}
|
||||
workspaceId={workspaceId}
|
||||
navigate={navigate}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@ -86,15 +84,7 @@ function EmptyStateMessage({ workspaceId }: { workspaceId: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function ProjectList({
|
||||
projects,
|
||||
workspaceId,
|
||||
navigate,
|
||||
}: {
|
||||
projects: ProjectResponse[];
|
||||
workspaceId: number;
|
||||
navigate: ReturnType<typeof useNavigate>;
|
||||
}) {
|
||||
function ProjectList({ projects, workspaceId }: { projects: ProjectResponse[]; workspaceId: number }) {
|
||||
if (projects.length === 0) {
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center">
|
||||
@ -110,14 +100,15 @@ function ProjectList({
|
||||
return (
|
||||
<div className="flex flex-wrap gap-6">
|
||||
{projects.map((project: ProjectResponse) => (
|
||||
<ProjectCard
|
||||
<Link
|
||||
key={project.id}
|
||||
title={project.title}
|
||||
description={project.projectType}
|
||||
onClick={() => {
|
||||
navigate(`${webPath.workspace()}/${workspaceId}/project/${project.id}`);
|
||||
}}
|
||||
/>
|
||||
to={`${webPath.workspace()}/${workspaceId}/project/${project.id}`}
|
||||
>
|
||||
<ProjectCard
|
||||
title={project.title}
|
||||
description={project.projectType}
|
||||
/>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user