2 Commits

Author SHA1 Message Date
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
5 changed files with 28 additions and 214 deletions
+14 -14
View File
@@ -1523,25 +1523,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 +1557,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 +1606,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 +1654,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">
-6
View File
@@ -168,12 +168,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 -4
View File
@@ -56,7 +56,7 @@ export function TopNav() {
</Link>
{/* Right side actions */}
<div className="flex items-center gap-4">
<div className="flex items-center justify-end gap-3 sm:gap-4">
<ThemeToggle />
{loading ? (
@@ -83,7 +83,7 @@ export function TopNav() {
</button>
</>
) : (
<>
<div className="flex flex-col items-end gap-2 sm:flex-row sm:items-center sm:gap-4">
<NavLink href="/login">Log In</NavLink>
<Link
@@ -92,11 +92,11 @@ export function TopNav() {
>
Join Beta
</Link>
</>
</div>
)}
</div>
</div>
</header>
);
}
export default TopNav;
export default TopNav;
+10
View File
@@ -1647,6 +1647,7 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2087,6 +2088,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -2768,6 +2770,7 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -2936,6 +2939,7 @@
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.9",
@@ -5172,6 +5176,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.7",
"picocolors": "^1.0.0",
@@ -5393,6 +5398,7 @@
"resolved": "https://registry.npmjs.org/quill-delta/-/quill-delta-5.1.0.tgz",
"integrity": "sha512-X74oCeRI4/p0ucjb5Ma8adTXd9Scumz367kkMK5V/IatcX6A0vlgLgKbzXWy5nZmCGeNJm2oQX0d2Eqj+ZIlCA==",
"license": "MIT",
"peer": true,
"dependencies": {
"fast-diff": "^1.3.0",
"lodash.clonedeep": "^4.5.0",
@@ -5443,6 +5449,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",
"integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -5452,6 +5459,7 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
"integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
},
@@ -6427,6 +6435,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -6596,6 +6605,7 @@
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
-190
View File
@@ -1,190 +0,0 @@
-- ============================================
-- Gunbuilder / AvantLink Schema DDL
-- ============================================
-- Enable extension for UUID generation (if not already enabled)
CREATE EXTENSION IF NOT EXISTS pgcrypto;
-- ============================================
-- 1. merchants
-- ============================================
CREATE TABLE merchants (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
avantlink_mid TEXT NOT NULL UNIQUE, -- AvantLink merchant ID
feed_url TEXT NOT NULL, -- Product datafeed URL
is_active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_merchants_active ON merchants (is_active);
-- ============================================
-- 2. part_categories
-- Your internal Gunbuilder categories
-- ============================================
CREATE TABLE part_categories (
id SERIAL PRIMARY KEY,
slug TEXT NOT NULL UNIQUE, -- 'lower', 'upper', 'barrel', etc.
name TEXT NOT NULL, -- 'Lower Receiver'
description TEXT
);
-- ============================================
-- 3. brands
-- ============================================
CREATE TABLE brands (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE, -- 'Aero Precision'
website TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- ============================================
-- 4. products
-- Canonical parts, independent of merchants
-- ============================================
CREATE TABLE products (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
brand_id INTEGER REFERENCES brands(id),
part_category_id INTEGER NOT NULL REFERENCES part_categories(id),
name TEXT NOT NULL,
slug TEXT NOT NULL UNIQUE,
description TEXT,
caliber TEXT,
barrel_length_mm INTEGER,
gas_system TEXT,
handguard_length_mm INTEGER,
image_url TEXT,
spec_sheet_url TEXT,
msrp NUMERIC(10,2),
current_lowest_price NUMERIC(10,2),
current_lowest_merchant_id INTEGER REFERENCES merchants(id),
is_active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_products_category ON products (part_category_id);
CREATE INDEX idx_products_brand ON products (brand_id);
CREATE INDEX idx_products_active ON products (is_active);
CREATE INDEX idx_products_lowest_price ON products (current_lowest_price);
-- Optional: a "natural-ish" uniqueness constraint if you want it
-- (Can be relaxed later if needed)
CREATE UNIQUE INDEX uniq_products_brand_name_cat
ON products (brand_id, name, part_category_id);
-- ============================================
-- 5. product_offers
-- Merchant-specific offers for a product
-- ============================================
CREATE TABLE product_offers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
merchant_id INTEGER NOT NULL REFERENCES merchants(id),
avantlink_product_id TEXT NOT NULL,
sku TEXT,
upc TEXT,
buy_url TEXT NOT NULL,
price NUMERIC(10,2) NOT NULL,
original_price NUMERIC(10,2),
currency TEXT NOT NULL DEFAULT 'USD',
in_stock BOOLEAN NOT NULL DEFAULT TRUE,
last_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
first_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Each merchant + avantlink_product_id combination must be unique
CREATE UNIQUE INDEX uniq_product_offers_merchant_product
ON product_offers (merchant_id, avantlink_product_id);
CREATE INDEX idx_product_offers_product ON product_offers (product_id);
CREATE INDEX idx_product_offers_merchant ON product_offers (merchant_id);
CREATE INDEX idx_product_offers_in_stock ON product_offers (in_stock);
CREATE INDEX idx_product_offers_price ON product_offers (price);
-- ============================================
-- 6. price_history
-- For tracking price changes over time
-- ============================================
CREATE TABLE price_history (
id BIGSERIAL PRIMARY KEY,
product_offer_id UUID NOT NULL REFERENCES product_offers(id) ON DELETE CASCADE,
price NUMERIC(10,2) NOT NULL,
recorded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_price_history_offer ON price_history (product_offer_id);
CREATE INDEX idx_price_history_recorded_at ON price_history (recorded_at);
-- ============================================
-- 7. category_mappings
-- Map raw AvantLink categories to internal part_categories
-- ============================================
CREATE TABLE category_mappings (
id SERIAL PRIMARY KEY,
merchant_id INTEGER NOT NULL REFERENCES merchants(id),
raw_category_path TEXT NOT NULL, -- e.g. 'Firearms > AR-15 Parts > Lower Receivers'
part_category_id INTEGER NOT NULL REFERENCES part_categories(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (merchant_id, raw_category_path)
);
CREATE INDEX idx_category_mappings_merchant ON category_mappings (merchant_id);
CREATE INDEX idx_category_mappings_part_category ON category_mappings (part_category_id);
-- ============================================
-- 8. feed_imports
-- Track each feed import run for observability
-- ============================================
CREATE TABLE feed_imports (
id BIGSERIAL PRIMARY KEY,
merchant_id INTEGER NOT NULL REFERENCES merchants(id),
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
finished_at TIMESTAMPTZ,
rows_total INTEGER,
rows_processed INTEGER,
rows_new INTEGER,
rows_updated INTEGER,
status TEXT NOT NULL DEFAULT 'running', -- 'running','success','error'
error_message TEXT
);
CREATE INDEX idx_feed_imports_merchant ON feed_imports (merchant_id);
CREATE INDEX idx_feed_imports_status ON feed_imports (status);
CREATE INDEX idx_feed_imports_started_at ON feed_imports (started_at);
-- ============================================
-- 9. Helpful seed data (optional)
-- ============================================
-- Part categories seed (adjust as needed)
INSERT INTO part_categories (slug, name) VALUES
('lower', 'Lower Receiver'),
('upper', 'Upper Receiver'),
('barrel', 'Barrel'),
('handguard', 'Handguard'),
('stock', 'Stock'),
('optic', 'Optic')
ON CONFLICT (slug) DO NOTHING;
-- Example merchant skeleton (fill real datafeed URL + AvantLink MID)
-- INSERT INTO merchants (name, avantlink_mid, feed_url)
-- VALUES ('Example Merchant', '12345', 'https://www.avantlink.com/api/...');