diff --git a/src/entities/workspace/index.ts b/src/entities/workspace/index.ts index a44d0a6..86cdcdd 100644 --- a/src/entities/workspace/index.ts +++ b/src/entities/workspace/index.ts @@ -1,3 +1,3 @@ // 목업 워크스페이스 데이터와 타입의 공개 API입니다. -export type { Workspace } from './model/workspace.types'; +export type { Workspace, WorkspacePurpose } from './model/workspace.types'; export { mockWorkspace } from './model/mock-workspace'; diff --git a/src/entities/workspace/model/workspace.types.ts b/src/entities/workspace/model/workspace.types.ts index 2560d7a..9002dc7 100644 --- a/src/entities/workspace/model/workspace.types.ts +++ b/src/entities/workspace/model/workspace.types.ts @@ -1,6 +1,8 @@ // Supabase 워크스페이스 데이터 연결 전 shell에서 사용하는 워크스페이스 타입입니다. +export type WorkspacePurpose = 'team-project' | 'side-project' | 'store-operation'; + export interface Workspace { id: string; name: string; - purpose: 'store-operation' | 'team-project' | 'side-project'; + purpose: WorkspacePurpose; } diff --git a/src/widgets/workspace-shell/lib/get-workspace-navigation.ts b/src/widgets/workspace-shell/lib/get-workspace-navigation.ts new file mode 100644 index 0000000..7a31e6d --- /dev/null +++ b/src/widgets/workspace-shell/lib/get-workspace-navigation.ts @@ -0,0 +1,7 @@ +// 워크스페이스 목적에 맞는 shell navigation 항목을 반환합니다. +import type { WorkspacePurpose } from '@/entities/workspace'; +import { workspaceNavigationByPurpose } from '@/widgets/workspace-shell/model/workspace-navigation'; + +export function getWorkspaceNavigation(purpose: WorkspacePurpose) { + return workspaceNavigationByPurpose[purpose]; +} diff --git a/src/widgets/workspace-shell/model/workspace-navigation.ts b/src/widgets/workspace-shell/model/workspace-navigation.ts index cfdf025..cb56ede 100644 --- a/src/widgets/workspace-shell/model/workspace-navigation.ts +++ b/src/widgets/workspace-shell/model/workspace-navigation.ts @@ -1,4 +1,5 @@ // 워크스페이스 목적별 사이드바 메뉴 항목을 정의합니다. +import type { WorkspacePurpose } from '@/entities/workspace'; import { Bell, Calendar, @@ -7,6 +8,9 @@ import { LayoutDashboard, MessageSquare, Settings, + Rocket, + FileText, + BarChart3, type LucideIcon, } from 'lucide-react'; @@ -27,26 +31,32 @@ export const storeOperationNavigationItems: WorkspaceNavigationItem[] = [ ]; // TODO: 사이드 프로젝트 도메인을 만들 때 아래 메뉴를 별도 purpose 전용 사이드바로 연결합니다. -// export const sideProjectNavigationItems: WorkspaceNavigationItem[] = [ -// { label: '대시보드', href: 'dashboard', icon: LayoutDashboard }, -// { label: '스프린트 보드', href: 'sprint-board', icon: Rocket }, -// { label: '캘린더', href: 'calendar', icon: Calendar }, -// { label: '회의록', href: 'meeting-notes', icon: FileText }, -// { label: '자료실', href: 'files', icon: FileBox }, -// { label: '채팅', href: 'chat', icon: MessageSquare }, -// { label: '진행률 차트', href: 'progress-chart', icon: BarChart3 }, -// { label: '설정', href: 'settings', icon: Settings }, -// ]; +export const sideProjectNavigationItems: WorkspaceNavigationItem[] = [ + { label: '대시보드', href: 'dashboard', icon: LayoutDashboard }, + { label: '스프린트 보드', href: 'sprint-board', icon: Rocket }, + { label: '캘린더', href: 'calendar', icon: Calendar }, + { label: '회의록', href: 'meeting-notes', icon: FileText }, + { label: '자료실', href: 'files', icon: FileBox }, + { label: '채팅', href: 'chat', icon: MessageSquare }, + { label: '진행률 차트', href: 'progress-chart', icon: BarChart3 }, + { label: '설정', href: 'settings', icon: Settings }, +]; // TODO: 팀 프로젝트 도메인을 만들 때 아래 메뉴를 별도 purpose 전용 사이드바로 연결합니다. -// export const sideProjectNavigationItems: WorkspaceNavigationItem[] = [ -// { label: '대시보드', href: 'dashboard', icon: LayoutDashboard }, -// { label: '프로젝트 관리', href: 'sprint-board', icon: Rocket }, -// { label: '캘린더', href: 'calendar', icon: Calendar }, -// { label: '공지', href: 'notices', icon: Bell }, -// { label: '회의록', href: 'meeting-notes', icon: FileText }, -// { label: '자료실', href: 'files', icon: FileBox }, -// { label: '채팅', href: 'chat', icon: MessageSquare }, -// { label: '진행률 차트', href: 'progress-chart', icon: BarChart3 }, -// { label: '설정', href: 'settings', icon: Settings }, -// ]; +export const teamProjectNavigationItems: WorkspaceNavigationItem[] = [ + { label: '대시보드', href: 'dashboard', icon: LayoutDashboard }, + { label: '프로젝트 관리', href: 'sprint-board', icon: Rocket }, + { label: '캘린더', href: 'calendar', icon: Calendar }, + { label: '공지', href: 'notices', icon: Bell }, + { label: '회의록', href: 'meeting-notes', icon: FileText }, + { label: '자료실', href: 'files', icon: FileBox }, + { label: '채팅', href: 'chat', icon: MessageSquare }, + { label: '진행률 차트', href: 'progress-chart', icon: BarChart3 }, + { label: '설정', href: 'settings', icon: Settings }, +]; + +export const workspaceNavigationByPurpose = { + 'store-operation': storeOperationNavigationItems, + 'team-project': teamProjectNavigationItems, + 'side-project': sideProjectNavigationItems, +} satisfies Record; diff --git a/src/widgets/workspace-shell/ui/WorkspaceHeader.tsx b/src/widgets/workspace-shell/ui/WorkspaceHeader.tsx index bc405db..1e15ae5 100644 --- a/src/widgets/workspace-shell/ui/WorkspaceHeader.tsx +++ b/src/widgets/workspace-shell/ui/WorkspaceHeader.tsx @@ -4,19 +4,21 @@ import { Bell, Search, UserRoundPlus } from 'lucide-react'; import { usePathname } from 'next/navigation'; import { mockCurrentWorkspaceMember } from '@/entities/workspace-member'; -import { storeOperationNavigationItems } from '../model/workspace-navigation'; +import type { WorkspaceNavigationItem } from '../model/workspace-navigation'; -function getCurrentPageTitle(pathname: string): string { - const currentNavigationItem = storeOperationNavigationItems.find((item) => - pathname.endsWith(`/${item.href}`), - ); +interface WorkspaceHeaderProps { + navigationItems: WorkspaceNavigationItem[]; +} + +function getCurrentPageTitle(pathname: string, navigationItems: WorkspaceNavigationItem[]): string { + const currentNavigationItem = navigationItems.find((item) => pathname.endsWith(`/${item.href}`)); return currentNavigationItem?.label ?? '대시보드'; } -export function WorkspaceHeader() { +export function WorkspaceHeader({ navigationItems }: WorkspaceHeaderProps) { const pathname = usePathname(); - const title = getCurrentPageTitle(pathname); + const title = getCurrentPageTitle(pathname, navigationItems); return (
@@ -46,7 +48,7 @@ export function WorkspaceHeader() { className="relative flex h-10 w-10 items-center justify-center rounded-full text-slate-500 hover:bg-slate-100" >