mirror of
https://gitea.gofwd.group/sean/gunbuilder-next-tailwind.git
synced 2025-12-06 02:56:45 -05:00
198 lines
6.7 KiB
TypeScript
198 lines
6.7 KiB
TypeScript
|
|
// Auto-generated mapping from product feed categories (all_categories.csv)
|
||
|
|
// to standardized builder component types (component_type.csv)
|
||
|
|
// Refine as needed for your builder logic
|
||
|
|
export const categoryToComponentType: Record<string, string> = {
|
||
|
|
"Sporting Bolt Action Centerfire Rifles": "N/A",
|
||
|
|
"HANDGUN SIGHTS": "N/A",
|
||
|
|
"Synthetic Holsters": "N/A",
|
||
|
|
"Scope Mounts": "Accessories",
|
||
|
|
"Short Barrel Shotguns": "N/A",
|
||
|
|
"Polymer Centerfire Conceal Carry Pistols": "N/A",
|
||
|
|
"LESS LETHAL AMMO": "N/A",
|
||
|
|
"LESS LETHAL PISTOL": "N/A",
|
||
|
|
"Rifle/Shotgun Combos": "N/A",
|
||
|
|
"Leveraction Shotguns": "N/A",
|
||
|
|
"Specialty Pistols": "N/A",
|
||
|
|
"Miscellaneous Accessories": "N/A",
|
||
|
|
"LESS LETHAL ACCESSORIES": "N/A",
|
||
|
|
"Tactical Rimfire Semi-Auto Rifles": "N/A",
|
||
|
|
"Sporting Semi-Auto Rimfire Rifles": "N/A",
|
||
|
|
"Lower Receivers": "Lower Receiver",
|
||
|
|
"Handgun Magazines": "Magazine",
|
||
|
|
"Non-Magnified Optic Mounts": "Accessories",
|
||
|
|
"Magnified Tactical Optics": "Accessories",
|
||
|
|
"BOLT ACTION SHOTGUN": "N/A",
|
||
|
|
"Sporting Semi-Auto Shotguns": "N/A",
|
||
|
|
"Metal Frame Centerfire Pistols": "N/A",
|
||
|
|
"THERMAL OPTICS": "Accessories",
|
||
|
|
"Sporting Leveraction Rimfire Rifles": "N/A",
|
||
|
|
"Pump Rimfire Rifles": "N/A",
|
||
|
|
"TACTICAL CENTERFIRE SEMI-AUTO PISTOLS": "N/A",
|
||
|
|
"Single Action Centerfire Revolvers": "N/A",
|
||
|
|
"Range Finders": "N/A",
|
||
|
|
"Metal Frame Rimfire Pistols": "N/A",
|
||
|
|
"Sporting Bolt Action Rimfire Rifles": "N/A",
|
||
|
|
"Side by Side Shotguns": "N/A",
|
||
|
|
"Lasers and Lights": "N/A",
|
||
|
|
"Tactical Pump Shotguns": "N/A",
|
||
|
|
"Binoculars": "N/A",
|
||
|
|
"Double Action Centerfire Revolvers": "N/A",
|
||
|
|
"Tactical Semi-Auto Shotguns": "N/A",
|
||
|
|
"Scopes": "Accessories",
|
||
|
|
"Silencer Mounts": "N/A",
|
||
|
|
"Double Action Centrfire Conceal Revolver": "N/A",
|
||
|
|
"Sporting Semi-Auto Centerfire Rifles": "N/A",
|
||
|
|
"FIRE CONTROL UNIT": "N/A",
|
||
|
|
"Spotting Scopes": "N/A",
|
||
|
|
"Single Shot Centerfire Rifles": "N/A",
|
||
|
|
"Derringers": "N/A",
|
||
|
|
"Pump Centerfire Rifles": "N/A",
|
||
|
|
"Double Action Rimfire Revolvers": "N/A",
|
||
|
|
"Tactical Centerfire Semi-Auto Rifles": "N/A",
|
||
|
|
"Handgun Accessories": "N/A",
|
||
|
|
"Sporting Leveraction Centerfire Rifles": "N/A",
|
||
|
|
"Single Shot Shotguns": "N/A",
|
||
|
|
"Polymer Rimfire Pistols": "N/A",
|
||
|
|
"LESS LETHAL RIFLE": "N/A",
|
||
|
|
"Short Barrel Rifles": "N/A",
|
||
|
|
"Black Powder Guns": "N/A",
|
||
|
|
"Over/Under Shotguns": "N/A",
|
||
|
|
"TACTICAL RIMFIRE SEMI-AUTO PISTOL": "N/A",
|
||
|
|
"Non-Magnified Optic Accessories": "N/A",
|
||
|
|
"Scope Accessories": "N/A",
|
||
|
|
"Scope Rings": "N/A",
|
||
|
|
"Rimfire Silencers": "N/A",
|
||
|
|
"Non-Magnified Optics": "N/A",
|
||
|
|
"Metal Frame Centerfire Conceal Pistols": "N/A",
|
||
|
|
"LONG GUN SIGHTS": "N/A",
|
||
|
|
"UPPER RECEIVERS": "Upper Receiver",
|
||
|
|
"Double Action Rimfire Conceal Revolvers": "N/A",
|
||
|
|
"Rifle Magazines": "Magazine",
|
||
|
|
"Rifle Accessories": "N/A",
|
||
|
|
"Silencer Pistons": "N/A",
|
||
|
|
"Shotgun Silencers": "N/A",
|
||
|
|
"Tactical Bolt Action Rifles": "N/A",
|
||
|
|
"Centerfire Ammo": "N/A",
|
||
|
|
"Single Action Rimfire Revolvers": "N/A",
|
||
|
|
"Leather Holsters": "N/A",
|
||
|
|
"AR Style Centerfire Rifles": "N/A",
|
||
|
|
"Centerfire Pistol Silencers": "N/A",
|
||
|
|
"Single Shot Rimfire Rifles": "N/A",
|
||
|
|
"Silencer Accessories": "N/A",
|
||
|
|
"Sporting Pump Shotguns": "N/A",
|
||
|
|
"Single Shot Handguns": "N/A",
|
||
|
|
"Centerfire Rifle Silencers": "N/A",
|
||
|
|
"Polymer Centerfire Pistols": "N/A",
|
||
|
|
"Magnified Tactical Optic Mounts": "N/A",
|
||
|
|
"SHOTGUN MAGAZINES": "Magazine",
|
||
|
|
"BLACK POWDER FIREARMS (ATF CONTROLLED)": "N/A"
|
||
|
|
};
|
||
|
|
|
||
|
|
// List of standardized builder component types (from component_type.csv)
|
||
|
|
export const standardizedComponentTypes = [
|
||
|
|
"Upper Receiver",
|
||
|
|
"Barrel",
|
||
|
|
"Muzzle Device",
|
||
|
|
"Lower Receiver",
|
||
|
|
"Safety",
|
||
|
|
"Trigger",
|
||
|
|
"Gas Tube",
|
||
|
|
"Gas Block",
|
||
|
|
"Grips",
|
||
|
|
"Handguards",
|
||
|
|
"Charging Handle",
|
||
|
|
"Bolt Carrier Group",
|
||
|
|
"Magazine",
|
||
|
|
"Buffer Assembly",
|
||
|
|
"Buffer Tube",
|
||
|
|
"Foregrips",
|
||
|
|
"Lower Parts Kit",
|
||
|
|
"Accessories"
|
||
|
|
];
|
||
|
|
|
||
|
|
// Hybrid mapping function: prefer subcategory, fallback to category
|
||
|
|
export function mapToBuilderType(category: string, subcategory: string): string {
|
||
|
|
if (standardizedComponentTypes.includes(subcategory)) {
|
||
|
|
return subcategory;
|
||
|
|
}
|
||
|
|
if (standardizedComponentTypes.includes(category)) {
|
||
|
|
return category;
|
||
|
|
}
|
||
|
|
return "N/A";
|
||
|
|
}
|
||
|
|
|
||
|
|
// Builder category hierarchy for filters
|
||
|
|
export const builderCategories = [
|
||
|
|
{
|
||
|
|
id: "upper-parts",
|
||
|
|
name: "Upper Parts",
|
||
|
|
subcategories: [
|
||
|
|
{ id: "complete-upper", name: "Complete Upper Receiver" },
|
||
|
|
{ id: "stripped-upper", name: "Stripped Upper Receiver" },
|
||
|
|
{ id: "barrel", name: "Barrel" },
|
||
|
|
{ id: "gas-block", name: "Gas Block" },
|
||
|
|
{ id: "gas-tube", name: "Gas Tube" },
|
||
|
|
{ id: "handguard", name: "Handguard / Rail" },
|
||
|
|
{ id: "bcg", name: "Bolt Carrier Group (BCG)" },
|
||
|
|
{ id: "charging-handle", name: "Charging Handle" },
|
||
|
|
{ id: "muzzle-device", name: "Muzzle Device" },
|
||
|
|
{ id: "forward-assist", name: "Forward Assist" },
|
||
|
|
{ id: "dust-cover", name: "Dust Cover" }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "lower-parts",
|
||
|
|
name: "Lower Parts",
|
||
|
|
subcategories: [
|
||
|
|
{ id: "complete-lower", name: "Complete Lower Receiver" },
|
||
|
|
{ id: "stripped-lower", name: "Stripped Lower Receiver" },
|
||
|
|
{ id: "lower-parts-kit", name: "Lower Parts Kit" },
|
||
|
|
{ id: "trigger", name: "Trigger / Fire Control Group" },
|
||
|
|
{ id: "buffer-tube", name: "Buffer Tube Assembly" },
|
||
|
|
{ id: "buffer-spring", name: "Buffer & Spring" },
|
||
|
|
{ id: "stock", name: "Stock / Brace" },
|
||
|
|
{ id: "pistol-grip", name: "Pistol Grip" },
|
||
|
|
{ id: "trigger-guard", name: "Trigger Guard" },
|
||
|
|
{ id: "ambi-controls", name: "Ambidextrous Controls" }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "accessories",
|
||
|
|
name: "Accessories",
|
||
|
|
subcategories: [
|
||
|
|
{ id: "optics", name: "Optics & Sights" },
|
||
|
|
{ id: "sling-mounts", name: "Sling Mounts / QD Points" },
|
||
|
|
{ id: "slings", name: "Slings" },
|
||
|
|
{ id: "grips-bipods", name: "Vertical Grips / Bipods" },
|
||
|
|
{ id: "lights", name: "Weapon Lights" },
|
||
|
|
{ id: "magazines", name: "Magazines" },
|
||
|
|
{ id: "optic-mounts", name: "Optic Mounts / Rings" },
|
||
|
|
{ id: "suppressors", name: "Suppressors / Adapters" }
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "kits-bundles",
|
||
|
|
name: "Kits / Bundles",
|
||
|
|
subcategories: [
|
||
|
|
{ id: "rifle-kit", name: "Rifle Kit" },
|
||
|
|
{ id: "pistol-kit", name: "Pistol Kit" },
|
||
|
|
{ id: "upper-kit", name: "Upper Build Kit" },
|
||
|
|
{ id: "lower-kit", name: "Lower Build Kit" },
|
||
|
|
{ id: "kit-80", name: "80% Build Kit" },
|
||
|
|
{ id: "receiver-set", name: "Matched Receiver Set" }
|
||
|
|
]
|
||
|
|
}
|
||
|
|
];
|
||
|
|
|
||
|
|
// Example subcategory mapping (expand as needed)
|
||
|
|
export const subcategoryMapping: Record<string, string> = {
|
||
|
|
"Rifle Barrels": "barrel",
|
||
|
|
"Bolt Carrier Groups": "bcg",
|
||
|
|
"Handguards & Rails": "handguard",
|
||
|
|
"Suppressors": "suppressors",
|
||
|
|
"Receivers": "complete-upper", // or "stripped-upper" if you want to split
|
||
|
|
"Triggers": "trigger",
|
||
|
|
"Rifle Stocks": "stock",
|
||
|
|
"Buttstocks": "stock",
|
||
|
|
// ...add more mappings as needed
|
||
|
|
};
|