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
+2 -1
View File
@@ -174,7 +174,8 @@
"unreadable": "Αυτή η εικόνα δεν διαβάζεται. Αποθηκεύστε τη ξανά ως JPG ή PNG και ανεβάστε τη.",
"in_use": "Αυτό το αρχείο χρησιμοποιείται από: {{uses}}. Αφαιρέστε το πρώτα από εκεί.",
"not_a_picture": "Εδώ διαλέξτε εικόνα, όχι βίντεο.",
"builtin": "Οι ενσωματωμένες εικόνες δεν διαγράφονται ούτε μετονομάζονται."
"builtin": "Οι ενσωματωμένες εικόνες δεν διαγράφονται ούτε μετονομάζονται.",
"folder_unknown": "Αυτός ο φάκελος δεν υπάρχει πια στη βιβλιοθήκη πολυμέσων."
},
"caller_id": {
"key_invalid": "Το κλειδί του τηλεφωνικού κέντρου λείπει ή είναι λάθος."
+34 -2
View File
@@ -1215,7 +1215,10 @@
"usedCantDelete": "Ένα αρχείο σε χρήση δεν διαγράφεται. Αφαιρέστε το πρώτα από εκεί.",
"uses": {
"product": "Προϊόν",
"category": "Κατηγορία"
"category": "Κατηγορία",
"identity": "Το λογότυπο του καταστήματος",
"signage_slide": "Διαφάνεια σήμανσης",
"signage_saved_slide": "Αποθηκευμένη διαφάνεια"
},
"pickTitle": "Επιλογή εικόνας",
"photo": "Φωτογραφία",
@@ -1246,6 +1249,19 @@
"waiting": "Σε αναμονή…",
"working": "Ετοιμάζεται {{progress}}%",
"failed": "Δεν ετοιμάστηκε"
},
"folders": {
"title": "Φάκελοι",
"all": "Όλα",
"none": "Χωρίς φάκελο",
"new": "Νέος φάκελος",
"rename": "Μετονομασία φακέλου",
"delete": "Διαγραφή φακέλου",
"deleteTitle": "Διαγραφή του φακέλου «{{name}}»;",
"deleteBody": "Τα αρχεία του μένουν στη βιβλιοθήκη, χωρίς φάκελο. Μια συλλογή που δείχνει αυτόν τον φάκελο δεν θα δείχνει τίποτα.",
"name": "Όνομα φακέλου",
"folder": "Φάκελος",
"moved": "Μετακινήθηκε"
}
},
"signage": {
@@ -1487,7 +1503,8 @@
"hours": "Ωράριο",
"wifi": "Wi-Fi",
"contact": "Στοιχεία επικοινωνίας",
"reviews": "Κριτικές"
"reviews": "Κριτικές",
"gallery": "Συλλογή"
},
"position": "Πού",
"size": "Μέγεθος",
@@ -1675,6 +1692,21 @@
"missing": "Δεν υπάρχουν κριτικές ακόμη: το widget μένει κρυφό.",
"hint": "Οι κριτικές που καταχωρίσατε, μία κάθε φορά.",
"where": "Προσθέστε τις στο Ψηφιακή σήμανση → Μήνυμα & ρυθμίσεις"
},
"gallery": {
"source": "Δείχνει",
"sources": {
"pictures": "Επιλεγμένες εικόνες",
"folder": "Έναν φάκελο"
},
"seconds": "Καθεμία για",
"folder": "Φάκελος",
"folderHint": "Ό,τι υπάρχει τώρα στον φάκελο, και ό,τι προσθέσετε αργότερα.",
"noFolder": "Διαλέξτε φάκελο",
"noFolders": "Δεν υπάρχουν φάκελοι πολυμέσων ακόμη.",
"toMedia": "Φτιάξτε έναν στη σελίδα Πολυμέσα",
"add": "Προσθήκη εικόνων ή βίντεο",
"empty": "Η συλλογή είναι άδεια ακόμη: μένει κρυφή."
}
},
"tabs": {
+2 -1
View File
@@ -174,7 +174,8 @@
"unreadable": "This picture can't be read. Save it again as JPG or PNG and upload it.",
"in_use": "This file is used by {{uses}}. Remove it there first.",
"not_a_picture": "Pick a picture here, not a video.",
"builtin": "Built-in pictures can't be deleted or renamed."
"builtin": "Built-in pictures can't be deleted or renamed.",
"folder_unknown": "That folder isn't in the media library any more."
},
"caller_id": {
"key_invalid": "The phone system's key is missing or wrong."
+34 -2
View File
@@ -1215,7 +1215,10 @@
"usedCantDelete": "A file in use can't be deleted. Remove it there first.",
"uses": {
"product": "Product",
"category": "Category"
"category": "Category",
"identity": "The venue's logo",
"signage_slide": "Signage slide",
"signage_saved_slide": "Saved slide"
},
"pickTitle": "Pick a picture",
"photo": "Photo",
@@ -1246,6 +1249,19 @@
"waiting": "Waiting…",
"working": "Preparing {{progress}}%",
"failed": "Not prepared"
},
"folders": {
"title": "Folders",
"all": "All",
"none": "In no folder",
"new": "New folder",
"rename": "Rename the folder",
"delete": "Delete the folder",
"deleteTitle": "Delete the folder \"{{name}}\"?",
"deleteBody": "Its files stay in the library, in no folder. A gallery that shows this folder will show nothing.",
"name": "Folder name",
"folder": "Folder",
"moved": "Moved"
}
},
"signage": {
@@ -1487,7 +1503,8 @@
"hours": "Opening hours",
"wifi": "Wi-Fi",
"contact": "Contact details",
"reviews": "Reviews"
"reviews": "Reviews",
"gallery": "Gallery"
},
"position": "Where",
"size": "Size",
@@ -1675,6 +1692,21 @@
"missing": "No reviews yet: the widget stays hidden.",
"hint": "The reviews you typed in, one at a time.",
"where": "Add them under Signage → Message & settings"
},
"gallery": {
"source": "Shows",
"sources": {
"pictures": "Chosen pictures",
"folder": "A folder"
},
"seconds": "Each for",
"folder": "Folder",
"folderHint": "Whatever is in the folder now, also what you add to it later.",
"noFolder": "Choose a folder",
"noFolders": "No media folders yet.",
"toMedia": "Make one on the Media page",
"add": "Add pictures or videos",
"empty": "Nothing in the gallery yet: it stays hidden."
}
},
"tabs": {
+35 -1
View File
@@ -175,7 +175,7 @@ const plate = (w, pad) => ({
...(w.background_colour ? { background: w.background_colour, borderRadius: cq(1.2), ...(pad ? { padding: `${cq(0.8)} ${cq(1.6)}` } : {}) } : {}),
})
// a menu, a stack, a shape or a scrolling text in a corner or a bar has no box of its own: it gets one of this size (cqmin)
const BOXED = { menu: [48, 56], stack: [60, 36], shape: [18, 18], ticker: [80, 7], reviews: [56, 24] }
const BOXED = { menu: [48, 56], stack: [60, 36], shape: [18, 18], ticker: [80, 7], reviews: [56, 24], gallery: [40, 30] }
/**
* The widgets of a slide: in their corners and bars, or (moved and sized by hand: position
@@ -336,6 +336,12 @@ function widgetBody(w, ctx, fit, path) {
if (w.kind === 'hours') return hoursBody(w, ctx, unit, text)
if (w.kind === 'wifi') return wifiBody(w, venue?.identity?.wifi, unit, text)
if (w.kind === 'contact') return contactBody(w, venue?.identity?.contact, unit, text)
if (w.kind === 'gallery') {
const ids = w.gallery_source === 'folder' ? (x.gallery || []) : (w.media_ids || [])
const items = ids.map(id => media(id)).filter(Boolean)
if (!items.length) return null
return boxed(<Gallery w={w} items={items} now={now} />, 'gallery')
}
if (w.kind === 'reviews') {
const list = (venue?.reviews || []).filter(r => r.stars >= (w.reviews_min || 4))
if (!list.length) return null
@@ -346,6 +352,34 @@ function widgetBody(w, ctx, fit, path) {
}
const STAR = '#fbbf24'
const GALLERY_IN = {
fade: [{ opacity: 0 }, { opacity: 1 }],
slide: [{ transform: 'translateX(100%)' }, { transform: 'translateX(0)' }],
zoom: [{ opacity: 0, transform: 'scale(1.12)' }, { opacity: 1, transform: 'scale(1)' }],
}
/** A gallery (6R.16): its pictures and videos one after another, each for its seconds, coming in with its transition. */
function Gallery({ w, items, now }) {
const i = pageAt(items.length, w.gallery_seconds || 5, now.getTime())
const m = items[i]
const el = useRef(null)
const frames = GALLERY_IN[w.gallery_transition || 'fade']
useEffect(() => {
if (!frames || !el.current?.animate) return undefined
const a = el.current.animate(frames, { duration: 700, easing: 'ease-out' })
return () => a.cancel()
}, [i, frames])
const fit = { width: '100%', height: '100%', objectFit: w.gallery_fit || 'cover', display: 'block' }
return (
<div style={{ width: '100%', height: '100%', overflow: 'hidden', position: 'relative' }} data-testid="signage-w-gallery" data-index={i} data-count={items.length}>
<div key={`${i}-${m.src}`} ref={el} style={{ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 }}>
{m.kind === 'video'
? <video src={m.src} poster={m.poster} muted autoPlay loop playsInline style={fit} />
: <img src={m.src} alt="" style={fit} />}
</div>
</div>
)
}
/**
* One of the venue's reviews (6R.19), the next one every few seconds: its stars, what they wrote,