"use client"; import { useMemo, useState } from "react"; import Link from "next/link"; type BuildClass = "Rifle" | "Pistol" | "NFA"; type Caliber = "5.56" | "7.62" | "9mm" | ".300 BLK" | "12ga"; type BuildCard = { id: string; title: string; slug: string; creator: string; caliber: Caliber; buildClass: BuildClass; price: number; votes: number; tags: string[]; }; const DUMMY_BUILDS: BuildCard[] = [ { id: "1", title: "Duty-Grade 12.5\" AR-15", slug: "duty-12-5-ar15", creator: "quietpro_01", caliber: "5.56", buildClass: "Rifle", price: 2450, votes: 128, tags: ["Duty", "NV-Ready", "LPVO"], }, { id: "2", title: "Home Defense PCC", slug: "home-defense-pcc", creator: "nerdgunner", caliber: "9mm", buildClass: "Pistol", price: 1650, votes: 74, tags: ["Home Defense", "Red Dot", "Suppressor-Ready"], }, { id: "3", title: "Short King .300 BLK SBR", slug: "short-king-300blk-sbr", creator: "subsonic_six", caliber: ".300 BLK", buildClass: "NFA", price: 3125, votes: 201, tags: ["SBR", "Suppressed", "Night Work"], }, { id: "4", title: "Budget 16\" Training Rifle", slug: "budget-16-training-rifle", creator: "range_rat", caliber: "5.56", buildClass: "Rifle", price: 975, votes: 53, tags: ["Budget", "Trainer", "Recce-ish"], }, ]; const CALIBER_FILTERS: (Caliber | "all")[] = [ "all", "5.56", "7.62", "9mm", ".300 BLK", "12ga", ]; const CLASS_FILTERS: (BuildClass | "all")[] = ["all", "Rifle", "Pistol", "NFA"]; const PRICE_FILTERS = [ { id: "all", label: "All", min: 0, max: Infinity }, { id: "sub1k", label: "< $1k", min: 0, max: 1000 }, { id: "1to2k", label: "$1k–$2k", min: 1000, max: 2000 }, { id: "2to3k", label: "$2k–$3k", min: 2000, max: 3000 }, { id: "3kplus", label: "$3k+", min: 3000, max: Infinity }, ]; export default function BuildsPage() { const [caliberFilter, setCaliberFilter] = useState("all"); const [classFilter, setClassFilter] = useState("all"); const [priceFilterId, setPriceFilterId] = useState("all"); const [votes, setVotes] = useState>( Object.fromEntries(DUMMY_BUILDS.map((b) => [b.id, b.votes])), ); const activePriceFilter = PRICE_FILTERS.find( (p) => p.id === priceFilterId, ) ?? PRICE_FILTERS[0]; const filteredBuilds = useMemo(() => { return DUMMY_BUILDS.filter((build) => { const matchesCaliber = caliberFilter === "all" || build.caliber === caliberFilter; const matchesClass = classFilter === "all" || build.buildClass === classFilter; const matchesPrice = build.price >= activePriceFilter.min && build.price < activePriceFilter.max; return matchesCaliber && matchesClass && matchesPrice; }); }, [caliberFilter, classFilter, activePriceFilter]); const handleVote = (id: string, delta: 1 | -1) => { setVotes((prev) => ({ ...prev, [id]: (prev[id] ?? 0) + delta, })); }; return (
{/* Header */}

Battl Builder · Build Book

Community Builds

Browse community rifle builds, vote them up or down, and steal good ideas without shame. This is placeholder content for now — real accounts, comments, and saved builds will wire in later.

Open Builder
{/* Filters */}

Filter Builds

Filter by caliber, platform class, and ballpark price range. All logic is client-side placeholder until the real feed is wired into the backend.

Showing{" "} {filteredBuilds.length} {" "} of{" "} {DUMMY_BUILDS.length} {" "} demo builds
{/* Caliber filter */}
Caliber
{CALIBER_FILTERS.map((caliber) => ( ))}
{/* Class filter */}
Class
{CLASS_FILTERS.map((cls) => ( ))}
{/* Price filter */}
Price Range
{PRICE_FILTERS.map((range) => ( ))}
{/* Build list */}
{filteredBuilds.map((build) => (
{/* Votes column */}
{votes[build.id] ?? build.votes}
{/* Placeholder thumbnail */}
{/* eslint-disable-next-line @next/next/no-img-element */} {`${build.title}
{/* Main content */}
{build.buildClass} · {build.caliber}

{build.title}

Posted by{" "} b/{build.creator} {" "} · Placeholder build listing — details, parts list, and comments will live on the build detail page later.

Est. Build Cost
${build.price.toLocaleString()}
{build.tags.map((tag) => ( {tag} ))} Comments, save, and share coming soon.
))} {filteredBuilds.length === 0 && (
No builds match those filters yet. Once the real feed is wired up, this will update live as the community posts rifles, pistols, and NFA builds.
)}
); }