Skip to content

Commit

Permalink
feat: 현재 워크스페이스 이름 표시
Browse files Browse the repository at this point in the history
  • Loading branch information
yewonJin committed Dec 4, 2024
1 parent 7462b9e commit bcfe9eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// TODO: 워크스페이스 이름 받아야함
export function WorkspaceNav() {
interface WorkspaceNavProps {
title: string;
}

export function WorkspaceNav({ title }: WorkspaceNavProps) {
return (
<div className="flex flex-row items-center justify-center gap-2">
<h1 className="text-md font-semibold">{"환영합니다 👋🏻"}</h1>
<h1 className="text-md font-semibold">{title}</h1>
</div>
);
}
2 changes: 1 addition & 1 deletion apps/frontend/src/features/workspace/index.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
19 changes: 9 additions & 10 deletions apps/frontend/src/widgets/TopNavView/ui/index.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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 (
<div className="flex w-full flex-row items-center justify-between">
<div className="flex flex-row items-center gap-2">
<UserInfoView />
<Divider direction="vertical" className="h-3" />
<WorkspaceNav />
<WorkspaceNav title={getWorkspaceTitle()} />
</div>
<div className="flex h-7 w-7 items-center justify-center">
<button onClick={onExpand}>
Expand Down

0 comments on commit bcfe9eb

Please sign in to comment.