From 04ed774ff60a83c00711d4e8615cb4122954dba5 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Thu, 4 Dec 2025 19:46:55 +0900 Subject: (김준회) 메뉴 관리기능 초안 개발 (시딩 필요) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/menu-v2/components/unassigned-menus-panel.tsx | 178 ++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 lib/menu-v2/components/unassigned-menus-panel.tsx (limited to 'lib/menu-v2/components/unassigned-menus-panel.tsx') diff --git a/lib/menu-v2/components/unassigned-menus-panel.tsx b/lib/menu-v2/components/unassigned-menus-panel.tsx new file mode 100644 index 00000000..2c914f2a --- /dev/null +++ b/lib/menu-v2/components/unassigned-menus-panel.tsx @@ -0,0 +1,178 @@ +"use client"; + +import { useState } from "react"; +import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Badge } from "@/components/ui/badge"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Search, FileQuestion, ArrowRight, Pencil, Link } from "lucide-react"; +import type { MenuTreeNode } from "../types"; + +interface UnassignedMenusPanelProps { + menus: MenuTreeNode[]; + onAssign: (menuId: number, groupId: number) => void; + onActivateAsTopLevel: (menuId: number) => void; + onEdit: (menu: MenuTreeNode) => void; + availableGroups: { id: number; title: string; parentTitle?: string }[]; +} + +export function UnassignedMenusPanel({ + menus, + onAssign, + onActivateAsTopLevel, + onEdit, + availableGroups, +}: UnassignedMenusPanelProps) { + const [searchTerm, setSearchTerm] = useState(""); + const [selectedMenu, setSelectedMenu] = useState(null); + + const filteredMenus = menus.filter( + (menu) => + menu.titleKo.toLowerCase().includes(searchTerm.toLowerCase()) || + menu.menuPath?.toLowerCase().includes(searchTerm.toLowerCase()) + ); + + return ( + + + + + Unassigned Menus ({menus.length}) + + + Assign to a group or activate as a top-level link. + + + + {/* Search */} +
+ + setSearchTerm(e.target.value)} + className="pl-8" + /> +
+ + {/* Menu List */} + +
+ {filteredMenus.length === 0 ? ( +

+ {searchTerm ? "No results found." : "No unassigned menus."} +

+ ) : ( + filteredMenus.map((menu) => ( +
+
+
+
+ {menu.titleKo} + + Inactive + +
+

+ {menu.menuPath} +

+
+ +
+ + {/* Group Selection (expanded) */} + {selectedMenu === menu.id ? ( +
+ {/* Activate as Top-Level */} +
+

+ Activate as top-level link: +

+ +
+ + {/* Assign to Group */} + {availableGroups.length > 0 && ( +
+

+ Or assign to group: +

+
+ {availableGroups.map((group) => ( + + ))} +
+
+ )} + + +
+ ) : ( + + )} +
+ )) + )} +
+
+
+
+ ); +} -- cgit v1.2.3