diff --git a/apps/frontend/src/features/pageSidebar/ui/WorkspaceNav/index.tsx b/apps/frontend/src/features/pageSidebar/ui/WorkspaceNav/index.tsx index f4c8c3d7..580d14f7 100644 --- a/apps/frontend/src/features/pageSidebar/ui/WorkspaceNav/index.tsx +++ b/apps/frontend/src/features/pageSidebar/ui/WorkspaceNav/index.tsx @@ -1,8 +1,11 @@ -// TODO: 워크스페이스 이름 받아야함 -export function WorkspaceNav() { +interface WorkspaceNavProps { + title: string; +} + +export function WorkspaceNav({ title }: WorkspaceNavProps) { return (
-

{"환영합니다 👋🏻"}

+

{title}

); } diff --git a/apps/frontend/src/features/workspace/index.ts b/apps/frontend/src/features/workspace/index.ts index 88c5464b..02a0ed79 100644 --- a/apps/frontend/src/features/workspace/index.ts +++ b/apps/frontend/src/features/workspace/index.ts @@ -1,4 +1,4 @@ -export { useUserWorkspace } from "./model/workspaceQuries"; +export { useUserWorkspace, useCurrentWorkspace } from "./model/workspaceQuries"; export { useProtectedWorkspace } from "./model/useProtectedWorkspace"; export { useValidateWorkspaceInviteLink } from "./model/workspaceMutations"; diff --git a/apps/frontend/src/widgets/TopNavView/ui/index.tsx b/apps/frontend/src/widgets/TopNavView/ui/index.tsx index 6f58f70a..10007d7f 100644 --- a/apps/frontend/src/widgets/TopNavView/ui/index.tsx +++ b/apps/frontend/src/widgets/TopNavView/ui/index.tsx @@ -1,6 +1,7 @@ import { Menu, X } from "lucide-react"; import { WorkspaceNav } from "@/features/pageSidebar"; +import { useCurrentWorkspace } from "@/features/workspace"; import { UserInfoView } from "@/widgets/UserInfoView"; import { Divider } from "@/shared/ui"; @@ -9,24 +10,22 @@ interface TopNavProps { isExpanded: boolean; } export function TopNavView({ onExpand, isExpanded }: TopNavProps) { - /* const workspace = useWorkspace(); - const { data } = useUserWorkspace(); */ + const { data } = useCurrentWorkspace(); - /* const getWorkspaceTitle = () => { - if (!workspace) return "공용 워크스페이스"; + const getWorkspaceTitle = () => { + if (!data) return "로딩 중"; - return ( - data?.workspaces.find((w) => w.workspaceId === workspace)?.title ?? - "로딩 중..." - ); - }; */ + if (data.workspace.workspaceId === "main") return "공용 워크스페이스"; + + return data.workspace.title; + }; return (
- +