'use client'; import { usePathname } from 'next/navigation'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Construction, FileSearch, ArrowLeft, Home, Package, Users, Settings, Building2, FileText, Lock, Building, LucideIcon } from 'lucide-react'; import { useRouter } from 'next/navigation'; // 아이콘 매핑 const iconMap: Record = { Construction, FileSearch, Package, Users, Settings, Building2, FileText, Lock, Building, }; interface EmptyPageProps { title?: string; description?: string; iconName?: string; // 아이콘 이름을 문자열로 받음 showBackButton?: boolean; showHomeButton?: boolean; } export function EmptyPage({ title, description, iconName = 'Construction', showBackButton = true, showHomeButton = true, }: EmptyPageProps) { const router = useRouter(); const pathname = usePathname(); // 아이콘 이름에서 실제 컴포넌트 가져오기 const Icon = iconMap[iconName] || Construction; // pathname에서 메뉴 이름 추출 (예: /base/product/lists → 제품 관리) const getPageTitleFromPath = () => { if (title) return title; const segments = pathname.split('/').filter(Boolean); const lastSegment = segments[segments.length - 1]; // URL을 사람이 읽을 수 있는 제목으로 변환 const titleMap: Record = { 'lists': '목록', 'product': '제품 관리', 'client': '거래처 관리', 'bom': 'BOM 관리', 'user': '사용자 관리', 'permission': '권한 관리', 'department': '부서 관리', }; return titleMap[lastSegment] || '페이지'; }; const getPageDescriptionFromPath = () => { if (description) return description; return '이 페이지는 현재 개발 중입니다.'; }; return (
🚧
{getPageTitleFromPath()}

현재 경로: {pathname}

{getPageDescriptionFromPath()}

곧 멋진 기능으로 찾아뵙겠습니다! 🚀

{showBackButton && ( )} {showHomeButton && ( )}

💡 개발자 안내: 이 페이지에 콘텐츠를 추가하려면{' '} {pathname} {' '} 경로에 해당하는 페이지 컴포넌트를 생성하세요.

); }