49 Commits

Author SHA1 Message Date
sean cdb3a8dbb3 v0.1.0 commit
CI / deploy (push) Failing after 5s
2026-03-31 11:31:40 -04:00
sean 0e4c49928b fix: make autoFocus a prop on FeedbackForm, only apply in modal context 2026-03-30 20:51:08 -04:00
sean 82a38a7a15 fix: overflow-x-auto on table, remove unused ipAddress from type 2026-03-30 20:47:20 -04:00
sean ca292c4782 feat: add admin feedback review page and nav link 2026-03-30 19:32:50 -04:00
sean e77e6e4e6d feat: add /feedback page, FeedbackModal to TopNav, and footer link
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:29:12 -04:00
sean 98c2b12340 fix: add aria-labelledby to modal, htmlFor/id to form labels, autoFocus on open 2026-03-30 19:27:21 -04:00
sean 8f2a46d3bb feat: add FeedbackForm, FeedbackModal, and Give Feedback tab 2026-03-30 19:24:11 -04:00
sean 0ca864ff20 fix: clear setTimeout ref on unmount, stable roadmapIdKey dep for votes effect 2026-03-30 19:18:23 -04:00
sean 93aa4469e8 feat: wire up roadmap upvote with optimistic UI and inline auth prompt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:15:50 -04:00
sean 89e39e7b18 fix: separate 400/500 error cases in feedback proxy route 2026-03-30 19:14:19 -04:00
sean 8e33a5497a feat: add API proxy routes for feedback and roadmap votes 2026-03-30 16:46:49 -04:00
sean 26bc1a8c21 feat: add roadmap tab with static RoadmapItem component 2026-03-30 16:42:15 -04:00
sean 2d55af4de2 fix: make tags optional in ChangelogEntry, remove unused VoteState import 2026-03-30 16:40:35 -04:00
sean d387484872 feat: add /changelog page with What's New tab
RSC page fetches changelog entries and roadmap items from Sanity with
graceful error fallback. ChangelogTabs client component renders tabbed
UI with What's New fully implemented; What's Next and Give Feedback are
stubs for Tasks 3 and 6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 16:37:41 -04:00
sean e2a2af8a6f feat: add changelog/roadmap types, Sanity queries, and public route whitelist 2026-03-30 16:33:53 -04:00
sean c977e69654 docs: address spec review gaps in changelog/feedback design 2026-03-30 11:00:54 -04:00
sean 9d0eb40554 docs: add changelog, roadmap, and feedback design spec 2026-03-30 10:57:36 -04:00
sean 2a97ae4190 new homepage and event tracking
CI / deploy (push) Failing after 6s
2026-03-30 10:40:24 -04:00
sean a1bb9e97e1 fix: replace opacity-85 no-op and inline gap styles with Tailwind classes 2026-03-30 06:51:31 -04:00
sean b26bc5263b feat: redesign homepage — RSC, 8 sections, remove beta form
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 06:48:37 -04:00
sean 895a2e7406 feat: suppress Early Access Beta banner on homepage 2026-03-30 06:45:12 -04:00
sean 47d5d17d29 placeholder images
CI / deploy (push) Failing after 35s
2026-03-29 07:54:52 -04:00
sean c686da0c03 feat: use ProductImage for part thumbnails on build detail page 2026-03-29 07:43:55 -04:00
sean 680d2b21a1 feat: use ProductImage on product detail page and modal 2026-03-29 07:42:15 -04:00
sean c86d49f317 feat: use ProductImage in ProductDetailPageClient 2026-03-29 07:37:46 -04:00
sean b8a0fd1963 feat: use ProductImage in PartsGrid list view 2026-03-29 07:37:44 -04:00
sean 00613ebc9f feat: add ProductImage component with onError fallback 2026-03-29 07:34:13 -04:00
sean 05a4ad2720 feat: add product image placeholder SVG 2026-03-29 07:28:40 -04:00
sean eb1dfef7b7 analytics
CI / deploy (push) Failing after 5s
2026-03-25 07:16:14 -04:00
sean 10148acaa9 fix: use merchantLabel(o) for retailer in offer row affiliate tracking 2026-03-25 07:10:52 -04:00
sean 019e1892de feat: wire affiliate_link_clicked event in product detail page 2026-03-25 07:09:01 -04:00
sean 668398e66a fix: reset previousPartIdsRef on build clear; clarify first-hydration skip comment 2026-03-25 07:05:57 -04:00
sean f12e2ffee7 fix: fire part_selected after hydration to get real part name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 06:57:13 -04:00
sean 3a345b6c26 feat: wire Umami events in builder page (build_started, part_selected, affiliate_link_clicked, build_shared, build_saved)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 06:50:44 -04:00
sean 754a378782 feat: add Umami analytics helper and window type declaration 2026-03-25 06:41:59 -04:00
sean 37921469d5 builder link
CI / deploy (push) Failing after 6s
2026-03-24 06:10:51 -04:00
dstrawsb 5526920ff8 modded ci.yaml file to deploy both images
CI / deploy (push) Failing after 7s
2026-03-20 22:58:11 -04:00
sean fb52521495 fixed nav, added sanity and guides pages
CI / test (push) Successful in 5s
2026-03-12 07:10:37 -04:00
sean f8265063d5 clean up and disabled beta lock
CI / test (push) Successful in 27s
2026-03-11 07:32:58 -04:00
sean 140b83bd65 small stuff
CI / test (push) Successful in 5s
2026-02-01 08:43:31 -05:00
sean 775ee0f691 small stuff 2026-02-01 07:51:42 -05:00
dstrawsb 4989bf6de4 upgraded to next 15 and react 19.
CI / test (push) Successful in 5s
2026-01-30 22:22:41 -05:00
dstrawsb 4267c34399 package.json changes
CI / test (push) Successful in 5s
2026-01-29 22:45:10 -05:00
dstrawsb 6d1697e672 small name change
CI / test (push) Successful in 6s
2026-01-29 22:40:30 -05:00
dstrawsb 45270f9b18 fixes to admin using client fetch
CI / test (push) Successful in 7s
2026-01-29 21:52:12 -05:00
sean a13687635b middleware fixes
CI / test (push) Successful in 5s
2026-01-27 18:57:08 -05:00
sean c2600b6a68 fix env and middleware
CI / test (push) Successful in 5s
2026-01-27 13:40:49 -05:00
sean b45493f5bd fixed umami
CI / test (push) Successful in 5s
2026-01-27 12:54:16 -05:00
sean cb46430ce4 fixed login auth issue
CI / test (push) Successful in 5s
2026-01-27 09:23:38 -05:00
151 changed files with 22488 additions and 1293 deletions
-4
View File
@@ -7,7 +7,3 @@ NEXT_PUBLIC_LAUNCH_ONLY_ROOT=false
NEXT_PUBLIC_SHORTLINK_BASE_URL=http://localhost:8080
# Brevo API key for beta sign up collection
BREVO_API_KEY=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
BREVO_LIST_ID=9
+2 -4
View File
@@ -2,10 +2,8 @@
NEXT_PUBLIC_API_BASE_URL=http://battlbuilder-api:8080
# Middleware to limited site to only root page
NEXT_PUBLIC_LAUNCH_ONLY_ROOT=true
LAUNCH_ONLY_ROOT=false
NEXT_PUBLIC_SHORTLINK_BASE_URL=https://battl.build
# Brevo API key for beta sign up collection
BREVO_API_KEY=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
BREVO_LIST_ID=9
+12 -3
View File
@@ -1,11 +1,20 @@
name: CI
on:
push:
pull_request:
branches:
- develop
jobs:
test:
deploy:
runs-on: ubuntu
steps:
- uses: actions/checkout@v4
- run: echo "Hello from Gitea Actions"
- name: Pull latest images
run: |
docker pull gitea.gofwd.group/forward_group/ballistic-builder-spring/spring-api:latest
docker pull gitea.gofwd.group/sean/shadow-gunbuilder-ai-proto/webui:latest
- name: Recreate containers with new images
run: docker compose up -d
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="db-tree-configuration">
<option name="data" value="" />
</component>
</project>
@@ -0,0 +1 @@
{"reason":"idle timeout","timestamp":1774884294221}
@@ -0,0 +1,10 @@
{"type":"server-started","port":63304,"host":"127.0.0.1","url_host":"localhost","url":"http://localhost:63304","screen_dir":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/waiting.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/waiting-2.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/changelog-layout.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/roadmap-tab.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/roadmap-votes.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/feedback-form.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/feedback-form-v2.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/20960-1774881654/waiting-3.html"}
{"type":"server-stopped","reason":"idle timeout"}
@@ -0,0 +1 @@
20969
@@ -0,0 +1,113 @@
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding: 32px 24px; }
.wrap { max-width: 900px; margin: 0 auto; }
h2 { font-size: 13px; font-weight: 600; color: #a1a1aa; margin-bottom: 20px; letter-spacing: 0.05em; text-transform: uppercase; }
/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid #27272a; margin-bottom: 40px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #71717a; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab.active { color: #fbbf24; border-bottom-color: #fbbf24; }
/* ── Changelog entries ── */
.entries { display: flex; flex-direction: column; gap: 0; }
.entry { display: grid; grid-template-columns: 120px 1fr; gap: 0 32px; border-bottom: 1px solid #18181b; padding: 32px 0; }
.entry:last-child { border-bottom: none; }
.entry-meta { padding-top: 4px; }
.entry-version { font-size: 12px; font-weight: 700; color: #fbbf24; font-family: monospace; margin-bottom: 4px; }
.entry-date { font-size: 11px; color: #3f3f46; }
.entry-title { font-size: 17px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.entry-body { font-size: 13px; color: #71717a; line-height: 1.7; }
.entry-tags { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: 0.05em; text-transform: uppercase; }
.tag-feature { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.tag-fix { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.2); }
.tag-improvement { background: rgba(147,197,253,0.1); color: #93c5fd; border: 1px solid rgba(147,197,253,0.2); }
/* ── Roadmap items ── */
.roadmap { display: flex; flex-direction: column; gap: 12px; }
.roadmap-item { display: flex; align-items: flex-start; gap: 16px; padding: 20px; border: 1px solid #1c1c1f; border-radius: 10px; background: #0d0d0f; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.status-planned { background: #3f3f46; }
.status-inprogress { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.4); }
.status-shipped { background: #4ade80; }
.roadmap-item-title { font-size: 14px; font-weight: 600; color: #e4e4e7; margin-bottom: 4px; }
.roadmap-item-desc { font-size: 12px; color: #52525b; line-height: 1.6; }
.status-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: 0.06em; text-transform: uppercase; margin-left: auto; flex-shrink: 0; }
.badge-planned { background: rgba(63,63,70,0.4); color: #71717a; border: 1px solid #27272a; }
.badge-inprogress { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.badge-shipped { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.2); }
.page-header { margin-bottom: 40px; }
.page-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #52525b; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: #52525b; }
/* ── Section separators for roadmap ── */
.roadmap-group-label { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: #3f3f46; margin: 24px 0 10px; }
.roadmap-group-label:first-child { margin-top: 0; }
</style>
<div class="wrap">
<div class="page-header">
<p class="page-label">Battl Builders</p>
<h1 class="page-title">Updates</h1>
<p class="page-sub">What we've shipped and what's coming next.</p>
</div>
<div class="tabs">
<div class="tab active">What's New</div>
<div class="tab">What's Next</div>
<div class="tab">Give Feedback</div>
</div>
<!-- WHAT'S NEW -->
<div id="whats-new">
<div class="entries">
<div class="entry">
<div class="entry-meta">
<div class="entry-version">v0.4</div>
<div class="entry-date">Mar 28, 2026</div>
</div>
<div>
<div class="entry-tags">
<span class="tag tag-feature">Feature</span>
<span class="tag tag-improvement">Improvement</span>
</div>
<div class="entry-title">Homepage redesign + open access</div>
<div class="entry-body">Removed the beta gate. New landing page explains what Battl does without the jargon. Compatibility conflict warnings now surface inline while you build.</div>
</div>
</div>
<div class="entry">
<div class="entry-meta">
<div class="entry-version">v0.3</div>
<div class="entry-date">Mar 14, 2026</div>
</div>
<div>
<div class="entry-tags">
<span class="tag tag-feature">Feature</span>
<span class="tag tag-fix">Fix</span>
</div>
<div class="entry-title">Shareable build links + vault</div>
<div class="entry-body">Save and share builds with a single link. Anyone can view the parts list without an account. Fixed gas system validation that was incorrectly flagging mid-length configs.</div>
</div>
</div>
<div class="entry">
<div class="entry-meta">
<div class="entry-version">v0.2</div>
<div class="entry-date">Feb 28, 2026</div>
</div>
<div>
<div class="entry-tags">
<span class="tag tag-feature">Feature</span>
</div>
<div class="entry-title">Live pricing from real retailers</div>
<div class="entry-body">AvantLink feed integration. Running total updates as you add parts. Prices are pulled daily — no estimated MSRP, no sponsored rankings.</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,88 @@
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding: 32px 24px; }
.wrap { max-width: 900px; margin: 0 auto; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid #27272a; margin-bottom: 40px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #71717a; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab.active { color: #fbbf24; border-bottom-color: #fbbf24; }
.page-header { margin-bottom: 40px; }
.page-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #52525b; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: #52525b; }
.feedback-header { margin-bottom: 28px; }
.feedback-header h2 { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.015em; margin-bottom: 6px; }
.feedback-header p { font-size: 13px; color: #52525b; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-field { margin-bottom: 20px; }
.form-label { font-size: 11px; font-weight: 600; color: #71717a; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 8px; display: block; }
.form-input, .form-select, .form-textarea {
width: 100%; padding: 10px 14px; font-size: 13px; font-family: inherit;
background: #0d0d0f; border: 1px solid #27272a; border-radius: 8px;
color: #e4e4e7; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: rgba(251,191,36,0.4); }
.form-textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: 11px; color: #3f3f46; margin-top: 6px; }
.char-count { font-size: 11px; color: #3f3f46; text-align: right; margin-top: 6px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.form-footer-note { font-size: 11px; color: #3f3f46; }
.btn-submit {
display: inline-flex; align-items: center; gap: 8px;
background: rgba(251,191,36,0.9); color: #000; font-size: 13px; font-weight: 700;
padding: 10px 28px; border-radius: 8px; border: none; cursor: pointer;
letter-spacing: 0.02em; font-family: inherit;
}
.btn-submit:hover { background: #fbbf24; }
</style>
<div class="wrap">
<div class="page-header">
<p class="page-label">Battl Builders</p>
<h1 class="page-title">Updates</h1>
<p class="page-sub">What we've shipped and what's coming next.</p>
</div>
<div class="tabs">
<div class="tab">What's New</div>
<div class="tab">What's Next</div>
<div class="tab active">Give Feedback</div>
</div>
<div class="feedback-header">
<h2>Tell us what you think.</h2>
<p>Bug, feature idea, or general thought — we read everything. Rough language welcome.</p>
</div>
<div class="form-row">
<div class="form-field">
<label class="form-label">Category</label>
<select class="form-select">
<option>Bug report</option>
<option>Feature request</option>
<option>General feedback</option>
</select>
</div>
<div class="form-field">
<label class="form-label">Email <span style="color:#3f3f46; font-weight:400; text-transform:none; letter-spacing:0;">(optional — if you want a reply)</span></label>
<input class="form-input" type="email" placeholder="you@email.com" />
</div>
</div>
<div class="form-field">
<label class="form-label">Message</label>
<textarea class="form-textarea" placeholder="What's on your mind?"></textarea>
<div class="char-count">0 / 1000</div>
</div>
<div class="form-footer">
<span class="form-footer-note">We'll only use your email to follow up on your feedback.</span>
<button class="btn-submit">Send Feedback →</button>
</div>
</div>
@@ -0,0 +1,160 @@
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding: 32px 24px; }
.wrap { max-width: 900px; margin: 0 auto; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid #27272a; margin-bottom: 40px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #71717a; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab.active { color: #fbbf24; border-bottom-color: #fbbf24; }
.page-header { margin-bottom: 40px; }
.page-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #52525b; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: #52525b; }
/* ── Shared form styles ── */
.form-label { font-size: 11px; font-weight: 600; color: #71717a; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 8px; display: block; }
.form-field { margin-bottom: 20px; }
.form-input, .form-select, .form-textarea {
width: 100%; padding: 10px 14px; font-size: 13px; font-family: inherit;
background: #0d0d0f; border: 1px solid #27272a; border-radius: 8px;
color: #e4e4e7; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: rgba(251,191,36,0.4); }
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: 11px; color: #3f3f46; margin-top: 6px; }
.btn-submit {
display: inline-flex; align-items: center; gap-8px; gap: 8px;
background: rgba(251,191,36,0.9); color: #000; font-size: 13px; font-weight: 700;
padding: 10px 24px; border-radius: 8px; border: none; cursor: pointer;
letter-spacing: 0.02em; font-family: inherit;
}
.btn-submit:hover { background: #fbbf24; }
/* ── Split view ── */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
/* ── Page form (tab) ── */
.feedback-page { max-width: 560px; }
.feedback-page-header { margin-bottom: 28px; }
.feedback-page-header h2 { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.015em; margin-bottom: 6px; }
.feedback-page-header p { font-size: 13px; color: #52525b; line-height: 1.6; }
/* ── Modal ── */
.modal-wrap { position: relative; }
.modal-label { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: #52525b; margin-bottom: 12px; text-align: center; }
.modal {
background: #111113; border: 1px solid #27272a; border-radius: 14px;
padding: 28px; width: 100%;
box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.modal-close { font-size: 18px; color: #3f3f46; cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; line-height: 1; }
.modal-close:hover { color: #71717a; }
/* Nav trigger button (shown for context) */
.nav-context { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #18181b; }
.nav-context-label { font-size: 10px; color: #3f3f46; letter-spacing: 0.05em; }
.btn-feedback-nav {
padding: 6px 12px; border-radius: 6px; font-size: 11px; font-weight: 600;
border: 1px solid #27272a; color: #71717a; background: transparent;
cursor: pointer; font-family: inherit; letter-spacing: 0.02em;
}
.divider { width: 1px; background: #18181b; align-self: stretch; }
.char-count { font-size: 11px; color: #3f3f46; text-align: right; margin-top: 6px; }
</style>
<div class="wrap">
<div class="page-header">
<p class="page-label">Battl Builders</p>
<h1 class="page-title">Updates</h1>
<p class="page-sub">What we've shipped and what's coming next.</p>
</div>
<div class="tabs">
<div class="tab">What's New</div>
<div class="tab">What's Next</div>
<div class="tab active">Give Feedback</div>
</div>
<div class="split">
<!-- LEFT: Tab / page form -->
<div>
<p class="modal-label" style="text-align:left; margin-bottom: 20px;">Give Feedback tab (full page)</p>
<div class="feedback-page">
<div class="feedback-page-header">
<h2>Tell us what you think.</h2>
<p>Bug, feature idea, or general thought — we read everything. Rough language welcome.</p>
</div>
<div class="form-field">
<label class="form-label">Category</label>
<select class="form-select">
<option>Bug report</option>
<option>Feature request</option>
<option>General feedback</option>
</select>
</div>
<div class="form-field">
<label class="form-label">Message</label>
<textarea class="form-textarea" placeholder="What's on your mind?"></textarea>
<div class="char-count">0 / 1000</div>
</div>
<div class="form-field">
<label class="form-label">Email <span style="color:#3f3f46; font-weight:400; text-transform:none; letter-spacing:0;">(optional — if you want a reply)</span></label>
<input class="form-input" type="email" placeholder="you@email.com" />
<p class="form-hint">We'll only use this to follow up on your feedback.</p>
</div>
<button class="btn-submit">Send Feedback →</button>
</div>
</div>
<div class="divider"></div>
<!-- RIGHT: Modal (triggered from nav/footer) -->
<div>
<div class="nav-context">
<span class="nav-context-label">Triggered from nav/footer →</span>
<button class="btn-feedback-nav">Send Feedback</button>
</div>
<p class="modal-label">Modal</p>
<div class="modal">
<div class="modal-header">
<span class="modal-title">Send Feedback</span>
<button class="modal-close"></button>
</div>
<div class="form-field">
<label class="form-label">Category</label>
<select class="form-select">
<option>Bug report</option>
<option>Feature request</option>
<option>General feedback</option>
</select>
</div>
<div class="form-field">
<label class="form-label">Message</label>
<textarea class="form-textarea" style="min-height:100px;" placeholder="What's on your mind?"></textarea>
<div class="char-count">0 / 1000</div>
</div>
<div class="form-field">
<label class="form-label">Email <span style="color:#3f3f46; font-weight:400; text-transform:none; letter-spacing:0;">(optional)</span></label>
<input class="form-input" type="email" placeholder="you@email.com" />
</div>
<button class="btn-submit" style="width:100%; justify-content:center;">Send Feedback →</button>
</div>
</div>
</div>
</div>
@@ -0,0 +1,104 @@
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding: 32px 24px; }
.wrap { max-width: 900px; margin: 0 auto; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid #27272a; margin-bottom: 40px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #71717a; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab.active { color: #fbbf24; border-bottom-color: #fbbf24; }
.page-header { margin-bottom: 40px; }
.page-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #52525b; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: #52525b; }
.roadmap { display: flex; flex-direction: column; gap: 10px; }
.roadmap-item { display: flex; align-items: flex-start; gap: 16px; padding: 20px; border: 1px solid #1c1c1f; border-radius: 10px; background: #0d0d0f; }
.dot-col { display: flex; flex-direction: column; align-items: center; gap: 0; padding-top: 5px; flex-shrink: 0; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-planned .status-dot { background: #3f3f46; }
.status-inprogress .status-dot { background: #fbbf24; box-shadow: 0 0 10px rgba(251,191,36,0.5); }
.status-shipped .status-dot { background: #4ade80; }
.roadmap-body { flex: 1; }
.roadmap-item-title { font-size: 14px; font-weight: 600; color: #e4e4e7; margin-bottom: 4px; }
.roadmap-item-desc { font-size: 12px; color: #52525b; line-height: 1.65; }
.status-badge { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 99px; letter-spacing: 0.06em; text-transform: uppercase; flex-shrink: 0; margin-top: 2px; }
.status-planned .status-badge { background: rgba(63,63,70,0.4); color: #52525b; border: 1px solid #27272a; }
.status-inprogress .status-badge { background: rgba(251,191,36,0.08); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.status-shipped .status-badge { background: rgba(74,222,128,0.08); color: #4ade80; border: 1px solid rgba(74,222,128,0.2); }
.group-label { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #3f3f46; margin: 28px 0 10px; }
.group-label:first-child { margin-top: 0; }
.roadmap-note { margin-top: 32px; padding: 16px 20px; border: 1px solid #18181b; border-radius: 8px; font-size: 12px; color: #3f3f46; line-height: 1.6; }
.roadmap-note a { color: #52525b; text-decoration: underline; text-underline-offset: 3px; }
</style>
<div class="wrap">
<div class="page-header">
<p class="page-label">Battl Builders</p>
<h1 class="page-title">Updates</h1>
<p class="page-sub">What we've shipped and what's coming next.</p>
</div>
<div class="tabs">
<div class="tab">What's New</div>
<div class="tab active">What's Next</div>
<div class="tab">Give Feedback</div>
</div>
<div class="roadmap">
<div class="group-label">In Progress</div>
<div class="roadmap-item status-inprogress">
<div class="dot-col"><span class="status-dot"></span></div>
<div class="roadmap-body">
<div class="roadmap-item-title">Compatibility engine — gas system + buffer</div>
<div class="roadmap-item-desc">Automatic warnings when barrel length and gas system length don't match, and when buffer weight conflicts with your stock/brace selection.</div>
</div>
<span class="status-badge">In Progress</span>
</div>
<div class="roadmap-item status-inprogress">
<div class="dot-col"><span class="status-dot"></span></div>
<div class="roadmap-body">
<div class="roadmap-item-title">Mobile builder experience</div>
<div class="roadmap-item-desc">Full 375px breakpoint pass on the builder, parts browser, and build summary. Lighthouse score target ≥70.</div>
</div>
<span class="status-badge">In Progress</span>
</div>
<div class="group-label">Planned</div>
<div class="roadmap-item status-planned">
<div class="dot-col"><span class="status-dot"></span></div>
<div class="roadmap-body">
<div class="roadmap-item-title">Expanded parts catalog</div>
<div class="roadmap-item-desc">5075 SKUs across all 10 slots, 35 options per category, with live AvantLink pricing.</div>
</div>
<span class="status-badge">Planned</span>
</div>
<div class="roadmap-item status-planned">
<div class="dot-col"><span class="status-dot"></span></div>
<div class="roadmap-body">
<div class="roadmap-item-title">Build guides — first wave</div>
<div class="roadmap-item-desc">Three long-form guides targeting "AR-15 build planner" and related keywords. Written for the ICP: experienced shooter, not an expert builder.</div>
</div>
<span class="status-badge">Planned</span>
</div>
<div class="roadmap-item status-planned">
<div class="dot-col"><span class="status-dot"></span></div>
<div class="roadmap-body">
<div class="roadmap-item-title">Caliber cross-compatibility checks</div>
<div class="roadmap-item-desc">Flag mismatches between upper and lower when mixing calibers (e.g., .300 Blackout upper on a 5.56 lower).</div>
</div>
<span class="status-badge">Planned</span>
</div>
<div class="roadmap-note">
Have something you want to see? <a href="#">Give us feedback →</a>
</div>
</div>
</div>
@@ -0,0 +1,150 @@
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding: 32px 24px; }
.wrap { max-width: 900px; margin: 0 auto; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid #27272a; margin-bottom: 40px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #71717a; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab.active { color: #fbbf24; border-bottom-color: #fbbf24; }
.page-header { margin-bottom: 40px; }
.page-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #52525b; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: #52525b; }
.roadmap { display: flex; flex-direction: column; gap: 10px; }
.roadmap-item {
display: grid;
grid-template-columns: 52px 1fr auto;
gap: 0 16px;
align-items: center;
padding: 20px;
border: 1px solid #1c1c1f;
border-radius: 10px;
background: #0d0d0f;
}
/* Upvote button */
.upvote {
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 3px; width: 44px; height: 52px;
border: 1px solid #27272a; border-radius: 8px; background: transparent;
cursor: pointer; color: #52525b; transition: all 0.15s;
font-size: 11px; font-weight: 700; font-family: inherit;
}
.upvote:hover { border-color: #fbbf24; color: #fbbf24; background: rgba(251,191,36,0.06); }
.upvote.voted { border-color: rgba(251,191,36,0.4); color: #fbbf24; background: rgba(251,191,36,0.08); }
.upvote svg { width: 14px; height: 14px; }
.roadmap-body { }
.roadmap-item-title { font-size: 14px; font-weight: 600; color: #e4e4e7; margin-bottom: 4px; }
.roadmap-item-desc { font-size: 12px; color: #52525b; line-height: 1.65; }
.right-col { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.status-badge { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 99px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.badge-planned { background: rgba(63,63,70,0.4); color: #52525b; border: 1px solid #27272a; }
.badge-inprogress { background: rgba(251,191,36,0.08); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.group-label { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #3f3f46; margin: 28px 0 10px; }
.group-label:first-child { margin-top: 0; }
.roadmap-note { margin-top: 32px; padding: 16px 20px; border: 1px solid #18181b; border-radius: 8px; font-size: 12px; color: #3f3f46; line-height: 1.6; }
.roadmap-note a { color: #52525b; text-decoration: underline; text-underline-offset: 3px; }
.auth-hint { font-size: 10px; color: #3f3f46; margin-top: 4px; }
</style>
<div class="wrap">
<div class="page-header">
<p class="page-label">Battl Builders</p>
<h1 class="page-title">Updates</h1>
<p class="page-sub">What we've shipped and what's coming next.</p>
</div>
<div class="tabs">
<div class="tab">What's New</div>
<div class="tab active">What's Next</div>
<div class="tab">Give Feedback</div>
</div>
<div class="roadmap">
<div class="group-label">In Progress</div>
<div class="roadmap-item">
<button class="upvote voted" title="Remove vote">
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2l5 7H3z"/></svg>
24
</button>
<div class="roadmap-body">
<div class="roadmap-item-title">Compatibility engine — gas system + buffer</div>
<div class="roadmap-item-desc">Automatic warnings when barrel length and gas system length don't match, and when buffer weight conflicts with your stock or brace selection.</div>
</div>
<div class="right-col">
<span class="status-badge badge-inprogress">In Progress</span>
</div>
</div>
<div class="roadmap-item">
<button class="upvote" title="Upvote">
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2l5 7H3z"/></svg>
11
</button>
<div class="roadmap-body">
<div class="roadmap-item-title">Mobile builder experience</div>
<div class="roadmap-item-desc">Full 375px breakpoint pass on the builder, parts browser, and build summary. Lighthouse score target ≥70.</div>
</div>
<div class="right-col">
<span class="status-badge badge-inprogress">In Progress</span>
</div>
</div>
<div class="group-label">Planned</div>
<div class="roadmap-item">
<button class="upvote" title="Upvote">
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2l5 7H3z"/></svg>
38
</button>
<div class="roadmap-body">
<div class="roadmap-item-title">Expanded parts catalog</div>
<div class="roadmap-item-desc">5075 SKUs across all 10 slots, 35 options per category, with live AvantLink pricing.</div>
</div>
<div class="right-col">
<span class="status-badge badge-planned">Planned</span>
</div>
</div>
<div class="roadmap-item">
<button class="upvote" title="Upvote">
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2l5 7H3z"/></svg>
17
</button>
<div class="roadmap-body">
<div class="roadmap-item-title">Caliber cross-compatibility checks</div>
<div class="roadmap-item-desc">Flag mismatches between upper and lower when mixing calibers (e.g., .300 Blackout upper on a 5.56 lower).</div>
</div>
<div class="right-col">
<span class="status-badge badge-planned">Planned</span>
</div>
</div>
<div class="roadmap-item">
<button class="upvote" title="Upvote">
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2l5 7H3z"/></svg>
9
</button>
<div class="roadmap-body">
<div class="roadmap-item-title">Build guides — first wave</div>
<div class="roadmap-item-desc">Three long-form guides targeting "AR-15 build planner" and related keywords. Written for the ICP: experienced shooter, not an expert builder.</div>
</div>
<div class="right-col">
<span class="status-badge badge-planned">Planned</span>
</div>
</div>
<div class="roadmap-note">
Don't see what you need? <a href="#">Give us feedback →</a>
</div>
</div>
</div>
@@ -0,0 +1,3 @@
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
<p class="subtitle">Continuing in terminal...</p>
</div>
@@ -0,0 +1,3 @@
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
<p class="subtitle">Continuing in terminal...</p>
</div>
@@ -0,0 +1,3 @@
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
<p class="subtitle">Continuing in terminal...</p>
</div>
@@ -0,0 +1 @@
{"reason":"idle timeout","timestamp":1774866020266}
@@ -0,0 +1,10 @@
{"type":"server-started","port":60692,"host":"127.0.0.1","url_host":"localhost","url":"http://localhost:60692","screen_dir":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/hero-layout.html"}
{"source":"user-event","type":"click","text":"AR-15 Build Planner\n Build smarter rifles.No spreadsheets.\n Pick parts by role, catch compatibility issues, compare live prices — all in one place.\n \n START A BUILD →\n \n \n ▶ Builder preview video\n \n \n \n \n A — Centered / Full-width\n Headline + tagline centered, single dominant CTA button, product video below. Clean, magazine-style. Works great on mobile.","choice":"centered","id":null,"timestamp":1774863085356}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/page-sections.html"}
{"source":"user-event","type":"click","text":"HERO\n \"Stop Guessing. Start Building.\" + subhead + CTA\n \n ↓\n \n HOW IT WORKS\n 3 steps with icons\n \n ↓\n \n BUILDER PREVIEW VIDEO\n Tool in action\n \n ↓\n \n FEATURE CARDS\n 6 capabilities\n \n ↓\n \n SEO COPY BLOCK\n Short paragraph: \"What is an AR-15 builder tool?\" — targets search\n \n ↓\n \n FINAL CTA\n Second \"Start a Build\" button\n \n \n \n \n C — SEO-Optimized (6 sections)\n Same as B but adds a short prose block at the bottom targeting search keywords (\"AR-15 parts compatibility tool\", \"AR-15 build planner\"). Best for organic discovery over time.","choice":"seo","id":null,"timestamp":1774863262165}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/waiting-1.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/full-design-v1.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/full-design-v2.html"}
{"type":"screen-added","file":"/Users/sean/Dev/battl/gunbuilder-prototype/.superpowers/brainstorm/3703-1774862900/full-design-v3.html"}
{"type":"server-stopped","reason":"idle timeout"}
@@ -0,0 +1 @@
3712
@@ -0,0 +1,335 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Battl Builders — Homepage Redesign Mockup</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
/* ── GRID BACKGROUND ── */
.bg-grid {
position: fixed; inset: 0; pointer-events: none; z-index: 0;
background-image:
linear-gradient(rgba(251,191,36,0.07) 1px, transparent 1px),
linear-gradient(90deg, rgba(251,191,36,0.07) 1px, transparent 1px);
background-size: 60px 60px;
}
.wrap { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 0 24px; }
/* ── NAV ── */
nav {
position: relative; z-index: 10;
display: flex; align-items: center; justify-content: space-between;
padding: 20px 24px; max-width: 960px; margin: 0 auto;
}
.logo { height: 32px; display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.logo-text span { color: #fbbf24; }
.nav-links { display: flex; gap: 8px; }
.btn-ghost {
padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
border: 1px solid #27272a; color: #d4d4d8; background: transparent;
cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { background: #18181b; color: #fff; }
.btn-amber {
padding: 7px 16px; border-radius: 6px; font-size: 12px; font-weight: 700;
background: #fbbf24; color: #000; border: none; cursor: pointer;
text-decoration: none; letter-spacing: 0.02em;
}
.btn-amber:hover { background: #f59e0b; }
/* ── HERO ── */
.hero {
text-align: center; padding: 80px 24px 72px;
max-width: 760px; margin: 0 auto;
}
.hero-badge {
display: inline-flex; align-items: center; gap: 6px;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.4);
border-radius: 99px; padding: 4px 12px;
font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.6);
margin-bottom: 28px;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #fbbf24; }
.hero h1 {
font-size: clamp(36px, 6vw, 60px); font-weight: 700; line-height: 1.1;
letter-spacing: -0.03em; color: #fff; margin-bottom: 8px;
}
.hero h1 .amber { color: #fbbf24; display: block; }
.hero-sub {
font-size: 16px; color: #a1a1aa; line-height: 1.6;
max-width: 540px; margin: 20px auto 0;
}
.hero-cta-wrap { margin-top: 36px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn-cta {
display: inline-flex; align-items: center; gap: 8px;
background: #fbbf24; color: #000; font-size: 15px; font-weight: 800;
padding: 14px 36px; border-radius: 8px; border: none; cursor: pointer;
letter-spacing: 0.02em; text-decoration: none;
box-shadow: 0 0 32px rgba(251,191,36,0.25);
}
.btn-cta:hover { background: #f59e0b; }
.hero-micro { font-size: 11px; color: #52525b; }
/* ── HOW IT WORKS ── */
.how { padding: 64px 24px; }
.section-label {
text-align: center; font-size: 10px; font-weight: 600;
letter-spacing: 0.25em; text-transform: uppercase; color: #fbbf24; margin-bottom: 14px;
opacity: 0.85;
}
.how h2 {
text-align: center; font-size: 28px; font-weight: 700;
letter-spacing: -0.02em; color: #fff; margin-bottom: 48px;
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 800px; margin: 0 auto; }
.step {
text-align: center; padding: 32px 20px;
background: rgba(255,255,255,0.03); border: 1px solid #1c1c1f; border-radius: 12px;
}
.step-num {
width: 36px; height: 36px; border-radius: 50%;
background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3);
color: #fbbf24; font-size: 14px; font-weight: 700;
display: flex; align-items: center; justify-content: center;
margin: 0 auto 16px;
}
.step h3 { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.step p { font-size: 12px; color: #71717a; line-height: 1.5; }
.step-connector { display: none; }
/* ── VIDEO ── */
.video-section { padding: 0 24px 64px; }
.video-wrap {
max-width: 900px; margin: 0 auto;
border-radius: 16px; overflow: hidden;
border: 1px solid rgba(255,255,255,0.08);
background: #000;
box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.video-placeholder {
aspect-ratio: 16/9; background: #0f0f0f;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.play-btn {
width: 52px; height: 52px; border-radius: 50%;
background: rgba(251,191,36,0.15); border: 1px solid rgba(251,191,36,0.35);
display: flex; align-items: center; justify-content: center;
font-size: 18px;
}
.video-placeholder p { font-size: 12px; color: #52525b; }
/* ── FEATURES ── */
.features { padding: 64px 24px; }
.features h2 {
text-align: center; font-size: 28px; font-weight: 700;
letter-spacing: -0.02em; color: #fff; margin-bottom: 8px;
}
.features-sub { text-align: center; font-size: 14px; color: #71717a; margin-bottom: 44px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
.feature-card {
padding: 22px; background: rgba(255,255,255,0.025);
border: 1px solid #1c1c1f; border-radius: 12px;
}
.feature-icon { font-size: 20px; margin-bottom: 12px; }
.feature-card h3 { font-size: 13px; font-weight: 600; color: #e4e4e7; margin-bottom: 6px; }
.feature-card p { font-size: 11px; color: #71717a; line-height: 1.5; }
/* ── SEO BLOCK ── */
.seo-block {
padding: 64px 24px;
border-top: 1px solid #1c1c1f;
}
.seo-inner {
max-width: 680px; margin: 0 auto;
}
.seo-inner h2 { font-size: 20px; font-weight: 700; color: #e4e4e7; margin-bottom: 14px; }
.seo-inner p { font-size: 13px; color: #71717a; line-height: 1.7; margin-bottom: 12px; }
.seo-inner strong { color: #a1a1aa; }
/* ── FINAL CTA ── */
.final-cta {
padding: 80px 24px;
text-align: center;
border-top: 1px solid #1c1c1f;
}
.final-cta h2 { font-size: 32px; font-weight: 700; color: #fff; margin-bottom: 12px; letter-spacing: -0.02em; }
.final-cta p { font-size: 14px; color: #71717a; margin-bottom: 32px; }
/* ── FOOTER ── */
footer {
border-top: 1px solid #18181b; padding: 20px 24px;
display: flex; justify-content: space-between; align-items: center;
font-size: 11px; color: #3f3f46; max-width: 960px; margin: 0 auto;
}
/* ── ANNOTATION ── */
.annotation {
position: fixed; bottom: 16px; right: 16px;
background: #18181b; border: 1px solid #27272a; border-radius: 8px;
padding: 12px 16px; font-size: 11px; color: #a1a1aa; max-width: 260px;
z-index: 100;
}
.annotation strong { color: #fbbf24; display: block; margin-bottom: 4px; }
/* Selection overlay */
#selection-indicator {
display: none;
}
</style>
</head>
<body>
<div class="bg-grid"></div>
<!-- NAV -->
<nav>
<div class="logo">
<div class="logo-text">BATTL<span>.</span>BUILDERS</div>
</div>
<div class="nav-links">
<a href="#" class="btn-ghost">Sign In</a>
<a href="#" class="btn-amber">Start a Build</a>
</div>
</nav>
<!-- HERO -->
<section class="hero">
<div class="hero-badge">
<span class="hero-badge-dot"></span>
AR-15 Build Planner
<span style="color:rgba(255,255,255,0.3)"></span>
<span>Free to use</span>
</div>
<h1>
Stop Guessing.
<span class="amber">Start Building.</span>
</h1>
<p class="hero-sub">
Pick parts by role, catch compatibility issues before you order, and compare live retailer prices — all without a spreadsheet.
</p>
<div class="hero-cta-wrap">
<a href="#" class="btn-cta">
Start a Build &nbsp;
</a>
<span class="hero-micro">No account required &nbsp;·&nbsp; Free to use</span>
</div>
</section>
<!-- HOW IT WORKS -->
<section class="how wrap">
<div class="section-label">How it works</div>
<h2>Three steps from idea to order</h2>
<div class="steps">
<div class="step">
<div class="step-num">1</div>
<h3>Pick your parts</h3>
<p>Choose from real parts organized by role — barrel, lower, upper, and more. No part numbers required.</p>
</div>
<div class="step">
<div class="step-num">2</div>
<h3>Check compatibility</h3>
<p>Catch mismatches before you order. Gas system, buffer weight, caliber — flagged automatically.</p>
</div>
<div class="step">
<div class="step-num">3</div>
<h3>Compare prices &amp; buy</h3>
<p>See live prices from real retailers. Click through to buy — we never touch your order.</p>
</div>
</div>
</section>
<!-- VIDEO -->
<section class="video-section">
<div class="video-wrap">
<div class="video-placeholder">
<div class="play-btn"></div>
<p>Builder preview — looping screen recording</p>
</div>
</div>
</section>
<!-- FEATURES -->
<section class="features wrap">
<div class="section-label">What's included</div>
<h2>Everything you need to plan a build</h2>
<p class="features-sub">No fluff. No upsells. Just the tools to plan your AR-15 right.</p>
<div class="feature-grid">
<div class="feature-card">
<div class="feature-icon">🔧</div>
<h3>Guided part roles</h3>
<p>Pick parts by role so you're never guessing what fits where.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🛡️</div>
<h3>Compatibility warnings</h3>
<p>Catch obvious mismatches — gas system, buffer, caliber — before you buy.</p>
</div>
<div class="feature-card">
<div class="feature-icon">💰</div>
<h3>Live pricing totals</h3>
<p>Running total as you build, with real retailer listings updated regularly.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🔖</div>
<h3>Save your builds</h3>
<p>Create a free account to save builds and pick up where you left off.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🔗</div>
<h3>Shareable build links</h3>
<p>Share a build URL with your buddy or your gunsmith. No login needed to view.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🚫</div>
<h3>No account to browse</h3>
<p>Explore parts and build freely. Create an account only when you're ready to save.</p>
</div>
</div>
</section>
<!-- SEO COPY BLOCK -->
<section class="seo-block">
<div class="seo-inner">
<h2>What is Battl Builders?</h2>
<p>
Battl Builders is a free <strong>AR-15 build planner</strong> that helps you select compatible parts, compare prices across retailers, and plan your build from start to finish — without juggling spreadsheets or browser tabs.
</p>
<p>
Unlike a generic parts list, Battl Builders understands <strong>AR-15 compatibility rules</strong>: gas system length vs. barrel length, buffer weight vs. stock type, caliber consistency across upper and lower. You get warnings when something doesn't match before you spend money on the wrong part.
</p>
<p>
Whether you're planning your first build or your tenth, Battl Builders gives you a structured, guided way to research parts and <strong>buy with confidence</strong>.
</p>
</div>
</section>
<!-- FINAL CTA -->
<section class="final-cta">
<h2>Ready to build?</h2>
<p>It's free, no account required, and takes about 5 minutes to start.</p>
<a href="#" class="btn-cta">
Start a Build &nbsp;
</a>
</section>
<!-- FOOTER -->
<footer>
<span>© 2026 BATTL BUILDERS™</span>
<span>Free AR-15 build planner</span>
</footer>
<div class="annotation">
<strong>📐 Design Mockup</strong>
Full homepage redesign preview. Scroll to see all 6 sections. Reply in terminal with feedback.
</div>
<script>
// No selection needed for full-page mockup — just viewing
</script>
</body>
</html>
@@ -0,0 +1,312 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Battl Builders — Homepage Redesign Mockup v2</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.bg-grid {
position: fixed; inset: 0; pointer-events: none; z-index: 0;
background-image:
linear-gradient(rgba(251,191,36,0.07) 1px, transparent 1px),
linear-gradient(90deg, rgba(251,191,36,0.07) 1px, transparent 1px);
background-size: 60px 60px;
}
.wrap { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 0 24px; }
/* ── NAV ── */
nav {
position: relative; z-index: 10;
display: flex; align-items: center; justify-content: space-between;
padding: 20px 24px; max-width: 960px; margin: 0 auto;
}
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.logo-text span { color: #fbbf24; }
.nav-links { display: flex; gap: 8px; }
.btn-ghost {
padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
border: 1px solid #27272a; color: #d4d4d8; background: transparent;
cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { background: #18181b; color: #fff; }
.btn-amber {
padding: 7px 16px; border-radius: 6px; font-size: 12px; font-weight: 700;
background: #fbbf24; color: #000; border: none; cursor: pointer;
text-decoration: none; letter-spacing: 0.02em;
}
/* ── HERO ── */
.hero {
text-align: center; padding: 80px 24px 72px;
max-width: 760px; margin: 0 auto; position: relative; z-index: 1;
}
.hero-badge {
display: inline-flex; align-items: center; gap: 6px;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.4);
border-radius: 99px; padding: 5px 14px;
font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.55);
margin-bottom: 28px;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #fbbf24; flex-shrink: 0; }
.hero h1 {
font-size: clamp(38px, 6.5vw, 64px); font-weight: 700; line-height: 1.05;
letter-spacing: -0.035em; color: #fff; margin-bottom: 8px;
}
.hero h1 .amber { color: #fbbf24; display: block; }
.hero-sub {
font-size: 17px; color: #a1a1aa; line-height: 1.65;
max-width: 520px; margin: 22px auto 0;
}
.hero-cta-wrap { margin-top: 38px; display: flex; flex-direction: column; align-items: center; gap: 11px; }
.btn-cta {
display: inline-flex; align-items: center; gap: 8px;
background: #fbbf24; color: #000; font-size: 15px; font-weight: 800;
padding: 15px 38px; border-radius: 8px; border: none; cursor: pointer;
letter-spacing: 0.03em; text-decoration: none;
box-shadow: 0 0 40px rgba(251,191,36,0.2);
}
.btn-cta:hover { background: #f59e0b; }
.hero-micro { font-size: 11px; color: #52525b; letter-spacing: 0.05em; }
/* ── HOW IT WORKS ── */
.how { padding: 72px 24px; position: relative; z-index: 1; }
.section-label {
text-align: center; font-size: 10px; font-weight: 700;
letter-spacing: 0.25em; text-transform: uppercase; color: #fbbf24;
margin-bottom: 12px; opacity: 0.85;
}
.how h2 {
text-align: center; font-size: 30px; font-weight: 700;
letter-spacing: -0.025em; color: #fff; margin-bottom: 6px;
}
.how-sub { text-align: center; font-size: 14px; color: #71717a; margin-bottom: 48px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; max-width: 840px; margin: 0 auto; background: #18181b; border-radius: 12px; overflow: hidden; border: 1px solid #1c1c1f; }
.step { padding: 32px 24px; background: #0d0d0f; }
.step-num {
font-size: 11px; font-weight: 700; letter-spacing: 0.15em;
color: #fbbf24; text-transform: uppercase; margin-bottom: 14px;
opacity: 0.8;
}
.step h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 10px; letter-spacing: -0.01em; }
.step p { font-size: 13px; color: #71717a; line-height: 1.6; }
/* ── VIDEO ── */
.video-section { padding: 0 24px 72px; position: relative; z-index: 1; }
.video-wrap {
max-width: 900px; margin: 0 auto;
border-radius: 14px; overflow: hidden;
border: 1px solid rgba(255,255,255,0.07);
background: #000;
box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(251,191,36,0.05);
}
.video-placeholder {
aspect-ratio: 16/9; background: #0a0a0a;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.play-btn {
width: 56px; height: 56px; border-radius: 50%;
background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3);
display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.video-placeholder p { font-size: 12px; color: #3f3f46; }
/* ── FEATURES ── */
.features { padding: 72px 24px; position: relative; z-index: 1; }
.features h2 {
text-align: center; font-size: 30px; font-weight: 700;
letter-spacing: -0.025em; color: #fff; margin-bottom: 8px;
}
.features-sub { text-align: center; font-size: 13px; color: #52525b; margin-bottom: 44px; letter-spacing: 0.02em; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; max-width: 900px; margin: 0 auto; background: #18181b; border-radius: 12px; overflow: hidden; border: 1px solid #1c1c1f; }
.feature-card { padding: 24px; background: #0d0d0f; }
.feature-icon { font-size: 18px; margin-bottom: 14px; display: block; }
.feature-card h3 { font-size: 13px; font-weight: 700; color: #e4e4e7; margin-bottom: 7px; letter-spacing: -0.01em; }
.feature-card p { font-size: 12px; color: #52525b; line-height: 1.6; }
/* ── SEO BLOCK ── */
.seo-block {
padding: 72px 24px;
border-top: 1px solid #18181b;
position: relative; z-index: 1;
}
.seo-inner { max-width: 680px; margin: 0 auto; }
.seo-inner h2 { font-size: 22px; font-weight: 700; color: #d4d4d8; margin-bottom: 18px; letter-spacing: -0.02em; }
.seo-inner p { font-size: 14px; color: #71717a; line-height: 1.75; margin-bottom: 14px; }
.seo-inner strong { color: #a1a1aa; font-weight: 600; }
/* ── FINAL CTA ── */
.final-cta {
padding: 96px 24px;
text-align: center;
border-top: 1px solid #18181b;
position: relative; z-index: 1;
}
.final-cta h2 { font-size: 36px; font-weight: 700; color: #fff; margin-bottom: 12px; letter-spacing: -0.03em; }
.final-cta p { font-size: 14px; color: #52525b; margin-bottom: 32px; }
/* ── FOOTER ── */
footer {
border-top: 1px solid #18181b; padding: 20px 24px;
display: flex; justify-content: space-between; align-items: center;
font-size: 11px; color: #3f3f46; max-width: 960px; margin: 0 auto;
position: relative; z-index: 1;
}
/* annotation */
.annotation {
position: fixed; bottom: 16px; right: 16px;
background: #18181b; border: 1px solid #27272a; border-radius: 8px;
padding: 12px 16px; font-size: 11px; color: #a1a1aa; max-width: 240px;
z-index: 200; line-height: 1.5;
}
.annotation strong { color: #fbbf24; display: block; margin-bottom: 4px; }
#selection-indicator { display: none; }
</style>
</head>
<body>
<div class="bg-grid"></div>
<!-- NAV -->
<nav>
<div class="logo-text">BATTL<span>.</span>BUILDERS</div>
<div class="nav-links">
<a href="#" class="btn-ghost">Sign In</a>
<a href="#" class="btn-amber">Start a Build</a>
</div>
</nav>
<!-- HERO -->
<section class="hero">
<div class="hero-badge">
<span class="hero-badge-dot"></span>
AR-15 Builds &nbsp;·&nbsp; 100% Free
</div>
<h1>
Stop Guessing.
<span class="amber">Start Building.</span>
</h1>
<p class="hero-sub">
Choose components by role. Catch incompatibilities before they cost you.
Compare prices across real retailers — no spreadsheets, no guesswork.
</p>
<div class="hero-cta-wrap">
<a href="#" class="btn-cta">Start a Build &nbsp;</a>
<span class="hero-micro">100% Free &nbsp;·&nbsp; No account required</span>
</div>
</section>
<!-- HOW IT WORKS -->
<section class="how wrap">
<div class="section-label">The process</div>
<h2>Three moves. One solid build.</h2>
<p class="how-sub">No prior experience required. No part numbers to memorize.</p>
<div class="steps">
<div class="step">
<div class="step-num">Step 01</div>
<h3>Select your components</h3>
<p>Real parts, organized by role — barrel, gas system, upper, lower, and more. Pick what fits your build without needing to know SKUs.</p>
</div>
<div class="step">
<div class="step-num">Step 02</div>
<h3>Flag the conflicts</h3>
<p>Gas length. Buffer weight. Caliber stack. Battl surfaces the clashes before you spend money on the wrong part.</p>
</div>
<div class="step">
<div class="step-num">Step 03</div>
<h3>Price it. Pull the trigger.</h3>
<p>Live prices from real retailers, side by side. Click through to buy. We never touch your order.</p>
</div>
</div>
</section>
<!-- VIDEO -->
<section class="video-section">
<div class="video-wrap">
<div class="video-placeholder">
<div class="play-btn"></div>
<p>Builder preview — looping screen recording</p>
</div>
</div>
</section>
<!-- FEATURES -->
<section class="features wrap">
<div class="section-label">What you get</div>
<h2>Built for builders who do their homework.</h2>
<p class="features-sub">NO SUBSCRIPTIONS &nbsp;·&nbsp; NO SPONSORED RANKINGS &nbsp;·&nbsp; NO BULLSHIT</p>
<div class="feature-grid">
<div class="feature-card">
<span class="feature-icon">🔧</span>
<h3>Build by role, not part number</h3>
<p>Parts organized by function. Know what you need, not what SKU to search for.</p>
</div>
<div class="feature-card">
<span class="feature-icon">⚠️</span>
<h3>Conflicts caught early</h3>
<p>Gas system, buffer weight, caliber — flagged before checkout, not after the box arrives.</p>
</div>
<div class="feature-card">
<span class="feature-icon">💰</span>
<h3>Real prices. Real retailers.</h3>
<p>Running total with live prices. No estimated MSRP. What it actually costs, today.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🔖</span>
<h3>Save your work</h3>
<p>Free account. Save builds, pick up where you left off, run multiple configs in parallel.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🔗</span>
<h3>Share the build</h3>
<p>One link. Your buddy sees the full parts list — no login, no friction, no excuses.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🚫</span>
<h3>No gates. No friction.</h3>
<p>Browse and build freely. Create an account only when you're ready to save.</p>
</div>
</div>
</section>
<!-- SEO COPY BLOCK -->
<section class="seo-block">
<div class="seo-inner">
<h2>What is Battl Builders?</h2>
<p>
Battl Builders is a free <strong>AR-15 build planner</strong> — the tool you've been doing in spreadsheets, rebuilt for how builders actually work. Select parts by role, validate compatibility as you go, and price your build across multiple retailers without opening a new tab.
</p>
<p>
Most <strong>AR-15 compatibility mistakes</strong> happen at the parts list stage: wrong gas system length for the barrel, buffer weight that fights your stock, caliber mismatches between upper and lower. Battl flags those conflicts automatically, so you catch them before they cost you a return label.
</p>
<p>
Whether you're planning your first rifle or spec'ing a dedicated precision upper, Battl Builders gives you a structured, guided way to research parts and <strong>buy with confidence</strong>.
</p>
</div>
</section>
<!-- FINAL CTA -->
<section class="final-cta">
<h2>Your build starts here.</h2>
<p>Free. No account required. Takes five minutes to get rolling.</p>
<a href="#" class="btn-cta">Start a Build &nbsp;</a>
</section>
<!-- FOOTER -->
<footer>
<span>© 2026 BATTL BUILDERS™</span>
<span>Free AR-15 build planner</span>
</footer>
<div class="annotation">
<strong>v2 — Copy Rewrite</strong>
Field ethos tone throughout. Scroll all sections and share feedback in terminal.
</div>
</body>
</html>
@@ -0,0 +1,321 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Battl Builders — Homepage Redesign Mockup v3</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #09090b; color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.bg-grid {
position: fixed; inset: 0; pointer-events: none; z-index: 0;
background-image:
linear-gradient(rgba(251,191,36,0.07) 1px, transparent 1px),
linear-gradient(90deg, rgba(251,191,36,0.07) 1px, transparent 1px);
background-size: 60px 60px;
}
.wrap { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 0 24px; }
nav {
position: relative; z-index: 10;
display: flex; align-items: center; justify-content: space-between;
padding: 20px 24px; max-width: 960px; margin: 0 auto;
}
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.logo-text span { color: #fbbf24; }
.nav-links { display: flex; gap: 8px; }
.btn-ghost {
padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
border: 1px solid #27272a; color: #d4d4d8; background: transparent;
cursor: pointer; text-decoration: none;
}
.btn-amber {
padding: 7px 16px; border-radius: 6px; font-size: 12px; font-weight: 700;
background: #fbbf24; color: #000; border: none; cursor: pointer;
text-decoration: none; letter-spacing: 0.02em;
}
/* ── HERO ── */
.hero {
text-align: center; padding: 80px 24px 72px;
max-width: 760px; margin: 0 auto; position: relative; z-index: 1;
}
.hero-badge {
display: inline-flex; align-items: center; gap: 6px;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.4);
border-radius: 99px; padding: 5px 14px;
font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.55);
margin-bottom: 28px;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #fbbf24; flex-shrink: 0; }
.hero h1 {
font-size: clamp(38px, 6.5vw, 64px); font-weight: 700; line-height: 1.05;
letter-spacing: -0.035em; color: #fff;
}
.hero h1 .amber { color: #fbbf24; display: block; }
.hero-sub {
font-size: 17px; color: #a1a1aa; line-height: 1.65;
max-width: 540px; margin: 24px auto 0;
}
.hero-cta-wrap { margin-top: 38px; display: flex; flex-direction: column; align-items: center; gap: 11px; }
.btn-cta {
display: inline-flex; align-items: center; gap: 8px;
background: #fbbf24; color: #000; font-size: 15px; font-weight: 800;
padding: 15px 38px; border-radius: 8px; border: none; cursor: pointer;
letter-spacing: 0.03em; text-decoration: none;
box-shadow: 0 0 40px rgba(251,191,36,0.2);
}
.hero-micro { font-size: 11px; color: #52525b; letter-spacing: 0.05em; }
/* ── HOW IT WORKS ── */
.how { padding: 72px 24px; position: relative; z-index: 1; }
.section-label {
text-align: center; font-size: 10px; font-weight: 700;
letter-spacing: 0.25em; text-transform: uppercase; color: #fbbf24;
margin-bottom: 12px; opacity: 0.85;
}
.how h2 {
text-align: center; font-size: 30px; font-weight: 700;
letter-spacing: -0.025em; color: #fff; margin-bottom: 6px;
}
.how-sub { text-align: center; font-size: 14px; color: #71717a; margin-bottom: 48px; }
.steps {
display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
max-width: 840px; margin: 0 auto; background: #18181b;
border-radius: 12px; overflow: hidden; border: 1px solid #1c1c1f;
}
.step { padding: 32px 24px; background: #0d0d0f; }
.step-num {
font-size: 11px; font-weight: 700; letter-spacing: 0.15em;
color: #fbbf24; text-transform: uppercase; margin-bottom: 14px; opacity: 0.8;
}
.step h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 10px; letter-spacing: -0.01em; }
.step p { font-size: 13px; color: #71717a; line-height: 1.6; }
/* ── VIDEO ── */
.video-section { padding: 0 24px 72px; position: relative; z-index: 1; }
.video-wrap {
max-width: 900px; margin: 0 auto; border-radius: 14px; overflow: hidden;
border: 1px solid rgba(255,255,255,0.07); background: #000;
box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(251,191,36,0.05);
}
.video-placeholder {
aspect-ratio: 16/9; background: #0a0a0a;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.play-btn {
width: 56px; height: 56px; border-radius: 50%;
background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3);
display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.video-placeholder p { font-size: 12px; color: #3f3f46; }
/* ── FEATURES ── */
.features { padding: 72px 24px; position: relative; z-index: 1; }
.features h2 {
text-align: center; font-size: 30px; font-weight: 700;
letter-spacing: -0.025em; color: #fff; margin-bottom: 8px;
}
.features-sub { text-align: center; font-size: 13px; color: #52525b; margin-bottom: 44px; letter-spacing: 0.02em; }
.feature-grid {
display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
max-width: 900px; margin: 0 auto; background: #18181b;
border-radius: 12px; overflow: hidden; border: 1px solid #1c1c1f;
}
.feature-card { padding: 24px; background: #0d0d0f; }
.feature-icon { font-size: 18px; margin-bottom: 14px; display: block; }
.feature-card h3 { font-size: 13px; font-weight: 700; color: #e4e4e7; margin-bottom: 7px; letter-spacing: -0.01em; }
.feature-card p { font-size: 12px; color: #52525b; line-height: 1.6; }
/* ── SEO BLOCK ── */
.seo-block { padding: 72px 24px; border-top: 1px solid #18181b; position: relative; z-index: 1; }
.seo-inner { max-width: 680px; margin: 0 auto; }
.seo-inner h2 { font-size: 22px; font-weight: 700; color: #d4d4d8; margin-bottom: 18px; letter-spacing: -0.02em; }
.seo-inner p { font-size: 14px; color: #71717a; line-height: 1.75; margin-bottom: 14px; }
.seo-inner strong { color: #a1a1aa; font-weight: 600; }
/* ── FINAL CTA ── */
.final-cta {
padding: 96px 24px; text-align: center;
border-top: 1px solid #18181b; position: relative; z-index: 1;
}
.final-cta h2 { font-size: 36px; font-weight: 700; color: #fff; margin-bottom: 12px; letter-spacing: -0.03em; }
.final-cta p { font-size: 14px; color: #52525b; margin-bottom: 32px; }
footer {
border-top: 1px solid #18181b; padding: 20px 24px;
display: flex; justify-content: space-between; align-items: center;
font-size: 11px; color: #3f3f46; max-width: 960px; margin: 0 auto;
position: relative; z-index: 1;
}
/* changed copy callouts */
.changed {
outline: 1px dashed rgba(251,191,36,0.4);
outline-offset: 3px;
border-radius: 3px;
}
.annotation {
position: fixed; bottom: 16px; right: 16px;
background: #18181b; border: 1px solid #27272a; border-radius: 8px;
padding: 12px 16px; font-size: 11px; color: #a1a1aa; max-width: 240px;
z-index: 200; line-height: 1.6;
}
.annotation strong { color: #fbbf24; display: block; margin-bottom: 4px; }
.annotation .legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 10px; color: #52525b; }
.legend-box { width: 12px; height: 12px; border: 1px dashed rgba(251,191,36,0.5); border-radius: 2px; flex-shrink: 0; }
#selection-indicator { display: none; }
</style>
</head>
<body>
<div class="bg-grid"></div>
<!-- NAV -->
<nav>
<div class="logo-text">BATTL<span>.</span>BUILDERS</div>
<div class="nav-links">
<a href="#" class="btn-ghost">Sign In</a>
<a href="#" class="btn-amber">Start a Build</a>
</div>
</nav>
<!-- HERO -->
<section class="hero">
<!-- CHANGED: AR-15 Builds → AR-15 Builder -->
<div class="hero-badge changed">
<span class="hero-badge-dot"></span>
AR-15 Builder &nbsp;·&nbsp; 100% Free
</div>
<h1>
Stop Guessing.
<span class="amber">Start Building.</span>
</h1>
<!-- CHANGED: hero subhead — jargon removed, ICP-first language -->
<p class="hero-sub changed">
Not sure which parts work together? We'll walk you through it. Pick your components, get warned about anything that won't fit, and see real prices from real retailers — all in one place.
</p>
<div class="hero-cta-wrap">
<a href="#" class="btn-cta">Start a Build &nbsp;</a>
<span class="hero-micro">100% Free &nbsp;·&nbsp; No account required</span>
</div>
</section>
<!-- HOW IT WORKS -->
<section class="how wrap">
<div class="section-label">The process</div>
<!-- CHANGED: "Three moves. One solid build." → "3 Steps. One Battl-Ready Build." -->
<h2 class="changed">3 Steps. One Battl-Ready Build.</h2>
<p class="how-sub">No experience required. No part numbers to memorize.</p>
<div class="steps">
<div class="step">
<div class="step-num">Step 01</div>
<h3>Pick your parts</h3>
<p>Browse real components organized by what they do — barrel, trigger, lower, upper, and more. No prior knowledge required.</p>
</div>
<div class="step">
<div class="step-num">Step 02</div>
<h3>Flag the conflicts</h3>
<p>Gas length, buffer weight, caliber — Battl catches the mismatches before you spend money on the wrong part.</p>
</div>
<div class="step">
<div class="step-num">Step 03</div>
<h3>Price it. Pull the trigger.</h3>
<p>Live prices from real retailers, side by side. Click through to buy. We never touch your order.</p>
</div>
</div>
</section>
<!-- VIDEO -->
<section class="video-section">
<div class="video-wrap">
<div class="video-placeholder">
<div class="play-btn"></div>
<p>Builder preview — looping screen recording</p>
</div>
</div>
</section>
<!-- FEATURES -->
<section class="features wrap">
<div class="section-label">What you get</div>
<!-- CHANGED: "Built for builders who do their homework." → gun nerd / everyday builder positioning -->
<h2 class="changed">Built by gun nerds, for the everyday AR builder.</h2>
<p class="features-sub changed">NO SUBSCRIPTIONS &nbsp;·&nbsp; NO SPONSORED RANKINGS &nbsp;·&nbsp; NO BULLSHIT</p>
<div class="feature-grid">
<div class="feature-card">
<span class="feature-icon">🔧</span>
<h3>Build by role, not part number</h3>
<p>Parts organized by function. Know what you need, not what SKU to search for.</p>
</div>
<div class="feature-card">
<span class="feature-icon">⚠️</span>
<h3>Conflicts caught early</h3>
<p>Gas system, buffer weight, caliber — flagged before checkout, not after the box arrives.</p>
</div>
<div class="feature-card">
<span class="feature-icon">💰</span>
<h3>Real prices. Real retailers.</h3>
<p>Running total with live prices. No estimated MSRP. What it actually costs, today.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🔖</span>
<h3>Save your work</h3>
<p>Free account. Save builds, pick up where you left off, run multiple configs in parallel.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🔗</span>
<h3>Share the build</h3>
<p>One link. Your buddy sees the full parts list — no login, no friction, no excuses.</p>
</div>
<div class="feature-card">
<span class="feature-icon">🚫</span>
<h3>No gates. No friction.</h3>
<p>Browse and build freely. Create an account only when you're ready to save.</p>
</div>
</div>
</section>
<!-- SEO COPY BLOCK -->
<section class="seo-block">
<div class="seo-inner">
<h2>What is Battl Builders?</h2>
<p>
Battl Builders is a free <strong>AR-15 build planner</strong> — the tool you've been doing in spreadsheets, rebuilt for how builders actually work. Select parts by what they do, validate compatibility as you go, and price your build across multiple retailers without opening a new tab.
</p>
<p>
Most <strong>AR-15 compatibility mistakes</strong> happen at the parts list stage: wrong gas system length for the barrel, buffer weight that fights your stock, caliber mismatches between upper and lower. Battl flags those conflicts automatically, so you catch them before they cost you a return label.
</p>
<p>
Whether you're planning your first rifle or spec'ing a dedicated precision upper, Battl Builders gives you a structured, guided way to research parts and <strong>buy with confidence</strong>.
</p>
</div>
</section>
<!-- FINAL CTA -->
<section class="final-cta">
<h2>Your build starts here.</h2>
<p>Free. No account required. Takes five minutes to get rolling.</p>
<a href="#" class="btn-cta">Start a Build &nbsp;</a>
</section>
<footer>
<span>© 2026 BATTL BUILDERS™</span>
<span>Free AR-15 build planner</span>
</footer>
<div class="annotation">
<strong>v3 — Copy Revision</strong>
Updated copy is outlined in amber dashes.
<div class="legend">
<div class="legend-box"></div>
Changed from v2
</div>
</div>
</body>
</html>
@@ -0,0 +1,66 @@
<h2>Hero Layout: What's the main structure?</h2>
<p class="subtitle">The hero is the first thing visitors see. Which layout best suits a "start your build now" homepage?</p>
<div class="cards">
<div class="card" data-choice="centered" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:28px 20px;font-family:sans-serif;min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;border:1px solid #27272a;">
<div style="font-size:10px;letter-spacing:0.2em;color:#fbbf24;text-transform:uppercase;opacity:0.8;">AR-15 Build Planner</div>
<div style="font-size:22px;font-weight:700;color:#fff;text-align:center;line-height:1.2;">Build smarter rifles.<br><span style="color:#fbbf24;">No spreadsheets.</span></div>
<div style="font-size:11px;color:#a1a1aa;text-align:center;max-width:280px;">Pick parts by role, catch compatibility issues, compare live prices — all in one place.</div>
<div style="display:flex;gap:10px;margin-top:8px;">
<div style="background:#fbbf24;color:#000;font-size:11px;font-weight:700;padding:8px 20px;border-radius:6px;letter-spacing:0.05em;">START A BUILD →</div>
</div>
<div style="margin-top:10px;background:#1a1a1a;border-radius:6px;border:1px solid #27272a;width:100%;height:60px;display:flex;align-items:center;justify-content:center;">
<div style="font-size:10px;color:#52525b;">▶ Builder preview video</div>
</div>
</div>
</div>
<div class="card-body">
<h3>A — Centered / Full-width</h3>
<p>Headline + tagline centered, single dominant CTA button, product video below. Clean, magazine-style. Works great on mobile.</p>
</div>
</div>
<div class="card" data-choice="split" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:20px;font-family:sans-serif;min-height:220px;display:flex;align-items:stretch;gap:16px;border:1px solid #27272a;">
<div style="flex:1.1;display:flex;flex-direction:column;justify-content:center;gap:10px;">
<div style="font-size:10px;letter-spacing:0.2em;color:#fbbf24;text-transform:uppercase;opacity:0.8;">AR-15 Build Planner</div>
<div style="font-size:18px;font-weight:700;color:#fff;line-height:1.25;">Build smarter rifles.<br><span style="color:#fbbf24;">No spreadsheets.</span></div>
<div style="font-size:10px;color:#a1a1aa;line-height:1.5;">Pick parts, catch clashes, compare prices.</div>
<div style="background:#fbbf24;color:#000;font-size:11px;font-weight:700;padding:8px 16px;border-radius:6px;letter-spacing:0.05em;align-self:flex-start;margin-top:4px;">START A BUILD →</div>
</div>
<div style="flex:1;background:#111;border-radius:8px;border:1px solid #27272a;display:flex;align-items:center;justify-content:center;">
<div style="font-size:10px;color:#52525b;text-align:center;">App screenshot<br>or animation</div>
</div>
</div>
</div>
<div class="card-body">
<h3>B — Split (text left, visual right)</h3>
<p>Copy on the left, app screenshot or short animation on the right. Shows the product immediately. Strong for conversion, more complex layout.</p>
</div>
</div>
<div class="card" data-choice="immersive" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:20px;font-family:sans-serif;min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:10px;border:1px solid #27272a;position:relative;overflow:hidden;">
<div style="position:absolute;inset:0;background:linear-gradient(135deg,#111 0%,#0a0a0a 100%);opacity:0.9;"></div>
<div style="position:absolute;top:16px;left:0;right:0;text-align:center;">
<div style="font-size:10px;color:#52525b;letter-spacing:0.1em;">Full-bleed product image or video background</div>
</div>
<div style="position:relative;z-index:1;text-align:center;display:flex;flex-direction:column;align-items:center;gap:8px;padding-bottom:10px;">
<div style="font-size:20px;font-weight:700;color:#fff;text-align:center;line-height:1.2;">Build smarter rifles.</div>
<div style="font-size:18px;font-weight:700;color:#fbbf24;">No spreadsheets.</div>
<div style="background:#fbbf24;color:#000;font-size:11px;font-weight:700;padding:8px 22px;border-radius:6px;letter-spacing:0.05em;margin-top:6px;">START A BUILD →</div>
</div>
</div>
</div>
<div class="card-body">
<h3>C — Immersive / Full-bleed</h3>
<p>Hero image or dark atmospheric background fills the viewport. Copy overlaid with high contrast. Dramatic, brand-forward. Requires great imagery.</p>
</div>
</div>
</div>
@@ -0,0 +1,111 @@
<h2>Below the Hero: Page Section Flow</h2>
<p class="subtitle">What content comes after the hero + CTA? Pick the flow that best supports "I just landed here, convince me to start a build."</p>
<div class="cards">
<div class="card" data-choice="lean" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:20px;font-family:sans-serif;border:1px solid #27272a;display:flex;flex-direction:column;gap:8px;">
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">HERO</div>
<div style="font-size:9px;color:#a1a1aa;">"Stop Guessing. Start Building." + subhead + CTA</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">BUILDER PREVIEW</div>
<div style="font-size:9px;color:#a1a1aa;">Looping video / animated screenshot of the tool</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">3 FEATURE PILLARS</div>
<div style="font-size:9px;color:#a1a1aa;">Guided roles · Compat warnings · Live prices</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:10px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fbbf24;">FINAL CTA</div>
<div style="font-size:9px;color:#a1a1aa;">Second "Start a Build" button</div>
</div>
</div>
</div>
<div class="card-body">
<h3>A — Lean (4 sections)</h3>
<p>Hero → video preview → 3 feature pillars → closing CTA. Fast to read, zero fluff. Gets users to the builder quickly.</p>
</div>
</div>
<div class="card" data-choice="howitworks" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:20px;font-family:sans-serif;border:1px solid #27272a;display:flex;flex-direction:column;gap:8px;">
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">HERO</div>
<div style="font-size:9px;color:#a1a1aa;">"Stop Guessing. Start Building." + subhead + CTA</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">HOW IT WORKS</div>
<div style="font-size:9px;color:#a1a1aa;">3 steps: Pick parts → See warnings → Buy with confidence</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">BUILDER PREVIEW VIDEO</div>
<div style="font-size:9px;color:#a1a1aa;">Show the tool in action</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">FEATURE CARDS</div>
<div style="font-size:9px;color:#a1a1aa;">6 capabilities at a glance</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:10px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fbbf24;">FINAL CTA</div>
<div style="font-size:9px;color:#a1a1aa;">Second "Start a Build" button</div>
</div>
</div>
</div>
<div class="card-body">
<h3>B — Explain + Show (5 sections)</h3>
<p>Adds a "How it Works" 3-step strip between hero and video. Answers "but what does it actually do?" before showing it. Better for first-time visitors unfamiliar with PCPartPicker-style tools.</p>
</div>
</div>
<div class="card" data-choice="seo" onclick="toggleSelect(this)">
<div class="card-image">
<div style="background:#0a0a0a;border-radius:8px;padding:20px;font-family:sans-serif;border:1px solid #27272a;display:flex;flex-direction:column;gap:8px;">
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">HERO</div>
<div style="font-size:9px;color:#a1a1aa;">"Stop Guessing. Start Building." + subhead + CTA</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">HOW IT WORKS</div>
<div style="font-size:9px;color:#a1a1aa;">3 steps with icons</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">BUILDER PREVIEW VIDEO</div>
<div style="font-size:9px;color:#a1a1aa;">Tool in action</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">FEATURE CARDS</div>
<div style="font-size:9px;color:#a1a1aa;">6 capabilities</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#111;border:1px solid #27272a;border-radius:6px;padding:12px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fff;">SEO COPY BLOCK</div>
<div style="font-size:9px;color:#a1a1aa;">Short paragraph: "What is an AR-15 builder tool?" — targets search</div>
</div>
<div style="text-align:center;font-size:10px;color:#52525b;"></div>
<div style="background:#1a1a1a;border:1px solid #fbbf24;border-radius:6px;padding:10px;text-align:center;">
<div style="font-size:11px;font-weight:700;color:#fbbf24;">FINAL CTA</div>
<div style="font-size:9px;color:#a1a1aa;">Second "Start a Build" button</div>
</div>
</div>
</div>
<div class="card-body">
<h3>C — SEO-Optimized (6 sections)</h3>
<p>Same as B but adds a short prose block at the bottom targeting search keywords ("AR-15 parts compatibility tool", "AR-15 build planner"). Best for organic discovery over time.</p>
</div>
</div>
</div>
@@ -0,0 +1,3 @@
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
<p class="subtitle">Continuing in terminal...</p>
</div>
+68
View File
@@ -0,0 +1,68 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Commands
```bash
npm run dev # Start dev server at localhost:3000
npm run build # Production build (TS errors and ESLint are suppressed — see next.config.mjs)
npm run lint # ESLint check
```
No test framework is configured.
## Environment Variables
`.env.local` for development:
```
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080
BACKEND_BASE_URL=http://localhost:8080
LAUNCH_ONLY_ROOT=false # Set to "true" to restrict unauthenticated users to root page only
NEXT_PUBLIC_SHORTLINK_BASE_URL=http://localhost:8080
```
In Docker, the Spring Boot service is resolved as `http://battlbuilder-api:8080` (the default in `lib/springProxy.ts` when `SPRING_BASE_URL` is unset).
## Architecture
### Two backends
1. **Spring Boot** — primary data backend. All product catalog, builds, auth, merchant/admin data lives here.
2. **Sanity CMS** — content only (guides/blog posts). Project `zal102rv`, dataset `production`. Queries in `lib/sanity.ts`.
### API proxy pattern
Next.js API routes (`app/api/`) act as a thin proxy to Spring Boot. Client code never calls Spring Boot directly. The helper `lib/springProxy.ts` forwards cookies and auth headers to Spring Boot and handles response serialization.
### Authentication
- **Session cookie**: `session_token` HTTP-only cookie set by Spring Boot, forwarded by the proxy.
- **Client state**: `AuthContext` (`context/AuthContext.tsx`) hydrates from `localStorage` on mount, then verifies against `/api/auth/me`.
- **Middleware**: `middleware.ts` enforces route protection. Public paths are whitelisted; `/admin/*` requires login; `/builder`, `/builds`, `/vault` are gated only when `LAUNCH_ONLY_ROOT=true`.
### Route groups
- `app/(app)/` — main consumer app layout (TopNav + Footer)
- `app/(app)/(builder)/` — builder + parts browser (BuilderNav layout)
- `app/(account)/` — account settings pages (AccountChrome sidebar layout)
- `app/admin/` — internal admin tools (AdminLeftNavigation layout)
- `app/api/` — 50 server-side route handlers proxying to Spring Boot
### Builder domain model
The builder is AR-platform-centric. Key concepts:
- **`BuilderSlotKey`** (`types/builderSlots.ts`) — the canonical kebab-case category ID (e.g., `"complete-upper"`, `"barrel"`). This is the source of truth for localStorage keys, URL state, and backend part role mapping.
- **`CATEGORY_TO_PART_ROLES` / `PART_ROLE_TO_CATEGORY`** (`lib/catalogMappings.ts`) — bidirectional mapping between `BuilderSlotKey` and backend `partRole` strings. Update here when the backend adds new part roles.
- **`BUILDER_SLOTS`** (`data/builderSlots.ts`) — defines slot groups (LOWER, UPPER, SYSTEM, ACCESSORIES) and satisfaction patterns (e.g., a complete lower satisfies the lower assembly slot).
- **`BuildState`** — `Partial<Record<BuilderSlotKey, string>>` stored in `localStorage`. Product IDs are the values.
- **Overlap detection** (`lib/buildOverlaps.ts`) — warns users when they select both a complete assembly and individual sub-parts.
### Legacy key aliases
`types/builderSlots.ts` exports `normalizeSlotKey()` which maps camelCase legacy keys (e.g., `completeUpper`) to current kebab-case keys. This is needed for backwards-compatible URL/localStorage deserialization.
### API client pattern
- Client components use `useApi()` hook (`lib/api.ts`) for fetch calls with `credentials: 'include'`.
- Admin-specific API calls live in `lib/api/` (e.g., `adminCategoryMappings.ts`, `adminMerchantMappings.ts`).
- Product catalog helpers are in `lib/catalog.ts`.
### Sanity content
- `lib/sanity.ts` — Sanity client + GROQ queries for posts.
- `lib/sanityFetch.ts` — low-level HTTPS fetch to Sanity IP (bypasses CDN DNS issues in server/Docker environments).
- Guides at `/guides/[slug]` are the only public Sanity-driven pages.
@@ -0,0 +1,43 @@
"use client";
import { useEffect } from "react";
import { useSearchParams, useRouter } from "next/navigation";
import { Suspense } from "react";
const STORAGE_KEY = "gunbuilder-build-state";
function BuildLoader() {
const searchParams = useSearchParams();
const router = useRouter();
useEffect(() => {
const encoded = searchParams.get("build");
if (encoded) {
try {
const decoded = JSON.parse(atob(encoded));
if (decoded && typeof decoded === "object") {
localStorage.setItem(STORAGE_KEY, JSON.stringify(decoded));
}
} catch {
// Bad payload — just go to builder anyway, it'll load fresh
}
}
router.replace("/builder");
}, [searchParams, router]);
return (
<main className="min-h-screen bg-black text-zinc-50 flex items-center justify-center">
<p className="text-sm text-zinc-400">Loading build</p>
</main>
);
}
export default function BuildPage() {
return (
<Suspense>
<BuildLoader />
</Suspense>
);
}
+61 -18
View File
@@ -28,6 +28,7 @@ import { X, Link2, Square, CheckSquare } from "lucide-react";
import { useApi } from "@/lib/api";
import { useAuth } from "@/context/AuthContext";
import { trackBuildStarted, trackPartSelected, trackAffiliateLinkClicked, trackBuildShared, trackBuildSaved } from "@/lib/analytics";
import { CATEGORIES } from "@/data/gunbuilderParts";
import { BUILDER_SLOTS, isSlotSatisfied } from "@/data/builderSlots";
@@ -295,7 +296,7 @@ function buildAssemblyRows(params: {
rows.push({
key: `${groupLabel}-${paths.complete}`,
kind: "category",
label: "Completed Lower (Fastest)",
label: `Completed ${groupLabel.split(" ")[0]} (Fastest)`,
categoryId: paths.complete,
indent: 0,
pill: mode === "complete" ? "Selected" : undefined,
@@ -355,6 +356,8 @@ function GunbuilderPageContent() {
// Parts data state
// -----------------------------
const [parts, setParts] = useState<Part[]>([]);
const previousPartIdsRef = useRef<Set<string>>(new Set());
const isFirstPartsHydrationRef = useRef(true);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -369,20 +372,33 @@ function GunbuilderPageContent() {
useEffect(() => {
if (typeof window === "undefined") return;
// Hydrate persisted build state only. URL actions (platform/select/remove)
// are handled by the dedicated useSearchParams effect later in this file.
// Intentional: Object.keys(...).length > 0 tightens the original condition.
// Previously, an empty {} from localStorage would call setBuild(normalizeBuildState({})),
// which is a no-op. The new check skips that call, which is safe and correct.
let hasBuild = false;
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
try {
const parsed = JSON.parse(stored);
if (parsed && typeof parsed === "object") {
if (parsed && typeof parsed === "object" && Object.keys(parsed).length > 0) {
setBuild(normalizeBuildState(parsed));
hasBuild = true;
}
} catch {
// ignore
}
}
// Fire build_started only for genuinely new builds:
// - No existing parts in localStorage
// - No ?select= param (share-link arrivals have empty localStorage but are not starting fresh)
// Use window.location.search directly: this effect runs at mount before any router
// processing, making window.location.search the authoritative source of the landing URL.
const hasSelectParam = new URLSearchParams(window.location.search).has("select");
if (!hasBuild && !hasSelectParam) {
trackBuildStarted();
}
// Signal that hydration is complete - this allows URL param processing to run
setIsHydrated(true);
}, []);
@@ -602,6 +618,7 @@ function GunbuilderPageContent() {
if (ids.length === 0) {
lastHydrateKeyRef.current = "";
setParts([]);
previousPartIdsRef.current = new Set(); // keep in sync so re-selecting fires the event
setError(null);
setLoading(false);
return;
@@ -654,6 +671,21 @@ function GunbuilderPageContent() {
setParts(hydrated);
// Track newly selected parts after API fetch — fires with real name, not a numeric ID.
// Skip the first hydration: this covers both localStorage build restoration and ?select=
// share-link arrivals. Neither represents a live user interaction in the current session.
if (isFirstPartsHydrationRef.current) {
isFirstPartsHydrationRef.current = false;
} else {
const prevIds = previousPartIdsRef.current;
for (const p of hydrated) {
if (!prevIds.has(String(p.id))) {
trackPartSelected(p.categoryId as BuilderSlotKey, p.name, String(p.id));
}
}
}
previousPartIdsRef.current = new Set(hydrated.map((p) => String(p.id)));
// ✅ Mark key as hydrated ONLY after success
lastHydrateKeyRef.current = key;
} catch (err: any) {
@@ -842,6 +874,7 @@ function GunbuilderPageContent() {
type: "success",
message: "Saved to your Vault ✅ ",
});
trackBuildSaved();
// Close modal + reset inputs for next variant
setSaveAsOpen(false);
@@ -1055,6 +1088,7 @@ function GunbuilderPageContent() {
try {
await navigator.clipboard.writeText(shareUrl);
trackBuildShared();
setShareStatus("Shareable link copied to clipboard.");
} catch {
setShareStatus("Could not copy link to clipboard.");
@@ -1074,6 +1108,7 @@ function GunbuilderPageContent() {
text: "Check out my Battl Build.",
url: shareUrl,
});
trackBuildShared(); // fires only on successful share, not on cancel
setShareStatus("Share dialog opened.");
} catch {
setShareStatus(
@@ -1523,25 +1558,25 @@ function GunbuilderPageContent() {
)}
<div className="overflow-x-auto rounded-md border border-zinc-800 bg-zinc-950/80">
<table className="min-w-full text-xs md:text-sm">
<table className="min-w-full text-[11px] sm:text-xs md:text-sm">
<thead>
<tr className="border-b border-zinc-800 bg-zinc-900/60">
<th className="px-3 py-2 text-left font-semibold text-zinc-400">
<th className="px-2 sm:px-3 py-2 text-left font-semibold text-zinc-400">
Component / Part Type
</th>
<th className="px-3 py-2 text-left font-semibold text-zinc-400">
<th className="hidden sm:table-cell px-2 sm:px-3 py-2 text-left font-semibold text-zinc-400">
Brand
</th>
<th className="px-3 py-2 text-right font-semibold text-zinc-400">
<th className="px-2 sm:px-3 py-2 text-right font-semibold text-zinc-400">
Price
</th>
<th className="px-3 py-2 text-right font-semibold text-zinc-400">
<th className="hidden md:table-cell px-2 sm:px-3 py-2 text-right font-semibold text-zinc-400">
Sale Price
</th>
<th className="px-3 py-2 text-left font-semibold text-zinc-400">
<th className="hidden md:table-cell px-2 sm:px-3 py-2 text-left font-semibold text-zinc-400">
Caliber
</th>
<th className="px-3 py-2 text-right font-semibold text-zinc-400">
<th className="px-2 sm:px-3 py-2 text-right font-semibold text-zinc-400">
Buy / Choose
</th>
</tr>
@@ -1557,7 +1592,7 @@ function GunbuilderPageContent() {
>
<td
colSpan={6}
className="px-3 py-2 text-[0.7rem] text-zinc-500 bg-zinc-950/70"
className="px-2 sm:px-3 py-2 text-[0.7rem] text-zinc-500 bg-zinc-950/70"
>
<div className="flex items-center justify-between gap-2">
<div className="font-semibold text-zinc-400">
@@ -1606,7 +1641,7 @@ function GunbuilderPageContent() {
row.tone === "muted" ? "opacity-70" : ""
}`}
>
<td className="px-3 py-2 align-top">
<td className="px-2 sm:px-3 py-2 align-top">
<div className="flex items-start gap-2">
{indent > 0 && (
<div
@@ -1654,24 +1689,24 @@ function GunbuilderPageContent() {
</div>
</td>
<td className="px-3 py-2 align-top text-zinc-300">
<td className="hidden sm:table-cell px-2 sm:px-3 py-2 align-top text-zinc-300">
{selectedPart ? selectedPart.brand : "—"}
</td>
<td className="px-3 py-2 align-top text-right text-amber-300">
<td className="px-2 sm:px-3 py-2 align-top text-right text-amber-300">
{selectedPart
? `$${selectedPart.price.toFixed(2)}`
: "—"}
</td>
<td className="px-3 py-2 align-top text-right text-zinc-400">
<td className="hidden md:table-cell px-2 sm:px-3 py-2 align-top text-right text-zinc-400">
</td>
<td className="px-3 py-2 align-top text-zinc-400">
<td className="hidden md:table-cell px-2 sm:px-3 py-2 align-top text-zinc-400">
</td>
<td className="px-3 py-2 align-top">
<td className="px-2 sm:px-3 py-2 align-top">
<div className="flex justify-end gap-2">
{isLocked ? (
<div className="flex items-center gap-2">
@@ -1704,6 +1739,14 @@ function GunbuilderPageContent() {
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-amber-600 bg-amber-500 px-3 py-1.5 text-xs font-semibold text-black hover:bg-amber-400 transition-colors"
onClick={() => {
try {
const retailer = new URL(selectedPart.affiliateUrl).hostname.replace(/^www\./, "");
trackAffiliateLinkClicked(selectedPart.name, retailer);
} catch {
// ignore malformed URLs — if affiliateUrl is malformed, the link href is also broken
}
}}
>
Buy
</a>
@@ -6,6 +6,8 @@ import { useParams, useRouter, useSearchParams } from "next/navigation";
import type { BuilderSlotKey } from "@/types/builderSlots";
import { PART_ROLE_TO_CATEGORY, normalizePartRole } from "@/lib/catalogMappings";
import { trackAffiliateLinkClicked } from "@/lib/analytics";
import { ProductImage } from "@/components/parts/ProductImage";
/**
* API Shapes
@@ -492,12 +494,10 @@ export default function ProductDetailsPage() {
className="h-full w-full"
title="Click to enlarge"
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
<ProductImage
src={imageUrl}
alt={product.name}
className="h-full w-full object-contain p-2"
loading="lazy"
/>
</button>
) : (
@@ -699,6 +699,7 @@ export default function ProductDetailsPage() {
target="_blank"
rel="noreferrer"
className="inline-flex items-center justify-center rounded-md bg-amber-400 px-3 py-1.5 text-xs font-semibold text-black hover:bg-amber-300"
onClick={() => trackAffiliateLinkClicked(product?.name ?? "", merchantLabel(o))}
>
Buy
</a>
@@ -726,6 +727,7 @@ export default function ProductDetailsPage() {
target="_blank"
rel="noreferrer"
className="rounded-md border border-zinc-700 bg-zinc-900/70 px-4 py-2 text-sm font-semibold text-zinc-200 hover:bg-zinc-800"
onClick={() => trackAffiliateLinkClicked(product?.name ?? "", merchantLabel(bestOffer))}
>
Buy from {merchantLabel(bestOffer)}
</a>
@@ -768,8 +770,7 @@ export default function ProductDetailsPage() {
Close
</button>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
<ProductImage
src={imageUrl}
alt={product?.name ?? "Product image"}
className="max-h-[90vh] max-w-[90vw] rounded-lg border border-zinc-800 bg-black object-contain"
+45
View File
@@ -0,0 +1,45 @@
import type { Metadata } from 'next'
import { changelogEntriesQuery, roadmapItemsQuery } from '@/lib/sanity'
import { sanityFetch } from '@/lib/sanityFetch'
import { ChangelogTabs } from '@/components/ChangelogTabs'
import type { ChangelogEntry, RoadmapItemData } from '@/types/changelog'
export const revalidate = 60
export const metadata: Metadata = {
title: "What's New — Battl Builders",
description:
'Release notes, upcoming features, and product updates from Battl Builders.',
}
export default async function ChangelogPage() {
let entries: ChangelogEntry[] = []
let roadmapItems: RoadmapItemData[] = []
try {
entries = await sanityFetch<ChangelogEntry[]>(changelogEntriesQuery)
} catch (err) {
console.error('[Changelog] entries fetch failed:', err)
}
try {
roadmapItems = await sanityFetch<RoadmapItemData[]>(roadmapItemsQuery)
} catch (err) {
console.error('[Changelog] roadmap fetch failed:', err)
}
return (
<main className="mx-auto max-w-4xl px-4 py-10">
<header className="mb-10">
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-zinc-500">
Battl Builders
</p>
<h1 className="mt-2 text-3xl font-semibold tracking-tight">Updates</h1>
<p className="mt-2 text-sm text-zinc-400">
What we&apos;ve shipped and what&apos;s coming next.
</p>
</header>
<ChangelogTabs entries={entries} roadmapItems={roadmapItems} />
</main>
)
}
+27
View File
@@ -0,0 +1,27 @@
import type { Metadata } from 'next'
import { FeedbackForm } from '@/components/FeedbackForm'
export const metadata: Metadata = {
title: 'Send Feedback — Battl Builders',
description:
'Report a bug, suggest a feature, or share a thought with the Battl Builders team.',
}
export default function FeedbackPage() {
return (
<main className="mx-auto max-w-4xl px-4 py-10">
<header className="mb-10">
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-zinc-500">
Battl Builders
</p>
<h1 className="mt-2 text-3xl font-semibold tracking-tight">
Send Feedback
</h1>
<p className="mt-2 text-sm text-zinc-400">
Bug, feature idea, or general thought we read everything.
</p>
</header>
<FeedbackForm />
</main>
)
}
+151
View File
@@ -0,0 +1,151 @@
import { postBySlugQuery, postSlugsQuery, urlFor } from '@/lib/sanity'
import { sanityFetch } from '@/lib/sanityFetch'
import { PortableTextRenderer } from '@/components/PortableTextRenderer'
import Image from 'next/image'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import type { Metadata } from 'next'
export const revalidate = 60
type Params = { slug: string }
type Post = {
_id: string
title: string
slug: { current: string }
publishedAt: string
excerpt: string | null
mainImage: { asset: object; alt?: string } | null
body: unknown[]
seoTitle: string | null
seoDescription: string | null
author: { name: string; image?: object; bio?: string } | null
}
export async function generateStaticParams() {
try {
const slugs: { slug: string }[] = await sanityFetch<{ slug: string }[]>(postSlugsQuery)
return slugs.map((s) => ({ slug: s.slug }))
} catch (err) {
console.error('[Guides] generateStaticParams fetch failed:', err)
return []
}
}
export async function generateMetadata({ params }: { params: Promise<Params> }): Promise<Metadata> {
const { slug } = await params
let post: Post | null = null
try {
post = await sanityFetch<Post | null>(postBySlugQuery, { slug })
} catch (err) {
console.error('[Guides] generateMetadata fetch failed:', err)
}
if (!post) return {}
return {
title: post.seoTitle ?? post.title,
description: post.seoDescription ?? post.excerpt ?? undefined,
openGraph: {
title: post.seoTitle ?? post.title,
description: post.seoDescription ?? post.excerpt ?? undefined,
images: post.mainImage?.asset
? [{ url: urlFor(post.mainImage).width(1200).height(630).url() }]
: [],
},
}
}
function formatDate(iso: string) {
return new Date(iso).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
export default async function PostPage({ params }: { params: Promise<Params> }) {
const { slug } = await params
let post: Post | null = null
try {
post = await sanityFetch<Post | null>(postBySlugQuery, { slug })
} catch (err) {
console.error('[Guides] PostPage fetch failed:', err)
}
if (!post) notFound()
return (
<main className="mx-auto max-w-3xl px-4 py-10">
{/* Breadcrumb */}
<nav className="mb-6 text-xs text-zinc-500">
<Link href="/guides" className="hover:text-zinc-300">
Guides
</Link>
</nav>
{/* Header */}
<header className="mb-8">
<div className="mb-3 flex items-center gap-2 text-[0.7rem] text-zinc-500">
{post.author?.name && <span>{post.author.name}</span>}
{post.author?.name && <span>·</span>}
<time dateTime={post.publishedAt}>{formatDate(post.publishedAt)}</time>
</div>
<h1 className="text-3xl font-semibold leading-tight tracking-tight text-zinc-100 md:text-4xl">
{post.title}
</h1>
{post.excerpt && (
<p className="mt-4 text-base text-zinc-400 leading-relaxed">
{post.excerpt}
</p>
)}
</header>
{/* Hero image */}
{post.mainImage?.asset && (
<div className="relative mb-10 h-64 w-full overflow-hidden rounded-xl md:h-80">
<Image
src={urlFor(post.mainImage).width(1200).height(630).url()}
alt={post.mainImage.alt ?? post.title}
fill
priority
className="object-cover"
sizes="(max-width: 768px) 100vw, 768px"
/>
</div>
)}
{/* Body */}
{post.body && (
<article className="border-b border-zinc-800 pb-10">
<PortableTextRenderer value={post.body} />
</article>
)}
{/* CTA footer */}
<div className="mt-10 rounded-xl border border-zinc-800 bg-zinc-950/60 p-6 text-center">
<p className="text-sm font-medium text-zinc-200">
Ready to put this into practice?
</p>
<p className="mt-1 text-xs text-zinc-500">
Use the Battl Builder to price out your parts and track your total.
</p>
<Link
href="/builder"
className="mt-4 inline-block rounded-md bg-amber-400 px-5 py-2.5 text-sm font-semibold text-black hover:bg-amber-300 transition-colors"
>
Start Your Build
</Link>
</div>
{/* Back link */}
<div className="mt-8 text-center">
<Link href="/guides" className="text-xs text-zinc-500 hover:text-zinc-300">
Back to all guides
</Link>
</div>
</main>
)
}
+119
View File
@@ -0,0 +1,119 @@
import { postsQuery, urlFor } from '@/lib/sanity'
import { sanityFetch } from '@/lib/sanityFetch'
import Link from 'next/link'
import Image from 'next/image'
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'Build Guides',
description: 'AR-15 build guides, part breakdowns, and buying advice from Battl Builders.',
}
export const revalidate = 60 // ISR — regenerate every 60s
type Post = {
_id: string
title: string
slug: { current: string }
publishedAt: string
excerpt: string | null
mainImage: { asset: object; alt?: string } | null
author: { name: string; image?: object } | null
}
function formatDate(iso: string) {
return new Date(iso).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
export default async function GuidesPage() {
let posts: Post[] = []
try {
posts = await sanityFetch<Post[]>(postsQuery)
} catch (err) {
console.error('[Guides] Sanity fetch failed:', err)
}
return (
<main className="mx-auto max-w-4xl px-4 py-10">
<header className="mb-10">
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-zinc-500">
Battl Builders
</p>
<h1 className="mt-2 text-3xl font-semibold tracking-tight">
Build Guides
</h1>
<p className="mt-3 text-sm text-zinc-400 max-w-xl">
Part breakdowns, buying advice, and build walkthroughs to help you
make smarter decisions before you spend a dollar.
</p>
</header>
{posts.length === 0 ? (
<p className="text-sm text-zinc-500">No guides published yet check back soon.</p>
) : (
<div className="space-y-8">
{posts.map((post) => (
<article
key={post._id}
className="group flex flex-col gap-4 rounded-xl border border-zinc-800 bg-zinc-950/60 p-5 transition-colors hover:border-zinc-700 sm:flex-row"
>
{/* Thumbnail */}
{post.mainImage?.asset && (
<div className="relative h-44 w-full shrink-0 overflow-hidden rounded-lg sm:h-32 sm:w-48">
<Image
src={urlFor(post.mainImage).width(400).height(256).url()}
alt={post.mainImage.alt ?? post.title}
fill
className="object-cover transition-transform duration-300 group-hover:scale-105"
sizes="(max-width: 640px) 100vw, 192px"
/>
</div>
)}
{/* Text */}
<div className="flex flex-col justify-center gap-2">
<div className="flex items-center gap-2 text-[0.7rem] text-zinc-500">
{post.author?.name && <span>{post.author.name}</span>}
{post.author?.name && <span>·</span>}
<time dateTime={post.publishedAt}>{formatDate(post.publishedAt)}</time>
</div>
<h2 className="text-lg font-semibold leading-snug text-zinc-100 group-hover:text-amber-300 transition-colors">
<Link href={`/guides/${post.slug.current}`} className="stretched-link">
{post.title}
</Link>
</h2>
{post.excerpt && (
<p className="text-sm text-zinc-400 leading-relaxed line-clamp-2">
{post.excerpt}
</p>
)}
<Link
href={`/guides/${post.slug.current}`}
className="mt-1 self-start text-xs font-medium text-amber-400 hover:text-amber-300"
>
Read guide
</Link>
</div>
</article>
))}
</div>
)}
<div className="mt-12 rounded-lg border border-zinc-800 bg-zinc-950/60 p-5 text-center">
<p className="text-sm text-zinc-400">
Ready to start building?{' '}
<Link href="/builder" className="font-semibold text-amber-400 hover:text-amber-300">
Open the Builder
</Link>
</p>
</div>
</main>
)
}
+2 -2
View File
@@ -2,7 +2,7 @@
import type { ReactNode } from "react";
import { Suspense } from "react";
import { BuilderNav } from "@/components/BuilderNav";
import { BuilderNavConditional } from "@/components/BuilderNavConditional";
import { TopNav } from "@/components/TopNav";
import { Footer } from "@/components/Footer";
@@ -11,7 +11,7 @@ export default function BuilderLayout({ children }: { children: ReactNode }) {
<div className="min-h-screen bg-white text-zinc-900 dark:bg-neutral-950 dark:text-zinc-50">
<TopNav />
<Suspense fallback={<div className="h-[52px]" />}>
<BuilderNav />
<BuilderNavConditional />
</Suspense>
<main className="min-h-screen">{children}</main>
<Footer />
+2 -2
View File
@@ -417,9 +417,9 @@ export default function PrivacyPolicy() {
<br />
Battl Builder, LLC.
<br />
[Your Address]
{/* [Your Address]
<br />
[City, State, ZIP]
[City, State, ZIP] */}
</p>
</div>
<p className="mt-4 text-sm">
+194
View File
@@ -0,0 +1,194 @@
'use client'
import { useEffect, useState } from 'react'
import { useAuth } from '@/context/AuthContext'
type FeedbackSubmission = {
id: string
category: 'BUG' | 'FEATURE_REQUEST' | 'GENERAL'
message: string
email: string | null
// ipAddress is returned by the API but not displayed in the table (privacy/noise)
reviewed: boolean
createdAt: string
}
const CATEGORY_LABELS: Record<string, string> = {
BUG: 'Bug',
FEATURE_REQUEST: 'Feature Request',
GENERAL: 'General',
}
const CATEGORY_STYLES: Record<string, string> = {
BUG: 'bg-red-500/10 text-red-400 border border-red-500/20',
FEATURE_REQUEST: 'bg-amber-500/10 text-amber-400 border border-amber-500/20',
GENERAL: 'bg-zinc-800 text-zinc-400 border border-zinc-700',
}
function formatDate(iso: string) {
return new Date(iso).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
export default function AdminFeedbackPage() {
const { getAuthHeaders } = useAuth()
const [items, setItems] = useState<FeedbackSubmission[]>([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
const [categoryFilter, setCategoryFilter] = useState('ALL')
const [reviewedFilter, setReviewedFilter] = useState('ALL')
async function load() {
try {
setLoading(true)
setError(null)
const res = await fetch('/api/admin/feedback', {
headers: getAuthHeaders(),
credentials: 'include',
})
if (!res.ok) throw new Error(`Failed to load feedback (${res.status})`)
setItems(await res.json())
} catch (e: unknown) {
setError(e instanceof Error ? e.message : 'Failed to load')
} finally {
setLoading(false)
}
}
useEffect(() => {
load()
}, []) // eslint-disable-line react-hooks/exhaustive-deps
async function toggleReviewed(item: FeedbackSubmission) {
const prev = items
setItems((cur) =>
cur.map((i) => (i.id === item.id ? { ...i, reviewed: !i.reviewed } : i))
)
try {
const res = await fetch(`/api/admin/feedback/${item.id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
credentials: 'include',
body: JSON.stringify({ reviewed: !item.reviewed }),
})
if (!res.ok) setItems(prev)
} catch {
setItems(prev)
}
}
const filtered = items.filter((i) => {
if (categoryFilter !== 'ALL' && i.category !== categoryFilter) return false
if (reviewedFilter === 'REVIEWED' && !i.reviewed) return false
if (reviewedFilter === 'UNREVIEWED' && i.reviewed) return false
return true
})
return (
<div>
<div className="mb-6 flex items-center justify-between">
<div>
<h1 className="text-xl font-semibold tracking-tight">Feedback</h1>
<p className="mt-1 text-sm text-zinc-400">
User-submitted feedback. Mark items reviewed to track triage.
</p>
</div>
<button
onClick={load}
className="rounded-md border border-zinc-800 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200"
>
Refresh
</button>
</div>
<div className="mb-6 flex gap-3">
<select
value={categoryFilter}
onChange={(e) => setCategoryFilter(e.target.value)}
className="rounded-md border border-zinc-800 bg-zinc-950 px-3 py-1.5 text-xs text-zinc-300"
>
<option value="ALL">All categories</option>
<option value="BUG">Bug</option>
<option value="FEATURE_REQUEST">Feature Request</option>
<option value="GENERAL">General</option>
</select>
<select
value={reviewedFilter}
onChange={(e) => setReviewedFilter(e.target.value)}
className="rounded-md border border-zinc-800 bg-zinc-950 px-3 py-1.5 text-xs text-zinc-300"
>
<option value="ALL">All statuses</option>
<option value="UNREVIEWED">Unreviewed</option>
<option value="REVIEWED">Reviewed</option>
</select>
<span className="ml-auto self-center text-xs text-zinc-600">
{filtered.length} of {items.length} submissions
</span>
</div>
{loading && <p className="text-sm text-zinc-500">Loading</p>}
{error && <p className="text-sm text-red-400">{error}</p>}
{!loading && !error && filtered.length === 0 && (
<p className="text-sm text-zinc-500">No submissions match your filters.</p>
)}
{!loading && !error && filtered.length > 0 && (
<div className="overflow-x-auto rounded-xl border border-zinc-800">
<table className="w-full text-sm">
<thead>
<tr className="border-b border-zinc-800 text-left text-[11px] font-semibold uppercase tracking-wider text-zinc-500">
<th className="px-4 py-3">Date</th>
<th className="px-4 py-3">Category</th>
<th className="px-4 py-3">Message</th>
<th className="px-4 py-3">Email</th>
<th className="px-4 py-3">Reviewed</th>
</tr>
</thead>
<tbody className="divide-y divide-zinc-900">
{filtered.map((item) => (
<tr key={item.id} className="hover:bg-zinc-950/60">
<td className="whitespace-nowrap px-4 py-3 text-xs text-zinc-500">
{formatDate(item.createdAt)}
</td>
<td className="px-4 py-3">
<span
className={`rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide ${
CATEGORY_STYLES[item.category]
}`}
>
{CATEGORY_LABELS[item.category]}
</span>
</td>
<td className="max-w-sm px-4 py-3 text-xs text-zinc-300">
{item.message.length > 120
? `${item.message.slice(0, 120)}`
: item.message}
</td>
<td className="px-4 py-3 text-xs text-zinc-500">
{item.email ?? '—'}
</td>
<td className="px-4 py-3">
<button
onClick={() => toggleReviewed(item)}
className={`rounded px-2 py-0.5 text-[10px] font-semibold transition-colors ${
item.reviewed
? 'bg-green-500/10 text-green-400 hover:bg-red-500/10 hover:text-red-400'
: 'bg-zinc-800 text-zinc-500 hover:bg-green-500/10 hover:text-green-400'
}`}
>
{item.reviewed ? 'Reviewed' : 'Mark reviewed'}
</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
)
}
+6 -6
View File
@@ -19,6 +19,7 @@ import {
Wand2,
FolderKanban,
Shield,
MessageSquare,
} from "lucide-react";
const navGroups: AdminNavGroup[] = [
@@ -89,6 +90,11 @@ const navGroups: AdminNavGroup[] = [
href: "/admin/email/send",
icon: <Mail className="h-4 w-4" />,
},
{
label: "Feedback",
href: "/admin/feedback",
icon: <MessageSquare className="h-4 w-4" />,
},
],
},
{
@@ -168,12 +174,6 @@ export default function AdminLayout({
</p>
<p className="text-sm text-zinc-200">Battl Control Panel</p>
</div>
<div className="flex items-center gap-3">
<span className="rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-[11px] font-medium text-amber-300">
Internal v0.1
</span>
</div>
</header>
{/* ✅ min-w-0 here prevents table min-width from widening the page */}
+4 -6
View File
@@ -3,7 +3,6 @@
import { useEffect, useMemo, useState } from "react";
import { Plus, Pencil, Trash2, X } from "lucide-react";
import { useAuth } from "@/context/AuthContext";
import {
createPlatform,
deletePlatform,
@@ -15,7 +14,6 @@ import {
} from "@/lib/api/platforms";
export default function AdminPlatformsPage() {
const { getAuthHeaders } = useAuth();
const [platforms, setPlatforms] = useState<Platform[]>([]);
const [loading, setLoading] = useState(true);
@@ -36,7 +34,7 @@ export default function AdminPlatformsPage() {
try {
setLoading(true);
setError(null);
const data = await fetchPlatforms(getAuthHeaders());
const data = await fetchPlatforms({});
setPlatforms(data);
} catch (e: any) {
console.error(e);
@@ -77,7 +75,7 @@ export default function AdminPlatformsPage() {
try {
setSaving(true);
setError(null);
await deletePlatform(getAuthHeaders(), p.id);
await deletePlatform({}, p.id);
await load();
} catch (e: any) {
console.error(e);
@@ -103,7 +101,7 @@ export default function AdminPlatformsPage() {
setError(null);
if (modalMode === "create") {
await createPlatform(getAuthHeaders(), { ...form, key, label });
await createPlatform({}, { ...form, key, label });
} else if (selected) {
const update: UpdatePlatformDto = {};
if (key !== selected.key) update.key = key;
@@ -111,7 +109,7 @@ export default function AdminPlatformsPage() {
if ((form.isActive ?? true) !== selected.isActive)
update.isActive = form.isActive;
await updatePlatform(getAuthHeaders(), selected.id, update);
await updatePlatform({}, selected.id, update);
}
setShowModal(false);
+30 -29
View File
@@ -1,4 +1,4 @@
import { API_BASE, getToken, qs } from "./auth";
import { API_BASE, qs } from "./auth";
import type {
AdminProductRow,
PageResponse,
@@ -9,25 +9,14 @@ import type {
import type { CaliberDto } from "./types";
async function authedFetch(url: string, init?: RequestInit) {
const token = getToken();
const res = await fetch(url, {
credentials: "include",
cache: "no-store",
...(init ?? {}),
headers: {
Accept: "application/json",
...(init?.headers ?? {}),
...(token ? { Authorization: `Bearer ${token}` } : {}),
} as any,
});
return res;
}
export async function fetchAdminRoles(params: Record<string, any>) {
const res = await authedFetch(
`${API_BASE}/api/v1/admin/products/roles?${qs(params)}`
const queryString = qs(params);
const res = await fetch(
`/api/admin/products/roles${queryString ? `?${queryString}` : ''}`,
{
credentials: "include",
cache: "no-store",
}
);
if (!res.ok) throw new Error(`Failed to load roles (${res.status}): ${await res.text()}`);
return (await res.json()) as string[];
@@ -35,8 +24,13 @@ export async function fetchAdminRoles(params: Record<string, any>) {
// Facet/filtering can still use distinct values seen on products (optional)
export async function fetchProductCaliberFacet(params: Record<string, any>) {
const res = await authedFetch(
`${API_BASE}/api/v1/admin/products/calibers?${qs(params)}`
const queryString = qs(params);
const res = await fetch(
`/api/admin/products/calibers${queryString ? `?${queryString}` : ''}`,
{
credentials: "include",
cache: "no-store",
}
);
if (!res.ok)
throw new Error(
@@ -46,8 +40,13 @@ export async function fetchProductCaliberFacet(params: Record<string, any>) {
}
export async function fetchAdminProducts(params: Record<string, any>) {
const res = await authedFetch(
`${API_BASE}/api/v1/admin/products?${qs(params)}`
const queryString = qs(params);
const res = await fetch(
`/api/admin/products${queryString ? `?${queryString}` : ''}`,
{
credentials: "include",
cache: "no-store",
}
);
if (!res.ok) throw new Error(`Failed to load admin products (${res.status}): ${await res.text()}`);
return (await res.json()) as PageResponse<AdminProductRow>;
@@ -84,14 +83,11 @@ export async function bulkUpdate(
classificationReason: "Admin bulk override";
}>
) {
const token = getToken();
const res = await fetch(`${API_BASE}/api/v1/admin/products/bulk`, {
const res = await fetch(`/api/admin/products/bulk`, {
method: "PATCH",
credentials: "include",
headers: {
"Content-Type": "application/json",
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
body: JSON.stringify({ productIds, ...set }),
});
@@ -103,8 +99,13 @@ export async function bulkUpdate(
export async function fetchAdminCalibers(params: Record<string, any>) {
const res = await authedFetch(
`${API_BASE}/api/v1/admin/calibers?${qs(params)}`
const queryString = qs(params);
const res = await fetch(
`/api/admin/calibers${queryString ? `?${queryString}` : ''}`,
{
credentials: "include",
cache: "no-store",
}
);
if (!res.ok) {
throw new Error(`Failed to load calibers (${res.status}): ${await res.text()}`);
+2 -1
View File
@@ -17,11 +17,12 @@ export default function AdminUsersPage() {
const [error, setError] = useState<string | null>(null);
async function fetchUsers() {
console.log("in the users fetch");
try {
setLoading(true);
setError(null);
const res = await fetch(`${API_BASE_URL}/admin/users`, {
const res = await fetch(`/api/admin/users`, {
headers: {
...getAuthHeaders(),
},
+3 -1
View File
@@ -6,7 +6,9 @@ const API_BASE_URL =
// POST /api/admin/beta-invites?dryRun=true&limit=10&tokenMinutes=30
export async function POST(req: Request) {
const token = cookies().get("session_token")?.value;
const cookieStore = await cookies();
const token = cookieStore.get("session_token")?.value;
if (!token) {
return NextResponse.json({ error: "Missing admin token" }, { status: 401 });
+35
View File
@@ -0,0 +1,35 @@
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_BASE_URL ?? "";
// POST /api/admin/beta-invites?dryRun=true&limit=10&tokenMinutes=30
export async function POST(req: Request) {
const token = cookies().get("session_token")?.value;
if (!token) {
return NextResponse.json({ error: "Missing admin token" }, { status: 401 });
}
const url = new URL(req.url);
const dryRun = url.searchParams.get("dryRun") ?? "true";
const limit = url.searchParams.get("limit") ?? "0";
const tokenMinutes = url.searchParams.get("tokenMinutes") ?? "30";
const upstream = `${API_BASE_URL}/api/v1/admin/beta/invites/send?dryRun=${dryRun}&limit=${limit}&tokenMinutes=${tokenMinutes}`;
const res = await fetch(upstream, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
cache: "no-store",
});
const text = await res.text();
return new NextResponse(text, {
status: res.status,
headers: { "Content-Type": res.headers.get("content-type") ?? "application/json" },
});
}
@@ -5,19 +5,21 @@ const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
const cookieStore = await cookies();
const token = cookieStore.get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function POST(
_req: Request,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/beta/requests/${params.id}/invite`,
`${API_BASE_URL}/api/v1/admin/beta/requests/${resolvedParams.id}/invite`,
{
method: "POST",
headers,
@@ -0,0 +1,39 @@
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function POST(
_req: Request,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/beta/requests/${params.id}/invite`,
{
method: "POST",
headers,
cache: "no-store",
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
+2 -1
View File
@@ -5,7 +5,8 @@ const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
const cookieStore = await cookies();
const token = cookieStore.get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
+39
View File
@@ -0,0 +1,39 @@
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function GET(req: Request) {
try {
const headers = await getAuthHeader();
const url = new URL(req.url);
const search = url.searchParams.toString();
const upstream = `${API_BASE_URL}/api/v1/admin/beta/requests${
search ? `?${search}` : ""
}`;
const res = await fetch(upstream, {
headers,
cache: "no-store",
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
+42
View File
@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/calibers${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+40
View File
@@ -0,0 +1,40 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/calibers${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/admin/dashboard/overview`, {
headers,
cache: 'no-store',
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+8 -5
View File
@@ -5,20 +5,22 @@ const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
const cookieStore = await cookies();
const token = cookieStore.get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function PUT(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/email/${params.id}`, {
const res = await fetch(`${API_BASE_URL}/api/email/${resolvedParams.id}`, {
method: "PUT",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(body),
@@ -39,12 +41,13 @@ export async function PUT(
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/email/${params.id}`, {
const res = await fetch(`${API_BASE_URL}/api/email/${resolvedParams.id}`, {
method: "DELETE",
headers,
});
+63
View File
@@ -0,0 +1,63 @@
import { NextRequest, NextResponse } from "next/server";
import { cookies } from "next/headers";
const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function PUT(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/email/${params.id}`, {
method: "PUT",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/email/${params.id}`, {
method: "DELETE",
headers,
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json({ ok: true });
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
+2 -1
View File
@@ -5,7 +5,8 @@ const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
const cookieStore = await cookies();
const token = cookieStore.get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
+56
View File
@@ -0,0 +1,56 @@
import { NextRequest, NextResponse } from "next/server";
import { cookies } from "next/headers";
const API_BASE_URL =
process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get("session_token")?.value;
if (!token) throw new Error("Unauthorized");
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/email`, {
headers,
cache: "no-store",
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/email`, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
@@ -0,0 +1,52 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ id: string; action: string }> }
) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const resolvedParams = await params;
const { id, action } = resolvedParams;
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/${id}/${action}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
@@ -0,0 +1,48 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(
request: NextRequest,
{ params }: { params: { id: string; action: string } }
) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const { id, action } = params;
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/${id}/${action}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+48
View File
@@ -0,0 +1,48 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/ai/run${queryString ? `?${queryString}` : ''}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/ai/run${queryString ? `?${queryString}` : ''}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+46
View File
@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { fixImageUrls } from '@/lib/server/image-utils';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/queue2${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const data = await res.json();
// Fix mixed content warnings: upgrade HTTP image URLs to HTTPS
return NextResponse.json(fixImageUrls(data));
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
@@ -0,0 +1,44 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { fixImageUrls } from '@/lib/server/image-utils';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/queue2${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const data = await res.json();
// Fix mixed content warnings: upgrade HTTP image URLs to HTTPS
return NextResponse.json(fixImageUrls(data));
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+48
View File
@@ -0,0 +1,48 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/run${queryString ? `?${queryString}` : ''}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+46
View File
@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function POST(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/admin/enrichment/run${queryString ? `?${queryString}` : ''}`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const contentType = res.headers.get('content-type');
if (contentType?.includes('application/json')) {
return NextResponse.json(await res.json());
}
return NextResponse.json({ success: true });
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+39
View File
@@ -0,0 +1,39 @@
import { NextRequest, NextResponse } from 'next/server'
import { cookies } from 'next/headers'
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL
export async function PATCH(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const cookieStore = await cookies()
const token = cookieStore.get('session_token')?.value
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
const { id } = await params
const body = await req.json()
try {
const res = await fetch(`${API_BASE_URL}/api/v1/admin/feedback/${id}`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify(body),
cache: 'no-store',
})
if (!res.ok) {
return NextResponse.json({ error: await res.text() }, { status: res.status })
}
return res.status === 204
? new NextResponse(null, { status: 204 })
: NextResponse.json(await res.json())
} catch (e) {
return NextResponse.json({ error: 'Request failed' }, { status: 500 })
}
}
+29
View File
@@ -0,0 +1,29 @@
import { NextRequest, NextResponse } from 'next/server'
import { cookies } from 'next/headers'
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL
export async function GET(req: NextRequest) {
const cookieStore = await cookies()
const token = cookieStore.get('session_token')?.value
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
const params = req.nextUrl.searchParams.toString()
try {
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/feedback${params ? `?${params}` : ''}`,
{
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
cache: 'no-store',
}
)
if (!res.ok) {
return NextResponse.json({ error: await res.text() }, { status: res.status })
}
return NextResponse.json(await res.json())
} catch (e) {
return NextResponse.json({ error: 'Request failed' }, { status: 500 })
}
}
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/admin/import-status/by-merchant`, {
headers,
cache: 'no-store',
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/admin/import-status/summary`, {
headers,
cache: 'no-store',
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
+40
View File
@@ -0,0 +1,40 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/apply`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/options`, {
headers,
cache: 'no-store',
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,35 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/pending-buckets`, {
headers,
cache: 'no-store',
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
@@ -0,0 +1,39 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(request: NextRequest) {
try {
const headers = await getAuthHeader();
const { searchParams } = new URL(request.url);
const res = await fetch(
`${API_BASE_URL}/api/admin/mapping/raw-categories?${searchParams.toString()}`,
{
headers,
cache: 'no-store',
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
+40
View File
@@ -0,0 +1,40 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/admin/mapping/upsert`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+5 -3
View File
@@ -4,20 +4,22 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}/import`,
`${API_BASE_URL}/api/v1/admin/merchants/${resolvedParams.id}/import`,
{ method: 'POST', headers }
);
@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}/import`,
{ method: 'POST', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
@@ -4,20 +4,22 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}/offer-sync`,
`${API_BASE_URL}/api/v1/admin/merchants/${resolvedParams.id}/offer-sync`,
{ method: 'POST', headers }
);
@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function POST(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}/offer-sync`,
{ method: 'POST', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+11 -7
View File
@@ -4,20 +4,22 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
`${API_BASE_URL}/api/v1/admin/merchants/${resolvedParams.id}`,
{ headers }
);
@@ -36,14 +38,15 @@ export async function GET(
export async function PUT(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
`${API_BASE_URL}/api/v1/admin/merchants/${resolvedParams.id}`,
{
method: 'PUT',
headers: { ...headers, 'Content-Type': 'application/json' },
@@ -66,13 +69,14 @@ export async function PUT(
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
`${API_BASE_URL}/api/v1/admin/merchants/${resolvedParams.id}`,
{ method: 'DELETE', headers }
);
+90
View File
@@ -0,0 +1,90 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
{ headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function PUT(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
{
method: 'PUT',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/merchants/${params.id}`,
{ method: 'DELETE', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+2 -1
View File
@@ -4,7 +4,8 @@ import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
+54
View File
@@ -0,0 +1,54 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET() {
try {
const headers = await getAuthHeader();
const res = await fetch(`${API_BASE_URL}/api/v1/admin/merchants`, {
headers,
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/v1/admin/merchants`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+71
View File
@@ -0,0 +1,71 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function PATCH(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${resolvedParams.id}`,
{
method: 'PATCH',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${resolvedParams.id}`,
{ method: 'DELETE', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json({ ok: true });
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+68
View File
@@ -0,0 +1,68 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function PATCH(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${params.id}`,
{
method: 'PATCH',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${params.id}`,
{ method: 'DELETE', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json({ ok: true });
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+73
View File
@@ -0,0 +1,73 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(request: NextRequest) {
try {
const headers = await getAuthHeader();
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms${queryString ? `?${queryString}` : ''}`,
{
headers: {
...headers,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/v1/admin/platforms`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+72
View File
@@ -0,0 +1,72 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(request: NextRequest) {
try {
const headers = await getAuthHeader();
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms${queryString ? `?${queryString}` : ''}`,
{
headers: {
...headers,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/v1/admin/platforms`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
+43
View File
@@ -0,0 +1,43 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function PATCH(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/bulk`,
{
method: 'PATCH',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+41
View File
@@ -0,0 +1,41 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function PATCH(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/bulk`,
{
method: 'PATCH',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+42
View File
@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/calibers${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
@@ -0,0 +1,40 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/calibers${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+42
View File
@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/roles${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+40
View File
@@ -0,0 +1,40 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products/roles${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+44
View File
@@ -0,0 +1,44 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { fixImageUrls } from '@/lib/server/image-utils';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const data = await res.json();
return NextResponse.json(fixImageUrls(data));
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+42
View File
@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { fixImageUrls } from '@/lib/server/image-utils';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
export async function GET(request: NextRequest) {
try {
const token = cookies().get('session_token')?.value;
if (!token) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/products${queryString ? `?${queryString}` : ''}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const data = await res.json();
return NextResponse.json(fixImageUrls(data));
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Internal server error' },
{ status: 500 }
);
}
}
+71
View File
@@ -0,0 +1,71 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function PATCH(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${resolvedParams.id}`,
{
method: 'PATCH',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const resolvedParams = await params;
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${resolvedParams.id}`,
{ method: 'DELETE', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json({ ok: true });
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+68
View File
@@ -0,0 +1,68 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const token = cookies().get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function PATCH(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${params.id}`,
{
method: 'PATCH',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
const headers = await getAuthHeader();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/platforms/${params.id}`,
{ method: 'DELETE', headers }
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json({ ok: true });
} catch (err: any) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}
+73
View File
@@ -0,0 +1,73 @@
import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';
const API_BASE_URL = process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL;
async function getAuthHeader() {
const cookieStore = await cookies();
const token = cookieStore.get('session_token')?.value;
if (!token) throw new Error('Unauthorized');
return { Authorization: `Bearer ${token}` };
}
export async function GET(request: NextRequest) {
try {
const headers = await getAuthHeader();
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const res = await fetch(
`${API_BASE_URL}/api/v1/admin/users${queryString ? `?${queryString}` : ''}`,
{
headers: {
...headers,
Accept: 'application/json',
},
}
);
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
const data = await res.json();
return NextResponse.json(data);
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}
export async function POST(request: NextRequest) {
try {
const headers = await getAuthHeader();
const body = await request.json();
const res = await fetch(`${API_BASE_URL}/api/v1/admin/users`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
if (!res.ok) {
return NextResponse.json(
{ error: await res.text() },
{ status: res.status }
);
}
return NextResponse.json(await res.json());
} catch (err: any) {
return NextResponse.json(
{ error: err?.message || 'Unauthorized' },
{ status: 401 }
);
}
}

Some files were not shown because too many files have changed in this diff Show More