a metric shit ton. fixed a lot of part_role issues. removed almost all hardcoded categories and used db roles.
This commit is contained in:
+102
-127
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
const API_BASE_URL =
|
||||
process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8080";
|
||||
@@ -13,123 +13,58 @@ type PendingBucket = {
|
||||
productCount: number;
|
||||
};
|
||||
|
||||
const PART_ROLE_OPTIONS: string[] = [
|
||||
// LOWER – receivers
|
||||
"LOWER_RECEIVER_STRIPPED",
|
||||
"LOWER_RECEIVER_COMPLETE",
|
||||
"LOWER_RECEIVER_COMPLETE_PISTOL",
|
||||
"LOWER_RECEIVER_COMPLETE_RIFLE",
|
||||
"LOWER_RECEIVER_80",
|
||||
"LOWER_RECEIVER_BILLET",
|
||||
"LOWER_RECEIVER_FORGED",
|
||||
"LOWER_RECEIVER_POLYMER",
|
||||
|
||||
// LOWER – internals & controls
|
||||
"LOWER_PARTS_KIT",
|
||||
"LOWER_PARTS_KIT_ENHANCED",
|
||||
/**
|
||||
* Canonical part roles (kebab-case) — should match what the importer normalizes to.
|
||||
* Keep this list tight + intentional so mappings don't create junk roles in the DB.
|
||||
*/
|
||||
const PART_ROLE_OPTIONS = [
|
||||
// Assemblies / receivers
|
||||
"upper-receiver",
|
||||
"complete-upper",
|
||||
"lower-receiver",
|
||||
"complete-lower",
|
||||
|
||||
"TRIGGER",
|
||||
"TRIGGER_OTHER",
|
||||
"TRIGGER_COMBAT",
|
||||
"TRIGGER_MATCH",
|
||||
"TRIGGER_DROP_IN",
|
||||
"TRIGGER_SINGLE_STAGE",
|
||||
"TRIGGER_TWO_STAGE",
|
||||
"TRIGGER_GUARD",
|
||||
"PISTOL_GRIP",
|
||||
"PISTOL_GRIP_ERGO",
|
||||
"PISTOL_GRIP_VERTICAL",
|
||||
"SAFETY_SELECTOR",
|
||||
"SAFETY_SELECTOR_AMBI",
|
||||
"SAFETY_SELECTOR_45_DEG",
|
||||
"MAG_RELEASE",
|
||||
"TAKEDOWN_PINS",
|
||||
"SPRINGS_PINS_MISC",
|
||||
|
||||
// LOWER – buffer & stock
|
||||
"BUFFER_KIT",
|
||||
"BUFFER_TUBE",
|
||||
"BUFFER_TUBE_MILSPEC",
|
||||
"BUFFER_TUBE_COMMERCIAL",
|
||||
"BUFFER_SPRING",
|
||||
"BUFFER_WEIGHT",
|
||||
"STOCK_ADJUSTABLE",
|
||||
"STOCK_FIXED",
|
||||
"STOCK_FOLDER",
|
||||
"STOCK_PRECISION",
|
||||
"BRACE_PISTOL",
|
||||
|
||||
// UPPER – receivers & BCG
|
||||
"UPPER_RECEIVER_STRIPPED",
|
||||
"UPPER_RECEIVER_BILLET",
|
||||
"UPPER_RECEIVER_MONOLITHIC",
|
||||
"UPPER_RECEIVER_COMPLETE",
|
||||
"UPPER_RECEIVER_COMPLETE_PISTOL",
|
||||
"UPPER_RECEIVER_COMPLETE_RIFLE",
|
||||
"BOLT_CARRIER_GROUP",
|
||||
"BCG_COMPLETE",
|
||||
"BCG_LIGHTWEIGHT",
|
||||
"BCG_NICKEL_BORON",
|
||||
|
||||
// UPPER – barrel & gas
|
||||
"BARREL",
|
||||
"BARREL_THREADED",
|
||||
"BARREL_PENCIL",
|
||||
"BARREL_MATCH",
|
||||
"BARREL_HEAVY",
|
||||
"BARREL_14_5_PINNED",
|
||||
"GAS_BLOCK",
|
||||
"GAS_BLOCK_ADJUSTABLE",
|
||||
"GAS_BLOCK_LOW_PROFILE",
|
||||
"GAS_TUBE_PISTOL",
|
||||
"GAS_TUBE_CAR",
|
||||
"GAS_TUBE_MID",
|
||||
"GAS_TUBE_RIFLE",
|
||||
|
||||
// UPPER – front end / muzzle
|
||||
"HANDGUARD_MLOK",
|
||||
"HANDGUARD_KEYMOD",
|
||||
"HANDGUARD_QUAD",
|
||||
"HANDGUARD_SLICK",
|
||||
"MUZZLE_BRAKE",
|
||||
"MUZZLE_COMPENSATOR",
|
||||
// Upper sub-parts
|
||||
"bcg",
|
||||
"barrel",
|
||||
"gas-block",
|
||||
"gas-tube",
|
||||
"muzzle-device",
|
||||
"suppressor",
|
||||
"handguard",
|
||||
"charging-handle",
|
||||
|
||||
// 👇 generic / backup muzzle roles
|
||||
"MUZZLE_DEVICE",
|
||||
"MUZZLE_DEVICE_OTHER",
|
||||
|
||||
"FLASH_HIDER",
|
||||
"MUZZLE_DEVICE_QD_MOUNT",
|
||||
"SUPPRESSOR_DIRECT_THREAD",
|
||||
"SUPPRESSOR_QD",
|
||||
"SUPPRESSOR_RIFLE",
|
||||
"SUPPRESSOR_PISTOL",
|
||||
"CHARGING_HANDLE",
|
||||
"CHARGING_HANDLE_AMBI",
|
||||
"CHARGING_HANDLE_GAS_BUSTER",
|
||||
|
||||
// Sights / optics
|
||||
"SIGHTS_BACKUP",
|
||||
"SIGHTS_IRON_FIXED",
|
||||
"SIGHTS_IRON_FLIP",
|
||||
"SIGHTS_OFFSET",
|
||||
"OPTIC_REDDOT",
|
||||
"OPTIC_LPVO",
|
||||
"OPTIC_HOLOGRAPHIC",
|
||||
"OPTIC_PRISM",
|
||||
"OPTIC_MAGNIFIER",
|
||||
|
||||
// Accessories
|
||||
"MAGAZINE",
|
||||
"SLING",
|
||||
"BIPOD",
|
||||
"MOUNT_SCOPE",
|
||||
"MOUNT_OFFSET",
|
||||
"LIGHT_WEAPON",
|
||||
"LASER_VISIBLE",
|
||||
"LASER_IR",
|
||||
"TOOL",
|
||||
];
|
||||
// Lower sub-parts
|
||||
"lower-parts",
|
||||
"trigger",
|
||||
"grip",
|
||||
"safety",
|
||||
"buffer",
|
||||
"stock",
|
||||
|
||||
// Sights / optics
|
||||
"sights",
|
||||
"optic",
|
||||
|
||||
// Accessories / gear
|
||||
"magazine",
|
||||
"weapon-light",
|
||||
"foregrip",
|
||||
"bipod",
|
||||
"sling",
|
||||
"rail-accessory",
|
||||
"tools",
|
||||
] as const;
|
||||
|
||||
type PartRole = (typeof PART_ROLE_OPTIONS)[number];
|
||||
|
||||
function toLabel(role: string) {
|
||||
// "complete-upper" -> "Complete Upper"
|
||||
return role
|
||||
.split("-")
|
||||
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
export default function MappingAdminPage() {
|
||||
const [rows, setRows] = useState<PendingBucket[]>([]);
|
||||
@@ -137,17 +72,33 @@ export default function MappingAdminPage() {
|
||||
const [savingKey, setSavingKey] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const options = useMemo(
|
||||
() =>
|
||||
PART_ROLE_OPTIONS.map((value) => ({
|
||||
value,
|
||||
label: toLabel(value),
|
||||
})),
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
async function load() {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const res = await fetch(
|
||||
`${API_BASE_URL}/api/admin/mapping/pending-buckets`
|
||||
`${API_BASE_URL}/api/admin/mapping/pending-buckets`,
|
||||
{ headers: { Accept: "application/json" } }
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load pending buckets (${res.status})`);
|
||||
const text = await res.text().catch(() => "");
|
||||
throw new Error(
|
||||
`Failed to load pending buckets (${res.status})${text ? `: ${text}` : ""}`
|
||||
);
|
||||
}
|
||||
|
||||
const data: PendingBucket[] = await res.json();
|
||||
setRows(data);
|
||||
} catch (e: any) {
|
||||
@@ -162,9 +113,14 @@ export default function MappingAdminPage() {
|
||||
}, []);
|
||||
|
||||
const handleChangeRole = (idx: number, value: string) => {
|
||||
// Always store normalized kebab-case (defensive)
|
||||
const normalized = value
|
||||
? value.trim().toLowerCase().replace(/_/g, "-")
|
||||
: "";
|
||||
|
||||
setRows((prev) => {
|
||||
const next = [...prev];
|
||||
next[idx] = { ...next[idx], mappedPartRole: value || null };
|
||||
next[idx] = { ...next[idx], mappedPartRole: normalized || null };
|
||||
return next;
|
||||
});
|
||||
};
|
||||
@@ -172,6 +128,20 @@ export default function MappingAdminPage() {
|
||||
const handleSave = async (row: PendingBucket) => {
|
||||
if (!row.mappedPartRole) return;
|
||||
|
||||
const mapped = row.mappedPartRole
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/_/g, "-");
|
||||
|
||||
// Basic guard: prevent saving random roles from stale data
|
||||
const allowed = new Set<string>(PART_ROLE_OPTIONS as readonly string[]);
|
||||
if (!allowed.has(mapped)) {
|
||||
setError(
|
||||
`Refusing to save unknown part role: "${row.mappedPartRole}". Pick a role from the dropdown list.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const key = `${row.merchantId}-${row.rawCategoryKey}`;
|
||||
try {
|
||||
setSavingKey(key);
|
||||
@@ -183,12 +153,15 @@ export default function MappingAdminPage() {
|
||||
body: JSON.stringify({
|
||||
merchantId: row.merchantId,
|
||||
rawCategoryKey: row.rawCategoryKey,
|
||||
mappedPartRole: row.mappedPartRole,
|
||||
mappedPartRole: mapped,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to save mapping (${res.status})`);
|
||||
const text = await res.text().catch(() => "");
|
||||
throw new Error(
|
||||
`Failed to save mapping (${res.status})${text ? `: ${text}` : ""}`
|
||||
);
|
||||
}
|
||||
|
||||
// After save, remove this bucket from the list
|
||||
@@ -241,8 +214,8 @@ export default function MappingAdminPage() {
|
||||
Pending Buckets
|
||||
</h2>
|
||||
<span className="text-xs text-zinc-400">
|
||||
{rows.length} buckets • {rows.reduce((s, r) => s + r.productCount, 0)}{" "}
|
||||
products
|
||||
{rows.length} buckets •{" "}
|
||||
{rows.reduce((s, r) => s + r.productCount, 0)} products
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -283,7 +256,9 @@ export default function MappingAdminPage() {
|
||||
<td className="px-2 py-1 text-zinc-300">
|
||||
{row.rawCategoryKey}
|
||||
</td>
|
||||
<td className="px-2 py-1 text-zinc-200">{row.productCount}</td>
|
||||
<td className="px-2 py-1 text-zinc-200">
|
||||
{row.productCount}
|
||||
</td>
|
||||
<td className="px-2 py-1 text-zinc-100">
|
||||
<select
|
||||
className="w-full rounded-md border border-zinc-700 bg-zinc-950/80 px-2 py-1 text-xs text-zinc-100 outline-none focus:border-amber-400"
|
||||
@@ -293,9 +268,9 @@ export default function MappingAdminPage() {
|
||||
}
|
||||
>
|
||||
<option value="">Select part role…</option>
|
||||
{PART_ROLE_OPTIONS.map((pr) => (
|
||||
<option key={pr} value={pr}>
|
||||
{pr}
|
||||
{options.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>
|
||||
{opt.label} ({opt.value})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
@@ -34,52 +34,50 @@ export default function MerchantsAdminPage() {
|
||||
|
||||
// --- load merchants ---
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const controller = new AbortController();
|
||||
|
||||
async function loadMerchants() {
|
||||
try {
|
||||
console.log("Loading merchants from:", `${API_BASE_URL}/admin/merchants`);
|
||||
|
||||
const res = await fetch(`${API_BASE_URL}/admin/merchants`, {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const url = `${API_BASE_URL}/api/admin/merchants`;
|
||||
console.log("Loading merchants from:", url);
|
||||
|
||||
const res = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
headers: { Accept: "application/json" },
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
console.log("Merchants response status:", res.status);
|
||||
|
||||
|
||||
if (!res.ok) {
|
||||
const text = await res.text().catch(() => "");
|
||||
throw new Error(`HTTP ${res.status} ${res.statusText} – ${text}`);
|
||||
}
|
||||
|
||||
|
||||
const data: MerchantAdminDto[] = await res.json();
|
||||
setMerchants(data);
|
||||
setError(null);
|
||||
} catch (err: any) {
|
||||
if (err?.name === "AbortError") return;
|
||||
console.error("Error loading merchants", err);
|
||||
setError(err.message ?? "Failed to load merchants");
|
||||
setError(err?.message ?? "Failed to load merchants");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
loadMerchants();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
loadMerchants();
|
||||
return () => controller.abort();
|
||||
}, []);
|
||||
|
||||
// --- local field editing ---
|
||||
const updateMerchantField = <K extends keyof MerchantAdminDto>(
|
||||
id: number,
|
||||
field: K,
|
||||
value: MerchantAdminDto[K],
|
||||
value: MerchantAdminDto[K]
|
||||
) => {
|
||||
setMerchants((prev) =>
|
||||
prev.map((m) => (m.id === id ? { ...m, [field]: value } : m)),
|
||||
prev.map((m) => (m.id === id ? { ...m, [field]: value } : m))
|
||||
);
|
||||
};
|
||||
|
||||
@@ -93,7 +91,7 @@ export default function MerchantsAdminPage() {
|
||||
setError(null);
|
||||
setBanner(null);
|
||||
|
||||
const res = await fetch(`${API_BASE_URL}/admin/merchants/${id}`, {
|
||||
const res = await fetch(`${API_BASE_URL}/api/admin/merchants/${id}`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
@@ -108,20 +106,16 @@ export default function MerchantsAdminPage() {
|
||||
if (!res.ok) {
|
||||
const text = await res.text().catch(() => "");
|
||||
console.error("Merchant save failed", res.status, text);
|
||||
throw new Error(
|
||||
`Save failed (${res.status})${text ? `: ${text}` : ""}`,
|
||||
);
|
||||
throw new Error(`Save failed (${res.status})${text ? `: ${text}` : ""}`);
|
||||
}
|
||||
|
||||
const updated: MerchantAdminDto = await res.json();
|
||||
setMerchants((prev) =>
|
||||
prev.map((m) => (m.id === id ? updated : m)),
|
||||
);
|
||||
setMerchants((prev) => prev.map((m) => (m.id === id ? updated : m)));
|
||||
|
||||
setBanner("Merchant saved successfully.");
|
||||
} catch (e: any) {
|
||||
console.error("Error saving merchant", e);
|
||||
setError(e.message ?? "Failed to save merchant");
|
||||
setError(e?.message ?? "Failed to save merchant");
|
||||
} finally {
|
||||
setSavingId(null);
|
||||
setTimeout(() => setBanner(null), 3000);
|
||||
@@ -135,29 +129,27 @@ export default function MerchantsAdminPage() {
|
||||
setError(null);
|
||||
setBanner(null);
|
||||
|
||||
const res = await fetch(`${API_BASE_URL}/admin/imports/${id}`, {
|
||||
const res = await fetch(`${API_BASE_URL}/api/admin/imports/${id}`, {
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const text = await res.text().catch(() => "");
|
||||
console.error("Full import failed", res.status, text);
|
||||
throw new Error(
|
||||
`Import failed (${res.status})${text ? `: ${text}` : ""}`,
|
||||
);
|
||||
throw new Error(`Import failed (${res.status})${text ? `: ${text}` : ""}`);
|
||||
}
|
||||
|
||||
setBanner("Full import started successfully.");
|
||||
} catch (e: any) {
|
||||
console.error("Error starting full import", e);
|
||||
setError(e.message ?? "Failed to start full import");
|
||||
setError(e?.message ?? "Failed to start full import");
|
||||
} finally {
|
||||
setImportingId(null);
|
||||
setTimeout(() => setBanner(null), 3000);
|
||||
}
|
||||
};
|
||||
|
||||
// --- run offer sync (matches /{merchantId}/offers-only) ---
|
||||
// --- run offer sync ---
|
||||
const handleRunOfferSync = async (id: number) => {
|
||||
try {
|
||||
setOfferSyncId(id);
|
||||
@@ -165,24 +157,22 @@ export default function MerchantsAdminPage() {
|
||||
setBanner(null);
|
||||
|
||||
const res = await fetch(
|
||||
`${API_BASE_URL}/admin/imports/${id}/offers-only`,
|
||||
{
|
||||
method: "POST",
|
||||
},
|
||||
`${API_BASE_URL}/api/admin/imports/${id}/offers-only`,
|
||||
{ method: "POST" }
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
const text = await res.text().catch(() => "");
|
||||
console.error("Offer sync failed", res.status, text);
|
||||
throw new Error(
|
||||
`Offer sync failed (${res.status})${text ? `: ${text}` : ""}`,
|
||||
`Offer sync failed (${res.status})${text ? `: ${text}` : ""}`
|
||||
);
|
||||
}
|
||||
|
||||
setBanner("Offer sync started successfully.");
|
||||
} catch (e: any) {
|
||||
console.error("Error starting offer sync", e);
|
||||
setError(e.message ?? "Failed to start offer sync");
|
||||
setError(e?.message ?? "Failed to start offer sync");
|
||||
} finally {
|
||||
setOfferSyncId(null);
|
||||
setTimeout(() => setBanner(null), 3000);
|
||||
@@ -202,9 +192,9 @@ export default function MerchantsAdminPage() {
|
||||
Merchant Feeds <span className="text-amber-300">Admin</span>
|
||||
</h1>
|
||||
<p className="mt-2 text-sm text-zinc-400 max-w-2xl">
|
||||
Manage your AvantLink merchants, product feed URLs, and offer
|
||||
sync settings. Use this to onboard new merchants and keep feeds
|
||||
fresh without touching SQL.
|
||||
Manage your AvantLink merchants, product feed URLs, and offer sync
|
||||
settings. Use this to onboard new merchants and keep feeds fresh
|
||||
without touching SQL.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
@@ -244,6 +234,7 @@ export default function MerchantsAdminPage() {
|
||||
<th className="py-2 pl-3 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody className="divide-y divide-zinc-800">
|
||||
{merchants.map((m) => (
|
||||
<tr key={m.id} className="align-top">
|
||||
@@ -257,71 +248,62 @@ export default function MerchantsAdminPage() {
|
||||
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-50 focus:border-amber-400/70 focus:outline-none focus:ring-0"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3">
|
||||
<input
|
||||
type="text"
|
||||
value={m.avantlinkMid}
|
||||
onChange={(e) =>
|
||||
updateMerchantField(
|
||||
m.id,
|
||||
"avantlinkMid",
|
||||
e.target.value,
|
||||
)
|
||||
updateMerchantField(m.id, "avantlinkMid", e.target.value)
|
||||
}
|
||||
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-50 focus:border-amber-400/70 focus:outline-none focus:ring-0"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3">
|
||||
<input
|
||||
type="text"
|
||||
value={m.feedUrl ?? ""}
|
||||
onChange={(e) =>
|
||||
updateMerchantField(
|
||||
m.id,
|
||||
"feedUrl",
|
||||
e.target.value,
|
||||
)
|
||||
updateMerchantField(m.id, "feedUrl", e.target.value)
|
||||
}
|
||||
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1 text-xs md:text-sm text-zinc-50 focus:border-amber-400/70 focus:outline-none focus:ring-0"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3">
|
||||
<input
|
||||
type="text"
|
||||
value={m.offerFeedUrl ?? ""}
|
||||
onChange={(e) =>
|
||||
updateMerchantField(
|
||||
m.id,
|
||||
"offerFeedUrl",
|
||||
e.target.value || null,
|
||||
)
|
||||
updateMerchantField(m.id, "offerFeedUrl", e.target.value || null)
|
||||
}
|
||||
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1 text-xs md:text-sm text-zinc-50 focus:border-amber-400/70 focus:outline-none focus:ring-0"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3">
|
||||
<label className="inline-flex items-center gap-2 text-xs text-zinc-300">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={m.isActive}
|
||||
onChange={(e) =>
|
||||
updateMerchantField(
|
||||
m.id,
|
||||
"isActive",
|
||||
e.target.checked,
|
||||
)
|
||||
updateMerchantField(m.id, "isActive", e.target.checked)
|
||||
}
|
||||
className="h-4 w-4 rounded border-zinc-600 bg-zinc-900 text-amber-400 focus:ring-amber-400"
|
||||
/>
|
||||
Active
|
||||
</label>
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3 text-xs text-zinc-400 whitespace-nowrap">
|
||||
{formatDate(m.lastFullImportAt)}
|
||||
</td>
|
||||
|
||||
<td className="py-2 px-3 text-xs text-zinc-400 whitespace-nowrap">
|
||||
{formatDate(m.lastOfferSyncAt)}
|
||||
</td>
|
||||
|
||||
<td className="py-2 pl-3">
|
||||
<div className="flex flex-col items-end gap-1">
|
||||
<button
|
||||
@@ -336,33 +318,27 @@ export default function MerchantsAdminPage() {
|
||||
>
|
||||
{savingId === m.id ? "Saving…" : "Save"}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleRunFullImport(m.id)}
|
||||
disabled={importingId === m.id}
|
||||
className={`rounded-md px-3 py-1.5 text-xs font-medium border border-zinc-700 bg-zinc-900 text-zinc-200 hover:bg-zinc-800 transition-colors ${
|
||||
importingId === m.id
|
||||
? "opacity-60 cursor-wait"
|
||||
: ""
|
||||
importingId === m.id ? "opacity-60 cursor-wait" : ""
|
||||
}`}
|
||||
>
|
||||
{importingId === m.id
|
||||
? "Importing…"
|
||||
: "Run Full Import"}
|
||||
{importingId === m.id ? "Importing…" : "Run Full Import"}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleRunOfferSync(m.id)}
|
||||
disabled={offerSyncId === m.id}
|
||||
className={`rounded-md px-3 py-1.5 text-xs font-medium border border-zinc-700 bg-zinc-900 text-zinc-200 hover:bg-zinc-800 transition-colors ${
|
||||
offerSyncId === m.id
|
||||
? "opacity-60 cursor-wait"
|
||||
: ""
|
||||
offerSyncId === m.id ? "opacity-60 cursor-wait" : ""
|
||||
}`}
|
||||
>
|
||||
{offerSyncId === m.id
|
||||
? "Syncing Offers…"
|
||||
: "Run Offer Sync"}
|
||||
{offerSyncId === m.id ? "Syncing Offers…" : "Run Offer Sync"}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user