#!/bin/zsh echo "🛠 Setting up Compatibility Explorer (Option A)..." COMPAT_DIR="src/app/compatibility" mkdir -p "$COMPAT_DIR" cat > "$COMPAT_DIR/page.js" << 'EOF' "use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { CATEGORIES } from "@/lib/data/categories"; function ModeCard({ title, emoji, description, children }) { return (
{emoji}

{title}

{description}

{children}
); } export default function CompatibilityPage() { const [models, setModels] = useState([]); const [parts, setParts] = useState([]); const [loading, setLoading] = useState(true); const [modelForParts, setModelForParts] = useState(""); const [partForModels, setPartForModels] = useState(""); const [modelA, setModelA] = useState(""); const [modelB, setModelB] = useState(""); const [categoryModel, setCategoryModel] = useState(""); const [category, setCategory] = useState(""); const router = useRouter(); useEffect(() => { async function load() { try { const [modelsRes, partsRes] = await Promise.all([ fetch("/api/models"), fetch("/api/parts"), ]); const modelsJson = modelsRes.ok ? await modelsRes.json() : []; const partsJson = partsRes.ok ? await partsRes.json() : []; setModels(modelsJson || []); setParts(partsJson || []); } catch (e) { console.error("Failed to load models/parts", e); } finally { setLoading(false); } } load(); }, []); function handleGoToModelCompatibility() { if (!modelForParts) return; router.push(`/model/${modelForParts}`); } function handleGoToPartCompatibility() { if (!partForModels) return; router.push(`/part/${partForModels}`); } function handleExploreCategory() { if (!categoryModel || !category) return; router.push(`/category/${categoryModel}/${category}`); } function handleCompareModels() { if (!modelA || !modelB) return; // Stubbed for now to avoid broken routes alert("Model comparison view coming soon! (Hotshot vs Supershot, etc.)"); } return (
{/* Breadcrumb-ish header */} {/* Page Title */}

Compatibility Explorer

Discover cross-compatibility between RC models and parts. Use one of the tools below to explore fitment, upgrades, and shared components.

{loading && (

Loading models and parts…

)} {/* Mode Selector Grid */} {!loading && (
{/* Mode 1: Model → Compatible Parts */} {/* Mode 2: Part → Compatible Models */} {/* Mode 3: Compare Two Models (stubbed) */}
{/* Mode 4: Explore Categories */}
)}
); } EOF echo "🎉 Compatibility Explorer (Option A) page created at src/app/compatibility/page.js"