diff --git a/app/(account)/account/page.tsx b/app/(account)/account/page.tsx new file mode 100644 index 0000000..df735d8 --- /dev/null +++ b/app/(account)/account/page.tsx @@ -0,0 +1,44 @@ +// app/(account)/account/page.tsx +"use client"; + +import { useAuth } from "@/context/AuthContext"; + +export default function AccountPage() { + const { user, loading } = useAuth(); + + if (loading) return
+ Basic account info (we’ll expand this soon). +
++ Profile, password, and account settings. +
+- BATTL BUILDERS -
-- Snapshot of your current selections. (V1: data resolves from your local build state + live products.) -
-Loading…
- ) : error ? ( -- {error} — check that the Ballistic API is running. -
- ) : ( -?build= first; otherwise it reads your local build.
- - You need to select at least one part to view your build. -
- - Go to Builder - -- Shadow Standard -
-- Review your build, purchase parts from our affiliate partners, or - share your build with others. -
-- Platform: {platform} -
-- Share this link to let others view your build or bookmark it to - come back later. -
-Shareable URL:
-- {shareUrl} -
-Loading parts…
- )} - {partsError && ( -- {partsError} — check the Ballistic API. -
- )} - -- Offers, pricing placeholders, and builder actions — all on the canonical - /parts/p route. + Offers, pricing placeholders, and builder actions — all on the + canonical /parts/p route.
- We’ll wire this to price snapshots once the offer model is stable. + We’ll wire this to price snapshots once the offer model is + stable.
@@ -512,19 +577,39 @@ export default function ProductDetailsPage() { {offers.map((o, idx) => ( -- No offers attached yet. Once offers are available, this becomes the - “where to buy” table. + No offers attached yet. Once offers are available, this + becomes the “where to buy” table.
)} - {/* Keep a single "best" buy CTA if buyUrl exists */} - {product.buyUrl ? ( + {/* Best Offer CTA (uses sorted offers[0]) */} + {bestOffer?.buyUrl ? ( ) : null} @@ -586,4 +673,4 @@ export default function ProductDetailsPage() { ); -} \ No newline at end of file +} diff --git a/app/vault/page.tsx b/app/vault/page.tsx new file mode 100644 index 0000000..e4f7d97 --- /dev/null +++ b/app/vault/page.tsx @@ -0,0 +1,170 @@ +// app/vault/page.tsx +"use client"; + +import Link from "next/link"; +import { useEffect, useMemo, useState } from "react"; +import { useRouter } from "next/navigation"; + +import { useAuth } from "@/context/AuthContext"; + +type BuildDto = { + id: string; + uuid: string; // UUID string + title: string; + description?: string | null; + isPublic?: boolean | null; + createdAt?: string | null; + updatedAt?: string | null; +}; + +const API_BASE_URL = + process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8080"; + +function fmt(d?: string | null) { + if (!d) return "—"; + const dt = new Date(d); + if (Number.isNaN(dt.getTime())) return d; + return dt.toLocaleString(); +} + +export default function VaultPage() { + const router = useRouter(); + const { user, loading, getAuthHeaders } = useAuth(); + + const [builds, setBuilds] = useState+ Your saved builds. Load one into the builder or publish it later. +
+