|
|
|
@@ -2,8 +2,8 @@
|
|
|
|
|
import { onMount, onDestroy, tick } from 'svelte';
|
|
|
|
|
import {
|
|
|
|
|
getSlab, updateSlab, reviewSlab, getTaxonomy, getSettings, inferTaxon, inferContent,
|
|
|
|
|
ApiError,
|
|
|
|
|
type Slab, type Taxonomy, type TaxCategory, type TaxTag, type SettingsView,
|
|
|
|
|
listPhotos, persistLineup, photoUrl, ApiError,
|
|
|
|
|
type Slab, type Taxonomy, type TaxCategory, type TaxTag, type SettingsView, type PhotoRow,
|
|
|
|
|
} from '../../api/slabs';
|
|
|
|
|
import type { CalibratedCapture } from '../flow';
|
|
|
|
|
import MultiSelect from './MultiSelect.svelte';
|
|
|
|
@@ -35,7 +35,6 @@
|
|
|
|
|
let edgeOpts: Opt[] = [];
|
|
|
|
|
let figureOpts: Opt[] = [];
|
|
|
|
|
let gradeOpts: Opt[] = [];
|
|
|
|
|
let thicknessOpts: Opt[] = [];
|
|
|
|
|
let moistureOpts: Opt[] = [];
|
|
|
|
|
let figTagOpts: Opt[] = [];
|
|
|
|
|
let featTagOpts: Opt[] = [];
|
|
|
|
@@ -78,7 +77,8 @@
|
|
|
|
|
edgeOpts = termsOf('edge type');
|
|
|
|
|
figureOpts = termsOf('figure');
|
|
|
|
|
gradeOpts = termsOf('grade');
|
|
|
|
|
thicknessOpts = termsOf('thickness');
|
|
|
|
|
// No thickness options: the band is derived server-side and never shown here
|
|
|
|
|
// (METADATA-15 / QUALITY-95).
|
|
|
|
|
moistureOpts = termsOf('moisture');
|
|
|
|
|
// fig-* / feat-* product tags (METADATA-30): pulled from the live synced set,
|
|
|
|
|
// filtered by the family the backend keeps. Never invent a prefix — if the
|
|
|
|
@@ -99,23 +99,7 @@
|
|
|
|
|
let gradeSel: string = '';
|
|
|
|
|
let woodCatIds: number[] = [];
|
|
|
|
|
let figureIds: number[] = [];
|
|
|
|
|
// #88: thickness band is NOT an owner control — it is derived deterministically
|
|
|
|
|
// from thickness_in (TV-9 / QUALITY-95) against the synced Woo thickness terms.
|
|
|
|
|
// The Review screen shows it read-only; the owner changes thickness upstream, and
|
|
|
|
|
// the band follows.
|
|
|
|
|
$: thicknessId = deriveThicknessTermId(
|
|
|
|
|
slab?.thickness_in ?? null,
|
|
|
|
|
thicknessOpts.map((o) => ({ id: o.id, name: o.name })),
|
|
|
|
|
);
|
|
|
|
|
$: thicknessName = thicknessOpts.find((o) => o.id === thicknessId)?.name ?? '';
|
|
|
|
|
// #88 display text: the derived band name, or an explicit "no band" note when a
|
|
|
|
|
// thickness is set but nothing in the synced set encloses it.
|
|
|
|
|
$: thicknessDisplay =
|
|
|
|
|
thicknessId !== ''
|
|
|
|
|
? thicknessName
|
|
|
|
|
: (slab?.thickness_in ?? 0) > 0
|
|
|
|
|
? `— no band for ${fmt1(slab!.thickness_in!)}″`
|
|
|
|
|
: '—';
|
|
|
|
|
let gradeId: number | '' = '';
|
|
|
|
|
let moistureId: number | '' = '';
|
|
|
|
|
let figTagIds: number[] = [];
|
|
|
|
|
let featTagIds: number[] = [];
|
|
|
|
@@ -137,6 +121,16 @@
|
|
|
|
|
let review: ReviewOut | null = null;
|
|
|
|
|
let reviewBusy = false;
|
|
|
|
|
let reviewError = '';
|
|
|
|
|
// #89: explicit "Create" actions. `createBusy` covers the deterministic
|
|
|
|
|
// title/short-desc generation; `canCreateTitle` is its gate (species + ≥1 wood
|
|
|
|
|
// category). `canCreateDesc` gates the AI long-description on title+short-desc
|
|
|
|
|
// being populated AND the content LLM being enabled.
|
|
|
|
|
let createBusy = false;
|
|
|
|
|
let createError = '';
|
|
|
|
|
$: canCreateTitle =
|
|
|
|
|
speciesId !== '' && woodCatIds.length > 0;
|
|
|
|
|
$: canCreateDesc =
|
|
|
|
|
canGenerateContent && title.trim() !== '' && shortDescription.trim() !== '';
|
|
|
|
|
// Monotonic token: each commit captures the current value and ignores its
|
|
|
|
|
// result if a newer commit has since started. Without this, two concurrent
|
|
|
|
|
// commits (e.g. a select change racing the SKU blur) resolve out of order and
|
|
|
|
@@ -156,14 +150,177 @@
|
|
|
|
|
const fmt1 = (v: number) => { const s = v.toFixed(1); return s.endsWith('.0') ? s.slice(0, -2) : s; };
|
|
|
|
|
const fmt2 = (v: number) => v.toFixed(2);
|
|
|
|
|
|
|
|
|
|
// --- #90 Photo strip (REVIEW-5 / PUBLISH-45) ---
|
|
|
|
|
// The owner edits which photos stay/go and their order. Leftmost kept photo =
|
|
|
|
|
// primary (Woo cover). Kept in-memory; persisted via persistLineup() on
|
|
|
|
|
// "Continue to Publish". Sources are the STORED photos (listPhotos) so the
|
|
|
|
|
// strip survives re-entry into Review; in-memory lineup blobs (from capture)
|
|
|
|
|
// are preferred when present.
|
|
|
|
|
interface StripPhoto {
|
|
|
|
|
id: string;
|
|
|
|
|
role: 'calibration' | 'overlay' | 'batch';
|
|
|
|
|
isCalibration: boolean;
|
|
|
|
|
kept: boolean;
|
|
|
|
|
/** True for the mandatory photos (clean calibration + dimension-overlay
|
|
|
|
|
copy). Their keep checkbox is checked and disabled — the owner cannot
|
|
|
|
|
remove them (REVIEW-5 requires both). */
|
|
|
|
|
required: boolean;
|
|
|
|
|
original: Blob;
|
|
|
|
|
processed: Blob | null;
|
|
|
|
|
url: string;
|
|
|
|
|
}
|
|
|
|
|
let photos: StripPhoto[] = [];
|
|
|
|
|
let photosLoaded = false;
|
|
|
|
|
let lineupDirty = false;
|
|
|
|
|
let persistBusy = false;
|
|
|
|
|
let persistError = '';
|
|
|
|
|
|
|
|
|
|
// In-memory blobs from the capture lineup, keyed by lineup order. The stored
|
|
|
|
|
// photo id matches the capture's upload order only on the first entry; after
|
|
|
|
|
// an edit the STORED row (listPhotos) is authoritative and we re-fetch blobs.
|
|
|
|
|
const inMemByRole = (): Map<'calibration' | 'overlay' | 'batch', Blob[]> => {
|
|
|
|
|
const m = new Map<'calibration' | 'overlay' | 'batch', Blob[]>();
|
|
|
|
|
for (const it of capture?.lineup ?? []) {
|
|
|
|
|
if (it.kind !== 'png') continue;
|
|
|
|
|
const arr = m.get(it.role) ?? [];
|
|
|
|
|
arr.push(it.blob);
|
|
|
|
|
m.set(it.role, arr);
|
|
|
|
|
}
|
|
|
|
|
return m;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Object URLs minted from in-memory blobs; revoked on unmount/reload so the
|
|
|
|
|
// <img> src stays valid. A raw Blob assigned to src renders broken — it must
|
|
|
|
|
// be a blob: URL (bug: the first/Primary photo was the one carrying a blob).
|
|
|
|
|
let photoUrls: string[] = [];
|
|
|
|
|
|
|
|
|
|
async function loadPhotos() {
|
|
|
|
|
// Revoke any previous object URLs before rebuilding the strip.
|
|
|
|
|
for (const u of photoUrls) URL.revokeObjectURL(u);
|
|
|
|
|
photoUrls = [];
|
|
|
|
|
try {
|
|
|
|
|
const rows: PhotoRow[] = await listPhotos(slabId);
|
|
|
|
|
const byRole = inMemByRole();
|
|
|
|
|
const seqByRole: Record<string, number> = { calibration: 0, overlay: 0, batch: 0 };
|
|
|
|
|
photos = rows.map((r) => {
|
|
|
|
|
const role = r.role ?? 'batch';
|
|
|
|
|
const n = seqByRole[role]++;
|
|
|
|
|
const blob = (byRole.get(role)?.[n]) ?? null;
|
|
|
|
|
// Prefer the in-memory blob (fresh capture), as an object URL. Otherwise
|
|
|
|
|
// fall back to the stored photo endpoint (a plain string URL).
|
|
|
|
|
const endpoint = photoUrl(slabId, r.id, (r.has_processed ? 'processed' : 'original') as 'original' | 'processed');
|
|
|
|
|
const url = resolvePhotoUrl(blob, endpoint);
|
|
|
|
|
if (blob && blob.size > 0) photoUrls.push(url);
|
|
|
|
|
return {
|
|
|
|
|
id: r.id,
|
|
|
|
|
role,
|
|
|
|
|
isCalibration: r.is_calibration === 1,
|
|
|
|
|
// Mandatory: the clean calibration photo and the dimension-overlay
|
|
|
|
|
// copy. REVIEW-5 requires both to ship, so their keep control is
|
|
|
|
|
// checked + disabled (the owner can't remove them).
|
|
|
|
|
required: role === 'calibration' || role === 'overlay',
|
|
|
|
|
kept: true,
|
|
|
|
|
original: blob ?? new Blob(),
|
|
|
|
|
processed: blob ?? null,
|
|
|
|
|
url,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
photosLoaded = true;
|
|
|
|
|
lineupDirty = false;
|
|
|
|
|
} catch {
|
|
|
|
|
photos = [];
|
|
|
|
|
photosLoaded = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDestroy(() => {
|
|
|
|
|
for (const u of photoUrls) URL.revokeObjectURL(u);
|
|
|
|
|
photoUrls = [];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Whole-card tap = keep/remove toggle. A real drag (>6px) reorders and does NOT
|
|
|
|
|
// toggle keep/remove — the threshold lives in the pointer handlers below.
|
|
|
|
|
function toggleKeep(id: string) {
|
|
|
|
|
photos = photos.map((p) => {
|
|
|
|
|
if (p.id !== id) return p;
|
|
|
|
|
// Mandatory photos (clean cal + dimension-overlay) can't be removed.
|
|
|
|
|
if (p.required) return p;
|
|
|
|
|
return { ...p, kept: !p.kept };
|
|
|
|
|
});
|
|
|
|
|
lineupDirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reorder(from: number, to: number) {
|
|
|
|
|
photos = moveItem(photos, from, to);
|
|
|
|
|
lineupDirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let dragFrom = -1;
|
|
|
|
|
|
|
|
|
|
function onDragStart(e: DragEvent, index: number) {
|
|
|
|
|
dragFrom = index;
|
|
|
|
|
if (e.dataTransfer) {
|
|
|
|
|
e.dataTransfer.effectAllowed = 'move';
|
|
|
|
|
e.dataTransfer.setData('text/plain', String(index));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onDragOver(e: DragEvent) {
|
|
|
|
|
if (e.preventDefault) e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onDrop(e: DragEvent, index: number) {
|
|
|
|
|
if (e.preventDefault) e.preventDefault();
|
|
|
|
|
if (dragFrom >= 0 && dragFrom !== index) reorder(dragFrom, index);
|
|
|
|
|
dragFrom = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// REVIEW-5: the kept set must contain a clean photo and its overlay copy. Only
|
|
|
|
|
// enforced once photos have loaded (photosLoaded); a failed/absent photo list
|
|
|
|
|
// (e.g. legacy mock) leaves the lineup minimum neutral rather than blocking.
|
|
|
|
|
let lineupMissing: ('calibration' | 'overlay')[] = [];
|
|
|
|
|
$: lineupMissing = photosLoaded
|
|
|
|
|
? missingMinimums(keptInOrder(photos as LineupItem[]) as LineupItem[])
|
|
|
|
|
: [];
|
|
|
|
|
$: lineupValid = lineupMissing.length === 0;
|
|
|
|
|
// Leftmost kept photo id = primary (Woo cover). '' when nothing is kept.
|
|
|
|
|
let primaryId = '';
|
|
|
|
|
$: primaryId = photosLoaded
|
|
|
|
|
? ((keptInOrder(photos as LineupItem[]) as StripPhoto[])[0]?.id ?? '')
|
|
|
|
|
: '';
|
|
|
|
|
// Persist the edited lineup (re-seq kept + drop removed), then hand to Publish.
|
|
|
|
|
async function goPublish() {
|
|
|
|
|
if (!lineupValid) return;
|
|
|
|
|
persistBusy = true;
|
|
|
|
|
persistError = '';
|
|
|
|
|
try {
|
|
|
|
|
const kept = keptInOrder(photos as LineupItem[]) as StripPhoto[];
|
|
|
|
|
const removed = photos.filter((p) => !p.kept).map((p) => p.id);
|
|
|
|
|
await persistLineup(
|
|
|
|
|
slabId,
|
|
|
|
|
kept.map((p) => ({
|
|
|
|
|
id: p.id,
|
|
|
|
|
role: p.role,
|
|
|
|
|
isCalibration: p.isCalibration,
|
|
|
|
|
original: p.original,
|
|
|
|
|
processed: p.processed,
|
|
|
|
|
})),
|
|
|
|
|
removed,
|
|
|
|
|
);
|
|
|
|
|
onPublish();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
persistError = e instanceof ApiError ? e.message : 'Could not save the photos. Try again.';
|
|
|
|
|
} finally {
|
|
|
|
|
persistBusy = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hydrate(s: Slab, t: Taxonomy | null) {
|
|
|
|
|
speciesSel = s.species_id != null ? String(s.species_id) : '';
|
|
|
|
|
woodCatIds = [...(s.wood_category_ids ?? [])];
|
|
|
|
|
edgeSel = s.edge_type_term_id != null ? String(s.edge_type_term_id) : '';
|
|
|
|
|
figureIds = [...(s.figure_term_ids ?? [])];
|
|
|
|
|
gradeSel = s.grade_term_id != null ? String(s.grade_term_id) : '';
|
|
|
|
|
// thicknessId is derived reactively from slab.thickness_in (#88) — not hydrated
|
|
|
|
|
// from the stored term, so a stale stored band can't shadow the derived value.
|
|
|
|
|
gradeId = s.grade_term_id ?? '';
|
|
|
|
|
moistureId = s.moisture_term_id ?? '';
|
|
|
|
|
figTagIds = [...(s.fig_tag_ids ?? [])];
|
|
|
|
|
featTagIds = [...(s.feat_tag_ids ?? [])];
|
|
|
|
@@ -174,7 +331,8 @@
|
|
|
|
|
price = s.price != null ? String(s.price) : '';
|
|
|
|
|
priceSource = s.price_source ?? 'recommendation';
|
|
|
|
|
sku = s.sku ?? '';
|
|
|
|
|
primaryCatId = woodCatIds[0] ?? '';
|
|
|
|
|
// REVIEW-15: primary defaults to first selected wood cat; keep if still valid.
|
|
|
|
|
primaryCatId = nextPrimary(woodCatIds, woodCatIds[0] ?? '');
|
|
|
|
|
// Seed AI-recommended markers from stored confidences (>=0.7 means the AI put
|
|
|
|
|
// its weight behind the value the owner kept).
|
|
|
|
|
aiRecommendations = [];
|
|
|
|
@@ -184,28 +342,63 @@
|
|
|
|
|
aiRecommendations.push(...(s.figure_term_ids ?? []));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const aiIn = (ids: number[]) => (id: number) => ids.includes(id);
|
|
|
|
|
// AI-marked option views (badge on rows after Call 1 / stored confidences).
|
|
|
|
|
$: speciesOptsView = speciesOpts.map((o) => ({ ...o, ai: aiRecommendations.includes(o.id) }));
|
|
|
|
|
$: woodCatGroupsView = woodCatGroups.map((g) => ({
|
|
|
|
|
parent: g.parent,
|
|
|
|
|
leaves: g.leaves.map((o) => ({ ...o, ai: aiRecommendations.includes(o.id) })),
|
|
|
|
|
}));
|
|
|
|
|
$: figureOptsView = figureOpts.map((o) => ({ ...o, ai: aiRecommendations.includes(o.id) }));
|
|
|
|
|
$: featTagOptsView = featTagOpts.map((o) => ({ ...o, ai: aiRecommendations.includes(o.id) }));
|
|
|
|
|
// Flat leaf name lookup for the primary radio set (REVIEW-15).
|
|
|
|
|
$: woodLeafById = new Map(
|
|
|
|
|
woodCatGroups.flatMap((g) => g.leaves.map((l) => [l.id, l] as [number, Opt])),
|
|
|
|
|
);
|
|
|
|
|
$: primaryOpts = woodCatIds
|
|
|
|
|
.map((id) => woodLeafById.get(id))
|
|
|
|
|
.filter((o): o is Opt => !!o)
|
|
|
|
|
.map((o) => ({ ...o, ai: aiRecommendations.includes(o.id) }));
|
|
|
|
|
|
|
|
|
|
// METADATA-15 / QUALITY-95: the thickness band is derived server-side from the
|
|
|
|
|
// measured thickness against the live synced Woo bands. It is deliberately absent
|
|
|
|
|
// from this screen — no owner control, no read-only echo. The only thickness the
|
|
|
|
|
// owner sees here is the measured value in the summary above.
|
|
|
|
|
const aiIn = (ids: number[]) => (id: number) => ids.includes(id);
|
|
|
|
|
// Persist taxonomy/price/sku edits to the slab (PUT), then recompute ready.
|
|
|
|
|
// #89: the deterministic title/short_description are written here — the server's
|
|
|
|
|
// review returns the build from the current metadata, and if the field is empty
|
|
|
|
|
// we fold the deterministic value into THIS same PUT (no extra request, no rev
|
|
|
|
|
// race). Owner-edited text is never clobbered (only an empty field is filled).
|
|
|
|
|
async function commitReview(): Promise<void> {
|
|
|
|
|
if (!slab) return;
|
|
|
|
|
const myToken = ++commitToken;
|
|
|
|
|
reviewBusy = true;
|
|
|
|
|
reviewError = '';
|
|
|
|
|
try {
|
|
|
|
|
// Run the deterministic review FIRST (reads the current metadata) to get the
|
|
|
|
|
// title/short_description build before we persist.
|
|
|
|
|
const probe = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
|
|
|
|
price: price === '' ? undefined : Number(price),
|
|
|
|
|
sku: sku || undefined,
|
|
|
|
|
});
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
// If the owner hasn't typed a title/short-desc, adopt the deterministic build
|
|
|
|
|
// so this PUT persists it (the Create buttons do the same, on demand).
|
|
|
|
|
if (probe.title && title === '') title = probe.title;
|
|
|
|
|
if (probe.short_description && shortDescription === '') shortDescription = probe.short_description;
|
|
|
|
|
|
|
|
|
|
const patch = {
|
|
|
|
|
species_id: speciesSel === '' ? null : Number(speciesSel),
|
|
|
|
|
wood_category_ids: woodCatIds,
|
|
|
|
|
edge_type_term_id: edgeSel === '' ? null : Number(edgeSel),
|
|
|
|
|
figure_term_ids: figureIds,
|
|
|
|
|
grade_term_id: gradeSel === '' ? null : Number(gradeSel),
|
|
|
|
|
thickness_term_id: thicknessId === '' ? null : Number(thicknessId),
|
|
|
|
|
grade_term_id: gradeId === '' ? null : Number(gradeId),
|
|
|
|
|
moisture_term_id: moistureId === '' ? null : Number(moistureId),
|
|
|
|
|
fig_tag_ids: figTagIds,
|
|
|
|
|
feat_tag_ids: featTagIds,
|
|
|
|
|
title: title || null,
|
|
|
|
|
short_description: shortDescription || null,
|
|
|
|
|
description: description || null,
|
|
|
|
|
content_source: contentSource || null,
|
|
|
|
|
price: price === '' ? null : Number(price),
|
|
|
|
|
price_source: priceSource,
|
|
|
|
@@ -215,21 +408,79 @@
|
|
|
|
|
const fresh = await updateSlab(slabId, patch);
|
|
|
|
|
if (myToken !== commitToken) return; // superseded; don't clobber the latest
|
|
|
|
|
slab = fresh;
|
|
|
|
|
if (primaryCatId !== '') {
|
|
|
|
|
const res = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: Number(primaryCatId),
|
|
|
|
|
title: title || undefined,
|
|
|
|
|
short_description: shortDescription || undefined,
|
|
|
|
|
price: price === '' ? undefined : Number(price),
|
|
|
|
|
sku: sku || undefined,
|
|
|
|
|
// Re-run the review against the just-persisted row (authoritative ready/missing).
|
|
|
|
|
review = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
|
|
|
|
price: price === '' ? undefined : Number(price),
|
|
|
|
|
sku: sku || undefined,
|
|
|
|
|
});
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
if (review.primary_wood_category_id != null) primaryCatId = review.primary_wood_category_id;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
reviewError = e instanceof ApiError ? e.message : 'Could not review. Try again.';
|
|
|
|
|
review = null;
|
|
|
|
|
} finally {
|
|
|
|
|
if (myToken === commitToken) reviewBusy = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// #89: explicit "Create title" / "Create short desc" — fire the deterministic
|
|
|
|
|
// build from the current metadata and write the result into the fields,
|
|
|
|
|
// overwriting whatever was there (empty, owner-typed, or previously generated).
|
|
|
|
|
// That is the whole contract: the button fires the build. commitReview()
|
|
|
|
|
// auto-fills only empty fields; this is the explicit "force overwrite" action.
|
|
|
|
|
async function createTitle(): Promise<void> {
|
|
|
|
|
if (!slab || createBusy) return;
|
|
|
|
|
createBusy = true;
|
|
|
|
|
createError = '';
|
|
|
|
|
try {
|
|
|
|
|
// 1. Run the deterministic review to get title / short_description.
|
|
|
|
|
const res = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
|
|
|
|
});
|
|
|
|
|
if (res.primary_wood_category_id != null) primaryCatId = res.primary_wood_category_id;
|
|
|
|
|
// 2. Write the deterministic values into the bound fields — always overwrite.
|
|
|
|
|
if (res.title) title = res.title;
|
|
|
|
|
if (res.short_description) shortDescription = res.short_description;
|
|
|
|
|
// 3. Persist the generated prose (single PUT, fresh client_rev).
|
|
|
|
|
if ((title || shortDescription) && (title !== (slab as Slab).title || shortDescription !== (slab as Slab).short_description)) {
|
|
|
|
|
const prosePatch = {
|
|
|
|
|
title: title || null,
|
|
|
|
|
short_description: shortDescription || null,
|
|
|
|
|
client_rev: (slab as Slab).server_rev,
|
|
|
|
|
};
|
|
|
|
|
const fresh = await updateSlab(slabId, prosePatch);
|
|
|
|
|
slab = fresh;
|
|
|
|
|
review = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
|
|
|
|
});
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
review = res;
|
|
|
|
|
if (res.primary_wood_category_id != null) primaryCatId = res.primary_wood_category_id;
|
|
|
|
|
} else {
|
|
|
|
|
review = await reviewSlab(slabId);
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
createError = e instanceof ApiError ? e.message : 'Could not build the title. Try again.';
|
|
|
|
|
} finally {
|
|
|
|
|
createBusy = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// #89: the description textarea commits on blur. commitReview() no longer sends
|
|
|
|
|
// description (see #89), so this persists the owner-typed description explicitly.
|
|
|
|
|
async function commitDescription(): Promise<void> {
|
|
|
|
|
if (!slab) return;
|
|
|
|
|
const myToken = ++commitToken;
|
|
|
|
|
reviewBusy = true;
|
|
|
|
|
reviewError = '';
|
|
|
|
|
try {
|
|
|
|
|
const fresh = await updateSlab(slabId, {
|
|
|
|
|
description: description || null,
|
|
|
|
|
content_source: contentSource || null,
|
|
|
|
|
client_rev: slab.server_rev,
|
|
|
|
|
});
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
slab = fresh;
|
|
|
|
|
review = await reviewSlab(slabId, {
|
|
|
|
|
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
reviewError = e instanceof ApiError ? e.message : 'Could not review. Try again.';
|
|
|
|
@@ -250,7 +501,7 @@
|
|
|
|
|
if (s.species_id) { speciesSel = String(s.species_id); recs.push(s.species_id); }
|
|
|
|
|
if (s.wood_category_ids) {
|
|
|
|
|
woodCatIds = [...s.wood_category_ids];
|
|
|
|
|
if (!primaryCatId) primaryCatId = woodCatIds[0];
|
|
|
|
|
primaryCatId = nextPrimary(woodCatIds, primaryCatId);
|
|
|
|
|
recs.push(...s.wood_category_ids);
|
|
|
|
|
}
|
|
|
|
|
if (s.edge_type_term_id) edgeSel = String(s.edge_type_term_id);
|
|
|
|
@@ -274,14 +525,22 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function generateContent() {
|
|
|
|
|
if (!slab) return;
|
|
|
|
|
if (!slab || !canCreateDesc) return;
|
|
|
|
|
genBusy = true;
|
|
|
|
|
genError = '';
|
|
|
|
|
try {
|
|
|
|
|
const r = await inferContent(slabId);
|
|
|
|
|
description = r.description;
|
|
|
|
|
contentSource = 'llm';
|
|
|
|
|
await commitReview();
|
|
|
|
|
// commitReview() no longer sends description (see #89), so persist it explicitly.
|
|
|
|
|
const myToken = ++commitToken;
|
|
|
|
|
const fresh = await updateSlab(slabId, {
|
|
|
|
|
description: description || null,
|
|
|
|
|
content_source: contentSource || null,
|
|
|
|
|
client_rev: slab.server_rev,
|
|
|
|
|
});
|
|
|
|
|
if (myToken !== commitToken) return;
|
|
|
|
|
slab = fresh;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
genError = e instanceof ApiError ? e.message : 'Could not generate text.';
|
|
|
|
|
} finally {
|
|
|
|
@@ -319,6 +578,17 @@
|
|
|
|
|
let speciesEl: HTMLSelectElement | undefined;
|
|
|
|
|
let edgeEl: HTMLSelectElement | undefined;
|
|
|
|
|
let gradeEl: HTMLSelectElement | undefined;
|
|
|
|
|
/** Wood categories: toggle leaf + keep primary valid (REVIEW-15 / wireframe #90). */
|
|
|
|
|
function toggleWoodCat(id: number) {
|
|
|
|
|
woodCatIds = toggleMulti(woodCatIds, id);
|
|
|
|
|
primaryCatId = nextPrimary(woodCatIds, primaryCatId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function pickPrimary(id: number) {
|
|
|
|
|
if (!woodCatIds.includes(id)) return;
|
|
|
|
|
primaryCatId = id;
|
|
|
|
|
void commitReview();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
try {
|
|
|
|
@@ -329,6 +599,7 @@
|
|
|
|
|
canGenerateContent = !!set.content_llm_enabled;
|
|
|
|
|
// #90: sync the <select> DOM to the hydrated values (same race as AI prefill).
|
|
|
|
|
syncSelects();
|
|
|
|
|
await loadPhotos();
|
|
|
|
|
await commitReview();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
loadError = e instanceof ApiError ? e.message : 'Could not load the slab.';
|
|
|
|
@@ -337,17 +608,9 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function goPublish() {
|
|
|
|
|
onPublish();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function goBack() {
|
|
|
|
|
onBack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function publish() {
|
|
|
|
|
goPublish();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if loading}
|
|
|
|
@@ -371,6 +634,55 @@
|
|
|
|
|
<div><dt>Sqft / Bdft</dt><dd>{fmt2(capture?.sqft ?? slab?.sqft ?? 0)} / {fmt2(capture?.bdft ?? slab?.bdft ?? 0)}</dd></div>
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
<!-- #90 Photo strip: keep/remove + drag-reorder; leftmost kept = primary. -->
|
|
|
|
|
{#if photosLoaded && photos.length}
|
|
|
|
|
<div class="photos" data-testid="photo-strip">
|
|
|
|
|
<p class="ph-hint">Tap a photo to keep or remove it · drag to reorder · leftmost photo = primary</p>
|
|
|
|
|
<div class="ph-grid">
|
|
|
|
|
{#each photos as p, i (p.id)}
|
|
|
|
|
<div
|
|
|
|
|
class="pcard"
|
|
|
|
|
class:kept={p.kept}
|
|
|
|
|
class:primary={p.id === primaryId}
|
|
|
|
|
class:required={p.required}
|
|
|
|
|
data-testid="photo-card"
|
|
|
|
|
data-primary={p.id === primaryId ? 'true' : ''}
|
|
|
|
|
data-required={p.required ? 'true' : ''}
|
|
|
|
|
role="button"
|
|
|
|
|
tabindex="0"
|
|
|
|
|
aria-pressed={p.required ? true : p.kept}
|
|
|
|
|
aria-disabled={p.required ? 'true' : 'false'}
|
|
|
|
|
aria-label="{p.required ? 'Required: ' : ''}{roleLabel(p.role)}{p.required ? ' (cannot be removed)' : (p.kept ? ', kept' : ', removed')}"
|
|
|
|
|
draggable="true"
|
|
|
|
|
on:click={() => toggleKeep(p.id)}
|
|
|
|
|
on:keydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleKeep(p.id); } }}
|
|
|
|
|
on:dragstart={(e) => onDragStart(e, i)}
|
|
|
|
|
on:dragover={onDragOver}
|
|
|
|
|
on:drop={(e) => onDrop(e, i)}
|
|
|
|
|
>
|
|
|
|
|
<img class="ph-thumb" src={p.url} alt={roleLabel(p.role)} draggable="false" />
|
|
|
|
|
{#if p.id === primaryId}
|
|
|
|
|
<span class="ph-pri">PRIMARY</span>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if p.required}
|
|
|
|
|
<span class="ph-req">REQUIRED</span>
|
|
|
|
|
{/if}
|
|
|
|
|
<span class="ph-seq" aria-hidden="true">{i + 1}</span>
|
|
|
|
|
<!-- Keep checkbox: always checked for required photos; a disabled
|
|
|
|
|
glyph (no check) when a batch photo is removed. -->
|
|
|
|
|
<span class="ph-keep" class:required={p.required} aria-hidden="true"></span>
|
|
|
|
|
</div>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
{#if lineupMissing.length}
|
|
|
|
|
<p class="ph-nudge" data-testid="lineup-nudge" role="alert">
|
|
|
|
|
Keep at least {lineupMissing.map(roleLabel).join(' and ')} — required to publish.
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if persistError}<p class="nudge" role="alert">{persistError}</p>{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if settings?.inference_enabled}
|
|
|
|
|
<div class="aibar">
|
|
|
|
|
<button type="button" class="ai-btn" data-testid="run-inference" on:click={runInference} disabled={aiBusy}>
|
|
|
|
@@ -391,16 +703,43 @@
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Wood categories (multi, searchable list, AI-assist) -->
|
|
|
|
|
<MultiSelect
|
|
|
|
|
label="Wood categories"
|
|
|
|
|
groups={woodCatGroups}
|
|
|
|
|
selected={woodCatIds}
|
|
|
|
|
placeholder="Choose wood categories"
|
|
|
|
|
testid="wood-cat"
|
|
|
|
|
onToggle={(id) => (woodCatIds = toggleMulti(woodCatIds, id))}
|
|
|
|
|
onCommit={commitReview}
|
|
|
|
|
/>
|
|
|
|
|
<!-- Wood categories (multi + inline primary radio set, REVIEW-15 / #90 wireframe) -->
|
|
|
|
|
<div class="field" data-testid="wood-cat-field">
|
|
|
|
|
<label class="lbl">Wood categories <span class="ai">AI assist</span></label>
|
|
|
|
|
<MultiSelect
|
|
|
|
|
label="Wood categories"
|
|
|
|
|
groups={woodCatGroupsView}
|
|
|
|
|
selected={woodCatIds}
|
|
|
|
|
placeholder="Choose wood categories"
|
|
|
|
|
testid="wood-cat"
|
|
|
|
|
onToggle={toggleWoodCat}
|
|
|
|
|
on:commit={commitReview}
|
|
|
|
|
/>
|
|
|
|
|
{#if primaryOpts.length}
|
|
|
|
|
<div class="primary-set" data-testid="primary-wood-set" role="radiogroup" aria-label="Primary wood category">
|
|
|
|
|
<div class="ps-lbl">Primary wood category <span class="ps-req">drives title</span></div>
|
|
|
|
|
{#each primaryOpts as o (o.id)}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="ps-opt"
|
|
|
|
|
class:on={primaryCatId === o.id}
|
|
|
|
|
role="radio"
|
|
|
|
|
aria-checked={primaryCatId === o.id}
|
|
|
|
|
data-testid={`primary-wood-${o.id}`}
|
|
|
|
|
on:click={() => pickPrimary(o.id)}
|
|
|
|
|
>
|
|
|
|
|
<span class="ps-radio" aria-hidden="true"></span>
|
|
|
|
|
<span class="ps-name">{o.name}</span>
|
|
|
|
|
{#if o.ai}<span class="ps-tag">AI</span>{/if}
|
|
|
|
|
</button>
|
|
|
|
|
{/each}
|
|
|
|
|
<p class="ps-note">
|
|
|
|
|
Primary selects the title & short-description pattern (METADATA-85).
|
|
|
|
|
Secondary categories feed the description. Default = first selected.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Edge type (single, AI-assist) -->
|
|
|
|
|
<div class="field">
|
|
|
|
@@ -418,12 +757,12 @@
|
|
|
|
|
<label class="lbl">Figure <span class="ai">AI assist</span></label>
|
|
|
|
|
<MultiSelect
|
|
|
|
|
label="Figure"
|
|
|
|
|
options={figureOpts}
|
|
|
|
|
options={figureOptsView}
|
|
|
|
|
selected={figureIds}
|
|
|
|
|
placeholder="Choose figure"
|
|
|
|
|
testid="figure"
|
|
|
|
|
onToggle={(id) => (figureIds = toggleMulti(figureIds, id))}
|
|
|
|
|
onCommit={commitReview}
|
|
|
|
|
on:commit={commitReview}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@@ -446,7 +785,7 @@
|
|
|
|
|
placeholder="Choose fig-* tags"
|
|
|
|
|
testid="fig-tag"
|
|
|
|
|
onToggle={(id) => (figTagIds = toggleMulti(figTagIds, id))}
|
|
|
|
|
onCommit={commitReview}
|
|
|
|
|
on:commit={commitReview}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@@ -455,21 +794,18 @@
|
|
|
|
|
<label class="lbl">feat-* tags <span class="sug">optional</span> <span class="ai">AI assist</span></label>
|
|
|
|
|
<MultiSelect
|
|
|
|
|
label="feat-* tags"
|
|
|
|
|
options={featTagOpts}
|
|
|
|
|
options={featTagOptsView}
|
|
|
|
|
selected={featTagIds}
|
|
|
|
|
placeholder="Choose feat-* tags"
|
|
|
|
|
testid="feat-tag"
|
|
|
|
|
onToggle={(id) => (featTagIds = toggleMulti(featTagIds, id))}
|
|
|
|
|
onCommit={commitReview}
|
|
|
|
|
on:commit={commitReview}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- #88: thickness band is deterministic from thickness_in — display-only, no owner pick. -->
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label class="lbl" for="thickness">Thickness band <span class="sug">from thickness</span></label>
|
|
|
|
|
<div id="thickness" class="ro" data-testid="thickness-band">{thicknessDisplay}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
|
|
|
|
|
|
|
|
|
<label class="lbl" for="moisture">Moisture</label>
|
|
|
|
|
<select id="moisture" class="sel" data-testid="moisture" bind:value={moistureId} on:change={commitReview}>
|
|
|
|
|
<option value="">— select —</option>
|
|
|
|
@@ -477,26 +813,39 @@
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Title / Description -->
|
|
|
|
|
<!-- Title / Short description + explicit "Create" build buttons (#89) -->
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label class="lbl" for="title">Title</label>
|
|
|
|
|
<input id="title" class="inp" data-testid="title" bind:value={title} />
|
|
|
|
|
<div class="create-row">
|
|
|
|
|
<input id="title" class="inp" data-testid="title" bind:value={title} />
|
|
|
|
|
<button type="button" class="create-btn" data-testid="create-title"
|
|
|
|
|
disabled={!canCreateTitle || createBusy} on:click={createTitle}>
|
|
|
|
|
{createBusy ? 'Building…' : 'Create title'}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label class="lbl" for="short-desc">Short description</label>
|
|
|
|
|
<input id="short-desc" class="inp" data-testid="short-desc" bind:value={shortDescription} />
|
|
|
|
|
<div class="create-row">
|
|
|
|
|
<input id="short-desc" class="inp" data-testid="short-desc" bind:value={shortDescription} />
|
|
|
|
|
<button type="button" class="create-btn" data-testid="create-short-desc"
|
|
|
|
|
disabled={!canCreateTitle || createBusy} on:click={createTitle}>
|
|
|
|
|
{createBusy ? 'Building…' : 'Create short desc'}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label class="lbl" for="desc">Description</label>
|
|
|
|
|
<textarea id="desc" class="inp ta" data-testid="desc" rows="3" bind:value={description} on:blur={commitReview}></textarea>
|
|
|
|
|
{#if canGenerateContent}
|
|
|
|
|
<textarea id="desc" class="inp ta" data-testid="desc" rows="3" bind:value={description} on:blur={commitDescription}></textarea>
|
|
|
|
|
{#if canCreateDesc}
|
|
|
|
|
<div class="gen">
|
|
|
|
|
<button type="button" class="gen-btn" data-testid="generate-text" on:click={generateContent} disabled={genBusy}>
|
|
|
|
|
{genBusy ? 'Writing…' : 'Generate text'}
|
|
|
|
|
<button type="button" class="gen-btn" data-testid="create-desc" on:click={generateContent} disabled={genBusy}>
|
|
|
|
|
{genBusy ? 'Writing…' : 'Create desc'}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if genError}<p class="nudge" role="alert">{genError}</p>{/if}
|
|
|
|
|
{#if createError}<p class="nudge" role="alert">{createError}</p>{/if}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Price / SKU (SKU last) -->
|
|
|
|
@@ -518,13 +867,16 @@
|
|
|
|
|
{#if reviewBusy}
|
|
|
|
|
<div class="status" data-testid="review-busy" aria-busy="true">Checking readiness…</div>
|
|
|
|
|
{:else if review}
|
|
|
|
|
<div class="status" class:ok={ready()} data-testid="ready-status">
|
|
|
|
|
{ready()
|
|
|
|
|
<div class="status" class:ok={ready() && lineupValid} data-testid="ready-status">
|
|
|
|
|
{ready() && lineupValid
|
|
|
|
|
? 'Ready to publish'
|
|
|
|
|
: `Not ready — ${review.missing.length} field${review.missing.length === 1 ? '' : 's'} remaining`}
|
|
|
|
|
: `Not ready — ${[
|
|
|
|
|
...review.missing,
|
|
|
|
|
...lineupMissing.map(roleLabel),
|
|
|
|
|
].length} field${[...review.missing, ...lineupMissing.map(roleLabel)].length === 1 ? '' : 's'} remaining`}
|
|
|
|
|
</div>
|
|
|
|
|
{#if !ready()}
|
|
|
|
|
<p class="missing" data-testid="missing-list">Missing: {review.missing.join(', ')}</p>
|
|
|
|
|
{#if !(ready() && lineupValid)}
|
|
|
|
|
<p class="missing" data-testid="missing-list">Missing: {[...review.missing, ...lineupMissing.map(roleLabel)].join(', ')}</p>
|
|
|
|
|
{/if}
|
|
|
|
|
{/if}
|
|
|
|
|
{#if reviewError}<p class="nudge" role="alert">{reviewError}</p>{/if}
|
|
|
|
@@ -535,10 +887,10 @@
|
|
|
|
|
type="button"
|
|
|
|
|
class="primary"
|
|
|
|
|
data-testid="continue-publish"
|
|
|
|
|
disabled={publishDisabled}
|
|
|
|
|
on:click={publish}
|
|
|
|
|
disabled={publishDisabled || !lineupValid || persistBusy}
|
|
|
|
|
on:click={goPublish}
|
|
|
|
|
>
|
|
|
|
|
Continue to Publish
|
|
|
|
|
{persistBusy ? 'Saving photos…' : 'Continue to Publish'}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
@@ -555,15 +907,40 @@
|
|
|
|
|
.ai-note { color: #aaa; font-size: .78rem; margin: 6px 0 0; }
|
|
|
|
|
.lbl { display: block; font-size: .8rem; color: #bbb; margin: 0 0 4px; }
|
|
|
|
|
.lbl .ai { margin-left: 6px; font-size: .58rem; font-weight: 700; padding: 1px 5px; border-radius: 2px; background: #00e5ff; color: #002; }
|
|
|
|
|
.inp, .sel { width: 100%; padding: 9px; background: #1d1d1d; border: 1px solid #444; border-radius: 3px; color: #eee; font-size: .9rem; text-align: left; }
|
|
|
|
|
/* #88 read-only thickness band: same chrome as .sel but non-interactive. */
|
|
|
|
|
.ro { width: 100%; padding: 9px; background: #141414; border: 1px solid #333; border-radius: 3px; color: #9ad0d8; font-size: .9rem; text-align: left; }
|
|
|
|
|
/* box-sizing: the app has no global reset, so a width:100% control with padding
|
|
|
|
|
and a border pokes out of its container by that padding+border (20px here) —
|
|
|
|
|
which becomes real page overflow whenever the column sits at the viewport edge
|
|
|
|
|
(measured: 375px mobile scrolled 20px). Border-box keeps the box inside. */
|
|
|
|
|
.inp, .sel { box-sizing: border-box; width: 100%; padding: 9px; background: #1d1d1d; border: 1px solid #444; border-radius: 3px; color: #eee; font-size: .9rem; text-align: left; }
|
|
|
|
|
.sel { appearance: none; background-image: linear-gradient(45deg,transparent 50%,#777 50%),linear-gradient(135deg,#777 50%,transparent 50%); background-position: calc(100% - 16px) 55%,calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
|
|
|
|
|
.ta { resize: vertical; }
|
|
|
|
|
.field { margin-bottom: 12px; }
|
|
|
|
|
.nudge { color: #e8a; font-size: .74rem; margin: 4px 0 0; }
|
|
|
|
|
.sug { color: #aaa; font-size: .74rem; font-weight: 400; margin-left: 6px; }
|
|
|
|
|
.gen { margin-top: 8px; } .gen-btn { padding: 8px 12px; border: 0; border-radius: 3px; background: #00e5ff; color: #002; font-weight: 600; font-size: .82rem; }
|
|
|
|
|
/* Lock chrome matches agreed #90 wireframe: muted dark green, not jarring neon. */
|
|
|
|
|
/* #89: explicit "Create" build buttons beside the title / short-desc fields. */
|
|
|
|
|
.create-row { display: flex; gap: 8px; align-items: stretch; }
|
|
|
|
|
.create-row .inp { flex: 1; }
|
|
|
|
|
.create-btn { box-sizing: border-box; padding: 8px 12px; border: 1px solid #333; border-radius: 3px;
|
|
|
|
|
background: #1d1d1d; color: #eee; font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
|
|
|
|
|
.create-btn:hover { background: #242424; }
|
|
|
|
|
.create-btn:disabled { background: #222; color: #666; border-color: #333; cursor: not-allowed; }
|
|
|
|
|
|
|
|
|
|
/* Primary wood category — inline under wood MultiSelect (REVIEW-15 / #90 wireframe). */
|
|
|
|
|
.primary-set { margin-top: 8px; padding: 10px 12px; border: 1px solid #333; border-radius: 3px; background: #141414; }
|
|
|
|
|
.primary-set .ps-lbl { font-size: .74rem; color: #9a9a9a; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
|
|
|
|
|
.primary-set .ps-req { font-size: .58rem; font-weight: 700; padding: 1px 5px; border-radius: 2px; background: #2a2a2a; color: #888; }
|
|
|
|
|
.ps-opt { box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 6px; margin: 0; border: 0; border-radius: 3px; background: transparent; color: #ddd; font-size: .88rem; cursor: pointer; text-align: left; }
|
|
|
|
|
.ps-opt:hover { background: #1c1c1c; }
|
|
|
|
|
.ps-opt.on { background: #12262b; color: #fff; }
|
|
|
|
|
.ps-opt:focus-visible { outline: 2px solid #00e5ff; outline-offset: 1px; }
|
|
|
|
|
.ps-radio { width: 14px; height: 14px; border: 2px solid #555; border-radius: 50%; flex: none; position: relative; }
|
|
|
|
|
.ps-opt.on .ps-radio { border-color: #00e5ff; }
|
|
|
|
|
.ps-opt.on .ps-radio::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: #00e5ff; }
|
|
|
|
|
.ps-name { flex: 1; }
|
|
|
|
|
.ps-tag { font-size: .56rem; font-weight: 700; padding: 0 4px; border-radius: 2px; background: #00e5ff; color: #002; letter-spacing: .3px; }
|
|
|
|
|
.ps-note { font-size: .7rem; color: #777; margin: 6px 0 0; line-height: 1.4; }
|
|
|
|
|
.status { margin-top: 14px; font-weight: 700; padding: 10px 12px; border-radius: 3px; background: #2a1512; color: #ffb4a2; font-size: .9rem; }
|
|
|
|
|
.status.ok { background: #122a12; color: #7fd37f; }
|
|
|
|
|
.missing { color: #999; font-size: .76rem; margin: 6px 0 0; }
|
|
|
|
@@ -572,4 +949,45 @@
|
|
|
|
|
.primary:disabled { background: #333; color: #777; }
|
|
|
|
|
.ghost { padding: 14px 18px; border-radius: 3px; border: 1px solid #444; background: transparent; color: #ccc; }
|
|
|
|
|
.err { color: #e88; } .busy { color: #aaa; }
|
|
|
|
|
|
|
|
|
|
/* #90 Photo strip */
|
|
|
|
|
.photos { margin: 14px 0 4px; }
|
|
|
|
|
.ph-hint { color: #8a8a8a; font-size: .72rem; margin: 0 0 8px; }
|
|
|
|
|
.ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
|
|
|
|
|
@media (max-width: 420px) { .ph-grid { grid-template-columns: repeat(2, 1fr); } }
|
|
|
|
|
.pcard { position: relative; aspect-ratio: 1; border: 2px solid #2a2a2a; border-radius: 3px; overflow: hidden; cursor: grab;
|
|
|
|
|
/* Gray checkerboard, matching the Capture lineup (MeasurePanel .lineup-item.png)
|
|
|
|
|
so transparent inventory PNGs read the same on both screens (bug2). */
|
|
|
|
|
background-color: #eee;
|
|
|
|
|
background-image: linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);
|
|
|
|
|
background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; }
|
|
|
|
|
.pcard:active { cursor: grabbing; }
|
|
|
|
|
.pcard:focus-visible { outline: 2px solid #00e5ff; outline-offset: 2px; }
|
|
|
|
|
.pcard.kept { border-color: #444; }
|
|
|
|
|
.pcard.primary { border-color: #00e5ff; }
|
|
|
|
|
.pcard:not(.kept) { opacity: .4; }
|
|
|
|
|
.ph-thumb { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
|
|
|
|
|
.ph-pri { position: absolute; top: 6px; right: 6px; background: #00e5ff; color: #002; font-size: .56rem; font-weight: 800; padding: 1px 5px; border-radius: 2px; letter-spacing: .03em; pointer-events: none; }
|
|
|
|
|
.ph-req { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); background: #ffb020; color: #201500; font-size: .52rem; font-weight: 800; padding: 1px 5px; border-radius: 2px; letter-spacing: .04em; pointer-events: none; }
|
|
|
|
|
.ph-seq { position: absolute; bottom: 6px; left: 6px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: .66rem; display: flex; align-items: center; justify-content: center; pointer-events: none; }
|
|
|
|
|
.ph-keep { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border: 2px solid #fff; border-radius: 3px; background: rgba(0,0,0,.5); pointer-events: none; }
|
|
|
|
|
.pcard.kept .ph-keep { background: #00e5ff; border-color: #00e5ff; }
|
|
|
|
|
.pcard.kept .ph-keep::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #002; border-width: 0 2px 2px 0; transform: rotate(45deg); }
|
|
|
|
|
/* Mandatory photos (clean cal + dimension-overlay): the keep checkbox is
|
|
|
|
|
checked AND disabled. A bold padlock glyph in the box signals "required —
|
|
|
|
|
cannot be removed", and the card carries a thin required outline so the
|
|
|
|
|
owner can tell mandatory photos apart from optional batch photos. */
|
|
|
|
|
.pcard.required { border-color: #00e5ff55; }
|
|
|
|
|
.pcard.required .ph-keep { background: #00e5ff; border-color: #00e5ff; }
|
|
|
|
|
/* Padlock: shackle (arc) + body, drawn large enough to read on a 16px box. */
|
|
|
|
|
.pcard.required .ph-keep::after {
|
|
|
|
|
content: ''; position: absolute; left: 3px; top: 2px; width: 8px; height: 8px;
|
|
|
|
|
border: 2px solid #002; border-bottom: none; border-radius: 4px 4px 0 0;
|
|
|
|
|
}
|
|
|
|
|
.pcard.required .ph-keep::before {
|
|
|
|
|
content: ''; position: absolute; left: 2.5px; top: 6px; width: 8px; height: 6px;
|
|
|
|
|
background: #002; border-radius: 1px;
|
|
|
|
|
}
|
|
|
|
|
.pcard.required { cursor: default; }
|
|
|
|
|
.ph-nudge { color: #e8a; font-size: .74rem; margin: 8px 0 0; }
|
|
|
|
|
</style>
|
|
|
|
|