Merge branch 'develop' of ssh://gitea.gofwd.group:2225/sean/shadow-gunbuilder-ai-proto into develop
This commit is contained in:
@@ -21,7 +21,7 @@ import Pagination from "@/components/parts/Pagination";
|
||||
import PlatformSwitcher from "@/components/parts/PlatformSwitcher";
|
||||
import { normalizePlatformKey } from "@/lib/platforms";
|
||||
import type { UiPart } from "@/types/uiPart";
|
||||
import type { Category } from "@/types/builderSlots";
|
||||
import type { BuilderSlotKey, Category } from "@/types/builderSlots";
|
||||
import {
|
||||
PART_ROLE_TO_CATEGORY,
|
||||
normalizePartRole,
|
||||
@@ -310,15 +310,17 @@ export default function PartsBrowseClient(props: {
|
||||
// Add → Builder handoff
|
||||
// ----------------------------
|
||||
const handleAddToBuild = (p: UiPart) => {
|
||||
const normalizedRole = normalizePartRole(partRole);
|
||||
const categoryId: Category | null =
|
||||
// Always normalize first; our mappings may alias multiple roles to one canonical builder category
|
||||
const roleKey = normalizePartRole(partRole);
|
||||
|
||||
const categoryId: BuilderSlotKey | null =
|
||||
PART_ROLE_TO_CATEGORY[roleKey] ??
|
||||
PART_ROLE_TO_CATEGORY[partRole] ??
|
||||
PART_ROLE_TO_CATEGORY[normalizedRole] ??
|
||||
null;
|
||||
|
||||
if (!categoryId) {
|
||||
alert(
|
||||
`No Category mapping found for role "${partRole}". Add it to catalogMappings.`
|
||||
`No Category mapping found for role "${partRole}" (normalized: "${roleKey}"). Add it to catalogMappings.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user