From 644e1b23b9d27a068ff623e5a3227df691c8db7d Mon Sep 17 00:00:00 2001 From: chyoo Date: Wed, 14 Oct 2026 14:33:37 +0900 Subject: [PATCH] fix(platforms): load vehicle types from platform data --- src/lib/platforms.ts | 1 + src/pages/platforms/PlatformsPage.tsx | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/platforms.ts b/src/lib/platforms.ts index 15215de..f942448 100644 --- a/src/lib/platforms.ts +++ b/src/lib/platforms.ts @@ -83,6 +83,7 @@ export type MasterPlatform = { name: string; description: string; iconKey: string; + vehicleType: string; }; export type InstructorPlatformsSummary = { diff --git a/src/pages/platforms/PlatformsPage.tsx b/src/pages/platforms/PlatformsPage.tsx index 585f306..5d5ee2e 100644 --- a/src/pages/platforms/PlatformsPage.tsx +++ b/src/pages/platforms/PlatformsPage.tsx @@ -125,6 +125,18 @@ export function PlatformsPage({ session }: { session: AuthSession }) { Number(isRegisteredAgent(a, registeredAgentKeys)) - Number(isRegisteredAgent(b, registeredAgentKeys)), ), [agents, registeredAgentKeys]); const pagedPlatforms = useMemo(() => filteredPlatforms.slice((page - 1) * pageSize, page * pageSize), [filteredPlatforms, page, pageSize]); + const vehicleTypeOptions = useMemo(() => { + const options = new Map(); + const addOption = (value: string | null | undefined) => { + const normalized = value?.trim(); + if (!normalized || normalized.toLowerCase() === 'simulator') return; + options.set(normalized.toLowerCase(), normalized); + }; + + masterPlatforms.forEach((platform) => addOption(platform.vehicleType)); + addOption(settingsTarget?.vehicleType); + return Array.from(options.values()); + }, [masterPlatforms, settingsTarget?.vehicleType]); const summaryItems = [ { label: '전체 플랫폼', value: `${summary.totalPlatforms}대`, icon: Car, tone: 'bg-[#eff6ff] text-[#2563eb]' }, { label: '활성 플랫폼', value: `${summary.activePlatforms}대`, icon: Activity, tone: 'bg-[#f0efff] text-[#4f46e5]' }, @@ -815,9 +827,9 @@ export function PlatformsPage({ session }: { session: AuthSession }) {