Skip to content

Commit a7a1edf

Browse files
committed
feat: 현재 참여하고 있는 워크스페이스 이름 표기
1 parent 8ce0fd5 commit a7a1edf

File tree

1 file changed

+15
-1
lines changed
  • apps/frontend/src/widgets/TopNavView/ui

1 file changed

+15
-1
lines changed

apps/frontend/src/widgets/TopNavView/ui/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1+
import { useParams } from "@tanstack/react-router";
12
import { Menu, X } from "lucide-react";
23

34
import { Divider } from "@/shared/ui";
45
import { WorkspaceNav } from "@/features/pageSidebar/ui";
56
import { UserInfoView } from "@/widgets/UserInfoView/ui";
7+
import { useUserWorkspace } from "@/features/workspace/model/useWorkspace";
68

79
interface TopNavProps {
810
onExpand: () => void;
911
isExpanded: boolean;
1012
}
1113
export function TopNavView({ onExpand, isExpanded }: TopNavProps) {
14+
const { workspaceId } = useParams({ strict: false });
15+
const { data } = useUserWorkspace();
16+
17+
const getWorkspaceTitle = () => {
18+
if (!workspaceId) return "공용 워크스페이스";
19+
20+
return (
21+
data?.workspaces.find((w) => w.workspaceId === workspaceId)?.title ??
22+
"로딩 중..."
23+
);
24+
};
25+
1226
return (
1327
<div className="flex w-full flex-row items-center justify-between">
1428
<div className="flex flex-row items-center gap-2">
1529
<UserInfoView />
1630
<Divider direction="vertical" className="h-3" />
17-
<WorkspaceNav workspaceTitle="프로젝트 Web15" />
31+
<WorkspaceNav workspaceTitle={getWorkspaceTitle()} />
1832
</div>
1933
<div className="flex h-7 w-7 items-center justify-center">
2034
<button onClick={onExpand}>

0 commit comments

Comments
 (0)