setQ(e.target.value)}
onKeyDown={(e) => { if (e.key === 'Escape' && q) { e.preventDefault(); setQ(''); } }}
placeholder="Filter by filename… (e.g. lifestyle, before-, popart, ziggy)"
style={{
width: '100%', padding: '10px 36px 10px 12px', borderRadius: 8, boxSizing: 'border-box',
border: '1px solid var(--rule)', font: 'inherit', color: 'var(--ink)', background: '#fff',
}}
/>
{q && (
setQ('')}
aria-label="Clear search"
title="Clear (Esc)"
style={{
position: 'absolute', top: '50%', right: 8, transform: 'translateY(-50%)',
width: 22, height: 22, borderRadius: '50%', border: 'none', padding: 0,
background: 'var(--rule)', color: 'var(--ink)', cursor: 'pointer',
display: 'flex', alignItems: 'center', justifyContent: 'center',
fontSize: 14, lineHeight: 1,
}}
onMouseEnter={(e) => { e.currentTarget.style.background = 'var(--ink-soft)'; e.currentTarget.style.color = '#fff'; }}
onMouseLeave={(e) => { e.currentTarget.style.background = 'var(--rule)'; e.currentTarget.style.color = 'var(--ink)'; }}
>
×
)}
{(['portraits', 'all'] as const).map((s) => (
setScope(s)}
style={{
padding: '9px 13px', borderRadius: 8, cursor: 'pointer', fontSize: 13,
border: '1px solid var(--rule)',
background: scope === s ? 'var(--ink)' : 'transparent',
color: scope === s ? 'var(--cream)' : 'var(--ink)',
}}
>
{s === 'portraits' ? `Portraits (${portraitCount})` : `All images (${images.length})`}
))}
Showing {Math.min(limit, filtered.length)} of {filtered.length}
{q ? ` matching “${q}”` : ''}. Click a filename to copy it.
{error && (
{error}
setError(null)} style={{ ...btn, padding: '3px 8px' }}>dismiss
)}
{shown.map((im) => {
const name = fileName(im.id);
const url = `${deliveryBase}/${im.id}/public`;
return (
{/* eslint-disable-next-line @next/next/no-img-element */}
{/* Top-right delete affordance — small circle, semi-transparent so it
never fights with the image. Sits as a sibling of the link so the
button click doesn't bubble into the new-tab navigation. */}
remove(im.id)}
disabled={deleting === im.id}
title={`Delete ${name} from the CDN`}
aria-label={`Delete ${name}`}
style={{
position: 'absolute',
top: 8,
right: 8,
width: 26,
height: 26,
borderRadius: '50%',
border: 'none',
background: deleting === im.id ? 'rgba(31, 26, 22, 0.55)' : 'rgba(31, 26, 22, 0.72)',
color: '#fff',
cursor: deleting === im.id ? 'wait' : 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 17,
lineHeight: 1,
fontWeight: 400,
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.35)',
padding: 0,
zIndex: 2,
}}
onMouseEnter={(e) => { if (deleting !== im.id) e.currentTarget.style.background = 'var(--rose-deep)'; }}
onMouseLeave={(e) => { if (deleting !== im.id) e.currentTarget.style.background = 'rgba(31, 26, 22, 0.72)'; }}
>
{deleting === im.id ? '…' : '×'}
{pinterestReady && (
openPin(im)}
title={`Pin ${name} to Pinterest`}
aria-label={`Pin ${name} to Pinterest`}
style={{
position: 'absolute',
top: 8,
right: 42,
width: 26,
height: 26,
borderRadius: '50%',
border: 'none',
background: 'rgba(31, 26, 22, 0.72)',
color: '#fff',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 13,
lineHeight: 1,
fontWeight: 700,
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.35)',
padding: 0,
zIndex: 2,
}}
onMouseEnter={(e) => { e.currentTarget.style.background = '#bd081c'; }}
onMouseLeave={(e) => { e.currentTarget.style.background = 'rgba(31, 26, 22, 0.72)'; }}
>
P
)}
copy(name, im.id)}
title="Click to copy filename"
style={{ all: 'unset', cursor: 'pointer', display: 'block', width: '100%', fontSize: 12, lineHeight: 1.35, color: 'var(--ink)', wordBreak: 'break-all' }}
>
{name}
{copied === im.id ? 'name copied ✓' : 'click name ↑'}
copy(url, `${im.id}:url`)} style={btn} disabled={deleting === im.id}>
{copied === `${im.id}:url` ? 'copied ✓' : 'copy URL'}
);
})}
{limit < filtered.length && (
<>
setLimit((l) => l + BATCH)} style={{ ...btn, padding: '9px 16px', fontSize: 13 }}>
Load more ({filtered.length - limit} left)
>
)}
{filtered.length === 0 && (
No images match “{q}”.
)}
{/* Pinterest pin modal — small bottom-anchored sheet so the admin can
tweak title/description and pick a board before pinning. Boards are
fetched lazily the first time the modal opens. */}
{pinTarget && (
{ if (e.target === e.currentTarget) closePinModal(); }}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
Pin to Pinterest
{fileName(pinTarget.id)}
×
{pinSuccess ? (
) : (
{pinError && (
Pinterest rejected the pin
{pinError}
)}
Board
{boardsLoading && Loading your boards…
}
{boardsError && {boardsError}
}
{boards && (
setBoardId(e.target.value)}
disabled={pinning}
style={{ marginTop: 5, width: '100%', padding: '9px 10px', borderRadius: 8, border: '1px solid var(--rule)', font: 'inherit', background: '#fff' }}
>
{boards.length === 0 && (no boards — create one on Pinterest first) }
{boards.map((b) => {b.name} )}
)}
Title
setPinTitle(e.target.value)}
maxLength={100}
disabled={pinning}
style={{ marginTop: 5, width: '100%', padding: '9px 10px', borderRadius: 8, border: '1px solid var(--rule)', font: 'inherit', boxSizing: 'border-box' }}
/>
Description
Link
setPinLink(e.target.value)}
disabled={pinning}
placeholder="https://www.lumengesso.com/…"
style={{ marginTop: 5, width: '100%', padding: '9px 10px', borderRadius: 8, border: '1px solid var(--rule)', font: 'inherit', boxSizing: 'border-box' }}
/>
Cancel
{pinning ? 'Pinning…' : 'Pin to Pinterest'}
)}
)}
);
}