fix(review): #90 clean cal + dimension-overlay are mandatory (checked + disabled)
REVIEW-5 requires both the clean calibration photo and its dimension-overlay copy to ship. Their keep checkbox is now checked AND disabled (aria-disabled, a lock glyph, cursor:default, tap is a no-op) so the owner can't remove them. Only batch photos are removable. The submission minimum can no longer be broken by the owner, so publish is never lineup-blocked by a missing required photo.
This commit is contained in:
@@ -147,6 +147,10 @@
|
||||
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;
|
||||
@@ -197,6 +201,10 @@
|
||||
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,
|
||||
@@ -219,7 +227,12 @@
|
||||
// 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) => (p.id === id ? { ...p, kept: !p.kept } : p));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -524,12 +537,15 @@
|
||||
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.kept}
|
||||
aria-label="{roleLabel(p.role)}{p.kept ? ', kept' : ', removed'}"
|
||||
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); } }}
|
||||
@@ -542,7 +558,9 @@
|
||||
<span class="ph-pri">PRIMARY</span>
|
||||
{/if}
|
||||
<span class="ph-seq" aria-hidden="true">{i + 1}</span>
|
||||
<span class="ph-keep" aria-hidden="true"></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>
|
||||
@@ -810,5 +828,14 @@
|
||||
.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 — it can't be unchecked, and a small lock glyph
|
||||
signals "required, cannot be removed". The card keeps full opacity even
|
||||
though it's always kept, and the cursor shows it's not a remove target. */
|
||||
.pcard.required { border-color: #2a2a2a; }
|
||||
.pcard.required .ph-keep { background: #00e5ff; border-color: #00e5ff; }
|
||||
.pcard.required .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); }
|
||||
.pcard.required .ph-keep::before { content: ''; position: absolute; left: 2.5px; top: 5px; width: 7px; height: 5px; border: 1.5px solid #002; border-radius: 1px; }
|
||||
.pcard.required { cursor: default; }
|
||||
.ph-nudge { color: #e8a; font-size: .74rem; margin: 8px 0 0; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user