feat(signage): gallery widget (pictures and videos one after another, from a list or a media folder); media folders on the Media page

Folders are only a grouping in the database (media_folders, media.folder_id, Alembic
0046): made, renamed, deleted (files stay) on the Media page, a file filed from its
details, uploads go into the folder shown, the picker filters by folder. The gallery
widget: its own pictures/videos in order or a folder as it is now, seconds each,
fade / slide / zoom, cover / contain. Plan 6R.16, F-114.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 14:41:17 +02:00
co-authored by Claude Opus 5.5
parent 189bd2777b
commit 1eb7e5e3a9
24 changed files with 549 additions and 51 deletions
+7 -2
View File
@@ -589,19 +589,24 @@ try {
contact: { phone: '2310 123456', instagram: '@xenia' } } })
await api('PUT', '/api/signage/reviews', { token: boss, body: { reviews: [{ name: 'Maria', stars: 5, text: 'Best octopus on the island' }, { name: 'Bob', stars: 2, text: 'Meh' }] } })
await api('PUT', '/api/identity/hours', { token: boss, body: { days: [[{ from: '12:00', to: '23:00' }], [], [], [], [], [], []] } })
const dishes = await api('POST', '/api/media/folders', { token: boss, body: { name: 'Dishes' } })
await api('POST', '/api/media/move', { token: boss, body: { ids: [photo.id], folder_id: dishes.id } })
const wl = await api('POST', '/api/signage/playlists', { token: boss, body: { name: 'New widgets', orientation: 'landscape' } })
await api('POST', `/api/signage/playlists/${wl.id}/slides`, { token: boss, body: { kind: 'blank', duration_s: 60, content: { widgets: [
{ kind: 'shape', position: 'custom', box: { x: 2, y: 2, w: 10, h: 15 }, shape: 'star' },
{ kind: 'countdown', position: 'top-center', countdown_to: '2099-01-01T00:00', text: 'Opening in' },
{ kind: 'hours', position: 'top-left' }, { kind: 'wifi', position: 'bottom-right' }, { kind: 'contact', position: 'bottom-left' },
{ kind: 'ticker', position: 'top-bar', text: 'Fresh fish today' },
{ kind: 'reviews', position: 'custom', box: { x: 30, y: 40, w: 40, h: 25 } }] } } })
{ kind: 'reviews', position: 'custom', box: { x: 30, y: 40, w: 40, h: 25 } },
{ kind: 'gallery', position: 'custom', box: { x: 75, y: 30, w: 20, h: 20 }, gallery_source: 'folder', gallery_folder: dishes.id }] } } })
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { playlist_id: wl.id } })
const widgetsOn = async () => (await Promise.all(['shape', 'countdown', 'hours', 'wifi', 'contact', 'ticker', 'reviews'].map(k => tv.getByTestId(`signage-w-${k}`).count()))).every(n => n === 1)
const widgetsOn = async () => (await Promise.all(['shape', 'countdown', 'hours', 'wifi', 'contact', 'ticker', 'reviews', 'gallery'].map(k => tv.getByTestId(`signage-w-${k}`).count()))).every(n => n === 1)
r.check('6R.15: a shape, a countdown, the opening hours, Wi-Fi (from the identity), contact details and a scrolling text on the TV',
await waitFor(async () => (await widgetsOn()) || null, 15_000, 300) === true)
r.check('6R.15: the Wi-Fi widget carries the code that joins the network', (await tv.getByTestId('signage-w-wifi').textContent()).includes('Xenia Guests')
&& await tv.getByTestId('signage-w-wifi').locator('svg').count() > 0)
r.check('6R.16: a gallery of a media folder shows its picture (kept on the TV)', await tv.getByTestId('signage-w-gallery').getAttribute('data-count') === '1'
&& (await tv.getByTestId('signage-w-gallery').locator('img').getAttribute('src')).startsWith('blob:'))
r.check('6R.19: a review typed in by hand shows (the 2-star one is left out)', await tv.getByTestId('signage-w-reviews').getAttribute('data-count') === '1'
&& (await tv.getByTestId('signage-w-reviews').textContent()).includes('Best octopus'))
r.check('6R.15: the countdown runs (days left to 2099)', /^\d+d \d\d:\d\d:\d\d$/.test((await tv.getByTestId('signage-w-countdown').textContent()).replace('Opening in', '').trim()))