diff --git a/app/(app)/(builder)/builder/page.tsx b/app/(app)/(builder)/builder/page.tsx index 989d2d2..f119f43 100644 --- a/app/(app)/(builder)/builder/page.tsx +++ b/app/(app)/(builder)/builder/page.tsx @@ -295,7 +295,7 @@ function buildAssemblyRows(params: { rows.push({ key: `${groupLabel}-${paths.complete}`, kind: "category", - label: "Complete Assembly (Fastest)", + label: "Completed Lower (Fastest)", categoryId: paths.complete, indent: 0, pill: mode === "complete" ? "Selected" : undefined, @@ -1625,9 +1625,15 @@ function GunbuilderPageContent() { {selectedPart ? ( -
+ {selectedPart.name} -
+ ) : (
No part selected diff --git a/app/(app)/(builder)/parts/p/[platform]/[partRole]/[productSlug]/page.tsx b/app/(app)/(builder)/parts/p/[platform]/[partRole]/[productSlug]/page.tsx index 471f743..bb964ee 100644 --- a/app/(app)/(builder)/parts/p/[platform]/[partRole]/[productSlug]/page.tsx +++ b/app/(app)/(builder)/parts/p/[platform]/[partRole]/[productSlug]/page.tsx @@ -18,6 +18,7 @@ type OfferFromApi = { price?: number | null; originalPrice?: number | null; buyUrl?: string | null; + buyShortUrl?: string | null; inStock?: boolean | null; lastUpdated?: string | null; }; @@ -29,6 +30,7 @@ type GunbuilderProductFromApi = { platform: string; partRole: string; price: number | null; + caliber?: string | null; // Optional (legacy fallback label if product.offers is missing) merchantName?: string | null; @@ -37,6 +39,7 @@ type GunbuilderProductFromApi = { mainImageUrl?: string | null; buyUrl?: string | null; + buyShortUrl?: string | null; inStock?: boolean | null; shortDescription?: string | null; @@ -249,6 +252,12 @@ export default function ProductDetailsPage() { } const data: GunbuilderProductFromApi = await res.json(); + console.log('[DEBUG] Product from API:', { + id: data.id, + name: data.name, + buyUrl: data.buyUrl, + buyShortUrl: data.buyShortUrl + }); setProduct(data); } catch (err: any) { if (err?.name === "AbortError") return; @@ -286,6 +295,7 @@ export default function ProductDetailsPage() { } const data: OfferFromApi[] = await res.json(); + console.log('[DEBUG] Offers from API:', data); setOffersFromApi(Array.isArray(data) ? data : []); } catch (err: any) { if (err?.name === "AbortError") return; @@ -336,14 +346,23 @@ export default function ProductDetailsPage() { * - Fallback to legacy single-offer derived from product if needed */ const offers = useMemo(() => { - if (offersFromApi.length > 0) return sortOffers(offersFromApi); + if (offersFromApi.length > 0) { + console.log('[DEBUG] Using offers from API, first offer:', offersFromApi[0]); + const fallbackShortUrl = product?.buyShortUrl ?? null; + const normalized = offersFromApi.map((offer) => ({ + ...offer, + buyShortUrl: offer.buyShortUrl || fallbackShortUrl, + })); + return sortOffers(normalized); + } - if (product?.buyUrl) { + if (product?.buyUrl || product?.buyShortUrl) { + console.log('[DEBUG] Using fallback from product, buyShortUrl:', product.buyShortUrl, 'buyUrl:', product.buyUrl); return sortOffers([ { merchantName: product.merchantName ?? "Retailer", price: product.price, - buyUrl: product.buyUrl, + buyUrl: product.buyShortUrl || product.buyUrl, inStock: product.inStock ?? true, }, ]); @@ -565,6 +584,14 @@ export default function ProductDetailsPage() { {product.platform || platform} + {product.caliber && ( + + Caliber:{" "} + + {product.caliber} + + + )} Role:{" "} @@ -666,9 +693,9 @@ export default function ProductDetailsPage() { {o.price != null ? `$${o.price.toFixed(2)}` : "—"} - {o.buyUrl ? ( + {(o.buyShortUrl || o.buyUrl) ? ( ); -} \ No newline at end of file +}