From da00bbf203534b2663289d6fe45b6ed8663e7e11 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 23 Sep 2025 02:44:05 +0000 Subject: (최겸) 구매 인포메이션, 공지사항 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/notice/notice-create-dialog.tsx | 107 +++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 28 deletions(-) (limited to 'components/notice/notice-create-dialog.tsx') diff --git a/components/notice/notice-create-dialog.tsx b/components/notice/notice-create-dialog.tsx index 591b2bc7..98c66c99 100644 --- a/components/notice/notice-create-dialog.tsx +++ b/components/notice/notice-create-dialog.tsx @@ -7,7 +7,7 @@ import { useForm } from "react-hook-form" import { useParams } from "next/navigation" import { useTranslation } from "@/i18n/client" import { toast } from "sonner" -import { Loader } from "lucide-react" +import { Loader, Check, ChevronsUpDown } from "lucide-react" import { Button } from "@/components/ui/button" import { Dialog, @@ -25,13 +25,9 @@ import { } from "@/components/ui/form" import { Input } from "@/components/ui/input" import { Switch } from "@/components/ui/switch" -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select" +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover" +import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@/components/ui/command" +import { cn } from "@/lib/utils" import TiptapEditor from "@/components/qna/tiptap-editor" import { createNotice } from "@/lib/notice/service" import { createNoticeSchema, type CreateNoticeSchema } from "@/lib/notice/validations" @@ -135,26 +131,81 @@ export function NoticeCreateDialog({ ( - - 페이지 경로 * - - - - )} + render={({ field }) => { + const [open, setOpen] = useState(false) + const [searchTerm, setSearchTerm] = useState("") + + const filteredOptions = React.useMemo(() => { + if (!searchTerm.trim()) return pagePathOptions + + const lowerSearch = searchTerm.toLowerCase() + return pagePathOptions.filter( + (option) => + safeTranslate(option.label).toLowerCase().includes(lowerSearch) || + option.value.toLowerCase().includes(lowerSearch) + ) + }, [pagePathOptions, searchTerm]) + + const selectedOption = pagePathOptions.find(option => option.value === field.value) + + return ( + + 페이지 경로 * + + + + + + + + + + + 검색 결과가 없습니다 + + {filteredOptions.map((option) => ( + { + field.onChange(option.value) + setOpen(false) + }} + > + + {safeTranslate(option.label)} + - {option.value} + + ))} + + + + + + + + ) + }} />