Skip to content

Commit bcfe9eb

Browse files
committed
feat: 현재 워크스페이스 이름 표시
1 parent 7462b9e commit bcfe9eb

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
// TODO: 워크스페이스 이름 받아야함
2-
export function WorkspaceNav() {
1+
interface WorkspaceNavProps {
2+
title: string;
3+
}
4+
5+
export function WorkspaceNav({ title }: WorkspaceNavProps) {
36
return (
47
<div className="flex flex-row items-center justify-center gap-2">
5-
<h1 className="text-md font-semibold">{"환영합니다 👋🏻"}</h1>
8+
<h1 className="text-md font-semibold">{title}</h1>
69
</div>
710
);
811
}

apps/frontend/src/features/workspace/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { useUserWorkspace } from "./model/workspaceQuries";
1+
export { useUserWorkspace, useCurrentWorkspace } from "./model/workspaceQuries";
22
export { useProtectedWorkspace } from "./model/useProtectedWorkspace";
33
export { useValidateWorkspaceInviteLink } from "./model/workspaceMutations";
44

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Menu, X } from "lucide-react";
22

33
import { WorkspaceNav } from "@/features/pageSidebar";
4+
import { useCurrentWorkspace } from "@/features/workspace";
45
import { UserInfoView } from "@/widgets/UserInfoView";
56
import { Divider } from "@/shared/ui";
67

@@ -9,24 +10,22 @@ interface TopNavProps {
910
isExpanded: boolean;
1011
}
1112
export function TopNavView({ onExpand, isExpanded }: TopNavProps) {
12-
/* const workspace = useWorkspace();
13-
const { data } = useUserWorkspace(); */
13+
const { data } = useCurrentWorkspace();
1414

15-
/* const getWorkspaceTitle = () => {
16-
if (!workspace) return "공용 워크스페이스";
15+
const getWorkspaceTitle = () => {
16+
if (!data) return "로딩 중";
1717

18-
return (
19-
data?.workspaces.find((w) => w.workspaceId === workspace)?.title ??
20-
"로딩 중..."
21-
);
22-
}; */
18+
if (data.workspace.workspaceId === "main") return "공용 워크스페이스";
19+
20+
return data.workspace.title;
21+
};
2322

2423
return (
2524
<div className="flex w-full flex-row items-center justify-between">
2625
<div className="flex flex-row items-center gap-2">
2726
<UserInfoView />
2827
<Divider direction="vertical" className="h-3" />
29-
<WorkspaceNav />
28+
<WorkspaceNav title={getWorkspaceTitle()} />
3029
</div>
3130
<div className="flex h-7 w-7 items-center justify-center">
3231
<button onClick={onExpand}>

0 commit comments

Comments
 (0)