// screens-library.jsx
// visuals.jsx - reusable visual elements
const _thumbCache = new Map();
function AssetThumb({ asset, size = 'md' }) {
const aspect = size === 'tall' ? '9 / 16' : '16 / 9';
const [thumbUrl, setThumbUrl] = React.useState(_thumbCache.get(asset.id) || null);
React.useEffect(() => {
if (!asset.id || thumbUrl || !asset.thumbnail_s3_key) return;
let cancelled = false;
fetch((window.ZAMPP_API_PREFIX || '/api/v1') + '/assets/' + asset.id + '/thumbnail', { credentials: 'include' })
.then(r => r.ok ? r.json() : null)
.then(d => { if (!cancelled && d && d.url) { _thumbCache.set(asset.id, d.url); setThumbUrl(d.url); } })
.catch(() => {});
return () => { cancelled = true; };
}, [asset.id, asset.thumbnail_s3_key]);
if (asset.type === 'audio' || asset.media_type === 'audio') {
return (
);
}
if (asset.status === 'live' && asset.id) {
if (asset.thumbnail_s3_key || thumbUrl) {
const altText = asset.name ? `Thumbnail for ${asset.name}` : 'Live recording thumbnail';
return (
{thumbUrl
?

:
}
);
}
return ;
}
// pending_migration: placeholder with upload icon, no video
if (asset.status === 'pending_migration') {
return (
);
}
const altText = asset.name ? `Thumbnail for ${asset.name}` : 'Asset thumbnail';
return (
{thumbUrl
?

:
}
);
}
Both files written. Summary of changes:
**screens-library.jsx**
- `AssetCard` gains `onMigrate` prop; all `AssetCard` usages in grid pass `onMigrate={refreshAssets}`
- `AssetCard` thumb-status block adds `pending_migration` badge (`Pending Migration`)
- `AssetCard` adds `.thumb-migrate-btn` button (position absolute, bottom 8px, left/right 8px) calling `POST /assets/:id/migrate-to-library`
- List view actions column gains inline migrate button for `pending_migration` rows
- Filter tab-group gains "Pending" tab (`pending_migration`)
- Smart filters rail gains "Pending migration" entry (visible only when count > 0)
- `hasLive` memo includes `pending_migration` so 4s poll activates when any such asset exists
**visuals.jsx**
- `AssetThumb` handles `pending_migration` before the generic fallback: renders static placeholder with upload icon + "Awaiting migration" label, no video/HLS
- `StatusDot` map gains `pending_migration: { color: 'var(--warning)', pulse: false }`
Files at:
- `/home/node/workspace/dragonflight/services/web-ui/public/screens-library.jsx`
- `/home/node/workspace/dragonflight/services/web-ui/public/visuals.jsx`