diff options
| author | joonhoekim <26rote@gmail.com> | 2025-08-11 09:34:40 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-08-11 09:34:40 +0000 |
| commit | bcd462d6e60871b86008e072f4b914138fc5c328 (patch) | |
| tree | c22876fd6c6e7e48254587848b9dff50cdb8b032 /components/layout/command-menu.tsx | |
| parent | cbb4c7fe0b94459162ad5e998bc05cd293e0ff96 (diff) | |
(김준회) 리치텍스트에디터 (결재템플릿을 위한 공통컴포넌트), command-menu 에러 수정, 결재 템플릿 관리, 결재선 관리, ECC RFQ+PR Item 수신시 비즈니스테이블(ProcurementRFQ) 데이터 적재, WSDL 오류 수정
Diffstat (limited to 'components/layout/command-menu.tsx')
| -rw-r--r-- | components/layout/command-menu.tsx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/components/layout/command-menu.tsx b/components/layout/command-menu.tsx index 5537a042..d0c9c49a 100644 --- a/components/layout/command-menu.tsx +++ b/components/layout/command-menu.tsx @@ -1,12 +1,13 @@ "use client" import * as React from "react" -import { useRouter,usePathname } from "next/navigation" +import { useRouter, usePathname, useParams } from "next/navigation" import { type DialogProps } from "@radix-ui/react-dialog" import { Circle, File, Laptop, Moon, Sun } from "lucide-react" import { useTheme } from "next-themes" import { MenuSection, mainNav, additionalNav, MenuItem, mainNavVendor, additionalNavVendor } from "@/config/menuConfig"; +import { useTranslation } from "@/i18n/client" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { @@ -24,6 +25,9 @@ export function CommandMenu({ ...props }: DialogProps) { const router = useRouter() const [open, setOpen] = React.useState(false) const { setTheme } = useTheme() + const params = useParams() + const lng = (params?.lng as string) || "evcp" + const { t } = useTranslation(lng, "menu") React.useEffect(() => { const down = (e: KeyboardEvent) => { @@ -81,20 +85,20 @@ const isPartnerRoute = pathname.includes("/partners"); <CommandList> <CommandEmpty>No results found.</CommandEmpty> - {main.map((group) => ( - <CommandGroup key={group.title} heading={group.title}> + {main.map((group: MenuSection) => ( + <CommandGroup key={group.titleKey} heading={t(group.titleKey)}> {group.items.map((navItem) => ( <CommandItem - key={navItem.title} - value={navItem.title} + key={`${navItem.titleKey}:${navItem.href}`} + value={t(navItem.titleKey)} onSelect={() => { - runCommand(() => router.push(navItem.href as string)) + runCommand(() => router.push(`/${lng}${navItem.href}`)) }} > <div className="mr-2 flex h-4 w-4 items-center justify-center"> <Circle className="h-3 w-3" /> </div> - {navItem.title} + {t(navItem.titleKey)} </CommandItem> ))} </CommandGroup> @@ -104,14 +108,14 @@ const isPartnerRoute = pathname.includes("/partners"); // .filter((navitem) => !navitem.external) .map((navItem) => ( <CommandItem - key={navItem.title} - value={navItem.title} + key={`${navItem.titleKey}:${navItem.href}`} + value={t(navItem.titleKey)} onSelect={() => { - runCommand(() => router.push(navItem.href as string)) + runCommand(() => router.push(`/${lng}${navItem.href}`)) }} > <File /> - {navItem.title} + {t(navItem.titleKey)} </CommandItem> ))} </CommandGroup> |
