feat(manager): built-in collection in the Media page and picker; signage screen settings in Devices (platform-v2 step 5.4a)
Media page and picker filter Everything / Your own / Built-in; built-in items are marked and can't be renamed or deleted. The Devices page offers the playlists for a signage screen (with its orientation and rotation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import { useUploadQueue } from './mediaHooks'
|
||||
export default function MediaPage() {
|
||||
const { t } = useTranslation('manager')
|
||||
const [kind, setKind] = useState('')
|
||||
const [collection, setCollection] = useState('')
|
||||
const [q, setQ] = useState('')
|
||||
const [search, setSearch] = useState('')
|
||||
const [page, setPage] = useState(null)
|
||||
@@ -28,8 +29,8 @@ export default function MediaPage() {
|
||||
useEffect(() => { const h = setTimeout(() => setSearch(q.trim()), 250); return () => clearTimeout(h) }, [q])
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try { setPage(await listMedia({ kind, q: search })); setError(null) } catch (err) { setError(errorMessage(err, t)) }
|
||||
}, [kind, search, t])
|
||||
try { setPage(await listMedia({ kind, q: search, collection })); setError(null) } catch (err) { setError(errorMessage(err, t)) }
|
||||
}, [kind, search, collection, t])
|
||||
useEffect(() => { load() }, [load])
|
||||
|
||||
// Each finished upload shows at once; the list is read again when the batch is done.
|
||||
@@ -68,6 +69,8 @@ export default function MediaPage() {
|
||||
<Input value={q} onChange={e => setQ(e.target.value)} placeholder={t('media.search')} aria-label={t('media.search')}
|
||||
className="flex-1 sm:w-56" data-testid="media-search" />
|
||||
<Select value={kind} onChange={e => setKind(e.target.value)} options={kinds} aria-label={t('media.kind')} data-testid="media-kind" />
|
||||
<Select value={collection} onChange={e => setCollection(e.target.value)} aria-label={t('media.collection')} data-testid="media-collection"
|
||||
options={[{ value: '', label: t('media.collections.all') }, { value: 'own', label: t('media.collections.own') }, { value: 'builtin', label: t('media.collections.builtin') }]} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,7 +78,7 @@ export default function MediaPage() {
|
||||
|
||||
{error ? <EmptyState title={error} />
|
||||
: !page ? <div className="flex justify-center p-6"><Spinner /></div>
|
||||
: page.items.length === 0 ? <EmptyState title={t(search || kind ? 'media.noMatch' : 'media.empty')} description={search || kind ? undefined : t('media.emptyHint')} />
|
||||
: page.items.length === 0 ? <EmptyState title={t(search || kind || collection ? 'media.noMatch' : 'media.empty')} description={search || kind || collection ? undefined : t('media.emptyHint')} />
|
||||
: <>
|
||||
<p className="text-label text-ink-3" data-testid="media-count">{t('media.count', { count: page.total })}</p>
|
||||
<MediaGrid items={page.items} onOpen={item => setOpen(item.id)} />
|
||||
|
||||
Reference in New Issue
Block a user