From 7c2206ffc3c8e3dee9edb7e52f78b23d55c901ca Mon Sep 17 00:00:00 2001 From: Sean Date: Tue, 9 Dec 2025 06:11:50 -0500 Subject: [PATCH] fixed logo, fixed product details page image and api --- .../builder/[categoryId]/[partId]/page.tsx | 17 ++++---- app/(builder)/builder/[categoryId]/page.tsx | 7 +-- app/page.tsx | 43 ++++++++----------- public/battl/battl-logo-mark-2.svg | 28 ++++++++++++ .../battl/battl-logo-mark.svg | 0 5 files changed, 57 insertions(+), 38 deletions(-) create mode 100644 public/battl/battl-logo-mark-2.svg rename {app/public => public}/battl/battl-logo-mark.svg (100%) diff --git a/app/(builder)/builder/[categoryId]/[partId]/page.tsx b/app/(builder)/builder/[categoryId]/[partId]/page.tsx index 1684c48..f099f1b 100644 --- a/app/(builder)/builder/[categoryId]/[partId]/page.tsx +++ b/app/(builder)/builder/[categoryId]/[partId]/page.tsx @@ -17,7 +17,7 @@ type GunbuilderProductFromApi = { platform: string; partRole: string; price: number | null; - mainImageUrl: string | null; + imageUrl: string | null; buyUrl: string | null; }; @@ -55,21 +55,20 @@ export default function PartDetailPage() { // For now, pull the full AR-15 list and find by UUID. // We can optimize with a dedicated /api/products/{uuid} later. - const url = `${API_BASE_URL}/api/products/gunbuilder?platform=AR-15`; + const url = `${API_BASE_URL}/api/products/gunbuilder/products/${partId}`; const res = await fetch(url, { signal: controller.signal }); if (!res.ok) { throw new Error(`Failed to load product (${res.status})`); } - const data: GunbuilderProductFromApi[] = await res.json(); - const found = data.find((p) => p.id === partId) ?? null; + const data: GunbuilderProductFromApi = await res.json(); - if (!found) { + if (!data) { setError("Product not found"); } - setProduct(found); + setProduct(data); } catch (err: any) { if (err.name === "AbortError") return; setError(err.message ?? "Failed to load product"); @@ -77,7 +76,7 @@ export default function PartDetailPage() { setLoading(false); } } - + fetchProduct(); return () => controller.abort(); @@ -187,11 +186,11 @@ export default function PartDetailPage() {
{/* Left: image + meta */}
- {product.mainImageUrl && ( + {product.imageUrl && (
{/* eslint-disable-next-line @next/next/no-img-element */} {product.name} diff --git a/app/(builder)/builder/[categoryId]/page.tsx b/app/(builder)/builder/[categoryId]/page.tsx index 2d6721a..9ddbe7e 100644 --- a/app/(builder)/builder/[categoryId]/page.tsx +++ b/app/(builder)/builder/[categoryId]/page.tsx @@ -6,6 +6,7 @@ import { useParams, useRouter } from "next/navigation"; import { CATEGORIES } from "@/data/gunbuilderParts"; import type { CategoryId, Part } from "@/types/gunbuilder"; + type ViewMode = "card" | "list"; type GunbuilderProductFromApi = { @@ -134,11 +135,6 @@ export default function CategoryPage() { } }, [build]); - useEffect(() => { - // whenever the category or filters change, jump back to page 1 - setCurrentPage(1); - }, [categoryId, brandFilter, sortBy, searchQuery]); - // handler to toggle Add / Remove for this category const handleTogglePart = (categoryId: CategoryId, partId: string) => { const isSelected = build[categoryId] === partId; @@ -293,6 +289,7 @@ export default function CategoryPage() { return { start, end }; }, [filteredParts.length, currentPage, paginatedParts.length, PAGE_SIZE]); + if (!category) { return (
diff --git a/app/page.tsx b/app/page.tsx index 782f6fb..d8adb76 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,9 +6,9 @@ import Image from "next/image"; export default function HomePage() { const [email, setEmail] = useState(""); const [useCase, setUseCase] = useState(""); - const [status, setStatus] = useState<"idle" | "loading" | "success" | "error">( - "idle" - ); + const [status, setStatus] = useState< + "idle" | "loading" | "success" | "error" + >("idle"); const [message, setMessage] = useState(null); async function handleSubmit(e: FormEvent) { @@ -47,7 +47,7 @@ export default function HomePage() { return (
{/* Abstract Brand Background */} -
+
{/* Logo slot – replace src with your actual logo file */} -
+
Battl Builders logo
-
-

- Battl Builders -

- -
@@ -122,14 +117,15 @@ export default function HomePage() {

- Stop Guessing. + Stop Guessing. - Start Building + Start Building.

- From part comparisons to full-build matchups, Battl Builders helps you find the right components, catch compatibility issues, and score the best deals — all without juggling tabs or spreadsheets. - + From part comparisons to full-build matchups, Battl Builders helps + you find the right components, catch compatibility issues, and + score the best deals — all without juggling tabs or spreadsheets.

    @@ -138,7 +134,6 @@ export default function HomePage() {
  • • Live pricing from vetted merchants
  • • Save & share builds with your crew
  • • Vote on the cleanest, meanest setups
  • -
@@ -212,8 +207,8 @@ export default function HomePage() { )}

- You can one-click unsubscribe - any time with one-click. No data games, no surprise newsletters. + You can one-click unsubscribe any time with one-click. No data + games, no surprise newsletters.

@@ -222,7 +217,7 @@ export default function HomePage() { {/* Footer strip */}
- © {new Date().getFullYear()} BATTL BUILDERS + © {new Date().getFullYear()} BATTL BUILDERS v0.1 • Import engine online • Builder UI in progress @@ -231,4 +226,4 @@ export default function HomePage() {
); -} \ No newline at end of file +} diff --git a/public/battl/battl-logo-mark-2.svg b/public/battl/battl-logo-mark-2.svg new file mode 100644 index 0000000..e2aa477 --- /dev/null +++ b/public/battl/battl-logo-mark-2.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/public/battl/battl-logo-mark.svg b/public/battl/battl-logo-mark.svg similarity index 100% rename from app/public/battl/battl-logo-mark.svg rename to public/battl/battl-logo-mark.svg