diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/ProjectSelector.tsx | 9 | ||||
| -rw-r--r-- | components/bidding/ProjectSelectorBid.tsx | 9 | ||||
| -rw-r--r-- | components/layout/Header.tsx | 57 |
3 files changed, 71 insertions, 4 deletions
diff --git a/components/ProjectSelector.tsx b/components/ProjectSelector.tsx index 58fa2c23..45963d88 100644 --- a/components/ProjectSelector.tsx +++ b/components/ProjectSelector.tsx @@ -6,7 +6,14 @@ import { Button } from "@/components/ui/button" import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover" import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@/components/ui/command" import { cn } from "@/lib/utils" -import { getProjects, type Project } from "@/lib/rfqs/service" +import { getProjects } from "@/lib/projects/service" + +export type Project = { + id: number; + projectCode: string; + projectName: string; + type: string; +} interface ProjectSelectorProps { selectedProjectId?: number | null; diff --git a/components/bidding/ProjectSelectorBid.tsx b/components/bidding/ProjectSelectorBid.tsx index a87c8dce..8a4b85af 100644 --- a/components/bidding/ProjectSelectorBid.tsx +++ b/components/bidding/ProjectSelectorBid.tsx @@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button" import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover" import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@/components/ui/command" import { cn } from "@/lib/utils" -import { getProjects, type Project } from "@/lib/rfqs/service" +import { getProjects } from "@/lib/projects/service" interface ProjectSelectorProps { selectedProjectId?: number | null; @@ -16,6 +16,13 @@ interface ProjectSelectorProps { disabled?: boolean; } +export type Project = { + id: number; + projectCode: string; + projectName: string; + type: string; +} + export function ProjectSelector({ selectedProjectId, onProjectSelect, diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index 0c83e858..2752948a 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -123,7 +123,60 @@ export function Header() { }, [pathname]); // 도메인별 메뉴 및 브랜딩 정보 가져오기 - const getDomainConfig = (pathname: string | null) => { + // session.user.domain이 있으면 그것을 우선적으로 따르고, 없으면 pathname을 따릅니다. + const userDomain = (session?.user as { domain?: string } | undefined)?.domain; + + const getDomainConfig = (pathname: string | null, domain?: string) => { + // 1. 세션 도메인 기반 설정 + if (domain) { + if (domain === "partners") { + return { + main: mainNavVendor, + additional: additionalNavVendor, + logoHref: `/${lng}/partners`, + brandNameKey: domainBrandingKeys.partners, + basePath: `/${lng}/partners` + }; + } + if (domain === "procurement") { + return { + main: procurementNav, + additional: additional2Nav, + logoHref: `/${lng}/procurement`, + brandNameKey: domainBrandingKeys.procurement, + basePath: `/${lng}/procurement` + }; + } + if (domain === "sales") { + return { + main: salesNav, + additional: additional2Nav, + logoHref: `/${lng}/sales`, + brandNameKey: domainBrandingKeys.sales, + basePath: `/${lng}/sales` + }; + } + if (domain === "engineering") { + return { + main: engineeringNav, + additional: additional2Nav, + logoHref: `/${lng}/engineering`, + brandNameKey: domainBrandingKeys.engineering, + basePath: `/${lng}/engineering` + }; + } + if (domain === "evcp") { + return { + main: mainNav, + additional: additionalNav, + logoHref: `/${lng}/evcp`, + brandNameKey: domainBrandingKeys.evcp, + basePath: `/${lng}/evcp` + }; + } + } + + // 2. 경로 기반 설정 (Fallback) if (pathname?.includes("/partners")) { return { main: mainNavVendor, @@ -174,7 +227,7 @@ export function Header() { }; }; - const { main: originalMain, additional: originalAdditional, logoHref, brandNameKey, basePath } = getDomainConfig(pathname); + const { main: originalMain, additional: originalAdditional, logoHref, brandNameKey, basePath } = getDomainConfig(pathname, userDomain); // partners 도메인 여부 확인 const isPartners = pathname?.includes("/partners") ?? false; |
