Skip to content

Commit 0f880fd

Browse files
Merge pull request #328 from boostcampwm-2024/feature-fe-#327
현재 참여하고 있는 워크스페이스 이름 표기
2 parents cb6f82f + 0a5abfa commit 0f880fd

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
@@ -3,18 +3,32 @@ import { Menu, X } from "lucide-react";
33
import { Divider } from "@/shared/ui";
44
import { WorkspaceNav } from "@/features/pageSidebar/ui";
55
import { UserInfoView } from "@/widgets/UserInfoView/ui";
6+
import { useUserWorkspace } from "@/features/workspace/model/useWorkspace";
7+
import { useWorkspace } from "@/shared/lib/useWorkspace";
68

79
interface TopNavProps {
810
onExpand: () => void;
911
isExpanded: boolean;
1012
}
1113
export function TopNavView({ onExpand, isExpanded }: TopNavProps) {
14+
const workspace = useWorkspace();
15+
const { data } = useUserWorkspace();
16+
17+
const getWorkspaceTitle = () => {
18+
if (!workspace) return "공용 워크스페이스";
19+
20+
return (
21+
data?.workspaces.find((w) => w.workspaceId === workspace)?.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)