feat(signage): reviews typed in by hand and their widget; Add a widget at the top of the widgets, the list in layers (new widgets on top)

Reviews (name, stars, text, date, where) under Signage -> Message & settings, shown
one at a time by the reviews widget (a minimum of stars, seconds each); not pulled
from Google (owner's choice). The widgets section: one "Add a widget" menu at its
top instead of a button per kind; the cards are layers, the top one drawn over the
others, so a new widget goes on top; the arrows bring forward / send backward.
Plan 6R.19, F-113.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 14:21:17 +02:00
co-authored by Claude Opus 5.5
parent f26e51273c
commit 189bd2777b
14 changed files with 339 additions and 52 deletions
+27 -3
View File
@@ -1486,7 +1486,8 @@
"countdown": "Αντίστροφη μέτρηση",
"hours": "Ωράριο",
"wifi": "Wi-Fi",
"contact": "Στοιχεία επικοινωνίας"
"contact": "Στοιχεία επικοινωνίας",
"reviews": "Κριτικές"
},
"position": "Πού",
"size": "Μέγεθος",
@@ -1512,7 +1513,7 @@
"seconds": "Με δευτερόλεπτα",
"weatherDays": "Μέρες",
"weatherNeedsInternet": "Ο καιρός χρειάζεται internet: χωρίς αυτό (ή χωρίς πόλη) το στοιχείο κρύβεται.",
"dragHint": "Συμβουλή: διαλέξτε ένα widget στην προεπισκόπηση ή εδώ και σύρετέ το (ή με τα βελάκια) για να το μετακινήσετε, και τις λαβές του για το μέγεθος· η θέση και το μέγεθος γράφουν τότε «Προσαρμοσμένο». Η σειρά: ένα επόμενο widget σχεδιάζεται πάνω από ένα προηγούμενο.",
"dragHint": "Η λίστα είναι σε επίπεδα: το widget στην κορυφή σχεδιάζεται πάνω από τα από κάτω, και ένα νέο widget μπαίνει στην κορυφή. Διαλέξτε ένα widget στην προεπισκόπηση ή εδώ, σύρετέ το (ή με τα βέλη) για να το μετακινήσετε και από τις λαβές για να αλλάξετε το μέγεθος· η θέση και το μέγεθος γράφουν τότε «Προσαρμοσμένο».",
"custom": "Προσαρμοσμένο",
"align": "Στοίχιση",
"alignAuto": "Αυτόματη",
@@ -1662,7 +1663,19 @@
"missing": "Κανένα από αυτά τα στοιχεία δεν έχει οριστεί ακόμη: το widget μένει κρυφό.",
"hint": "Τα στοιχεία έρχονται από την ταυτότητα του καταστήματος· τα κενά δεν εμφανίζονται."
},
"fromIdentity": "Ρυθμίσεις → Ταυτότητα"
"fromIdentity": "Ρυθμίσεις → Ταυτότητα",
"add": "Προσθήκη widget",
"forward": "Μπροστά (σχεδιάζεται πάνω από αυτό που είναι από πάνω του στη λίστα)",
"backward": "Πίσω (σχεδιάζεται κάτω από αυτό που είναι από κάτω του στη λίστα)",
"reviews": {
"min": "Μόνο κριτικές με",
"seconds": "Κάθε κριτική για",
"stars": "Τα αστέρια",
"name": "Ποιος την έγραψε",
"missing": "Δεν υπάρχουν κριτικές ακόμη: το widget μένει κρυφό.",
"hint": "Οι κριτικές που καταχωρίσατε, μία κάθε φορά.",
"where": "Προσθέστε τις στο Ψηφιακή σήμανση → Μήνυμα & ρυθμίσεις"
}
},
"tabs": {
"playlists": "Λίστες",
@@ -1922,6 +1935,17 @@
"outside": "Έξω από την εικόνα η τηλεόραση μένει μαύρη.",
"reset": "Ξανά όλη η οθόνη",
"done": "Τέλος"
},
"reviews": {
"title": "Κριτικές",
"hint": "Κριτικές που άφησαν οι πελάτες σας (στο Google, στο Tripadvisor…), καταχωρισμένες εδώ. Το widget κριτικών τις δείχνει μία κάθε φορά, μόνο τις καλύτερες αν θέλετε.",
"none": "Δεν υπάρχουν κριτικές ακόμη.",
"add": "Προσθήκη κριτικής",
"stars": "Αστέρια",
"text": "Τι έγραψαν",
"name": "Όνομα",
"source": "Πού",
"date": "Ημερομηνία"
}
},
"overview": {
+27 -3
View File
@@ -1486,7 +1486,8 @@
"countdown": "Countdown",
"hours": "Opening hours",
"wifi": "Wi-Fi",
"contact": "Contact details"
"contact": "Contact details",
"reviews": "Reviews"
},
"position": "Where",
"size": "Size",
@@ -1512,7 +1513,7 @@
"seconds": "With seconds",
"weatherDays": "Days",
"weatherNeedsInternet": "The weather needs internet: without it (or without a town set) the widget is hidden.",
"dragHint": "Tip: pick a widget on the preview or here, then drag it (or use the arrow keys) to move it and its handles to size it; where and size then read \"Custom\". The order: a later widget is drawn over an earlier one.",
"dragHint": "The list is in layers: the widget at the top is drawn over the ones below it, and a new widget goes on top. Pick a widget on the preview or here, then drag it (or use the arrow keys) to move it and its handles to size it; where and size then read \"Custom\".",
"custom": "Custom",
"align": "Alignment",
"alignAuto": "Auto",
@@ -1662,7 +1663,19 @@
"missing": "None of these contact details is set yet: the widget stays hidden.",
"hint": "The details come from the venue's identity; empty ones don't show."
},
"fromIdentity": "Settings → Identity"
"fromIdentity": "Settings → Identity",
"add": "Add a widget",
"forward": "Bring forward (drawn over the one above it in this list)",
"backward": "Send backward (drawn under the one below it in this list)",
"reviews": {
"min": "Only reviews with",
"seconds": "Each review for",
"stars": "The stars",
"name": "Who wrote it",
"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"
}
},
"tabs": {
"playlists": "Playlists",
@@ -1922,6 +1935,17 @@
"outside": "Outside the picture the TV stays black.",
"reset": "Whole screen again",
"done": "Done"
},
"reviews": {
"title": "Reviews",
"hint": "Reviews your guests left (on Google, Tripadvisor…), typed in here. The reviews widget shows them one at a time, the best ones if you choose.",
"none": "No reviews yet.",
"add": "Add a review",
"stars": "Stars",
"text": "What they wrote",
"name": "Name",
"source": "Where",
"date": "Date"
}
},
"overview": {
+44 -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] }
const BOXED = { menu: [48, 56], stack: [60, 36], shape: [18, 18], ticker: [80, 7], reviews: [56, 24] }
/**
* The widgets of a slide: in their corners and bars, or (moved and sized by hand: position
@@ -336,9 +336,52 @@ 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 === 'reviews') {
const list = (venue?.reviews || []).filter(r => r.stars >= (w.reviews_min || 4))
if (!list.length) return null
const r = list[pageAt(list.length, w.reviews_seconds || 8, now.getTime())]
return boxed(<ReviewBody w={w} r={r} fmt={fmt} n={list.length} />, 'reviews')
}
return null
}
const STAR = '#fbbf24'
/**
* One of the venue's reviews (6R.19), the next one every few seconds: its stars, what they wrote,
* who and where. It fills its place: the text is sized from the place's size and the review's length.
*/
function ReviewBody({ w, r, fmt, n }) {
const box = useRef(null)
const [size, setSize] = useState(null)
useEffect(() => {
const el = box.current
if (!el || typeof ResizeObserver === 'undefined') return undefined
const ro = new ResizeObserver(() => setSize(s => (s && s.w === el.clientWidth && s.h === el.clientHeight ? s : { w: el.clientWidth, h: el.clientHeight })))
ro.observe(el)
return () => ro.disconnect()
}, [])
const ts = (w.text_size || 100) / 100
const chars = r.text.length + 30
const f = size ? Math.max(6, Math.min(size.h / 4.2, Math.sqrt((0.55 * size.w * size.h) / (chars * 0.55 * 1.45))) * Math.min(1, ts)) : 0
const who = [w.reviews_name !== false && r.name, r.source, r.date && fmt.formatDate(`${r.date}T12:00:00Z`, 'date')].filter(Boolean).join(' · ')
const font = { ...(w.font ? { fontFamily: FONTS[w.font] } : {}), ...(w.italic ? { fontStyle: 'italic' } : {}) }
return (
<div ref={box} style={{ width: '100%', height: '100%', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: f * 0.35, ...font }}
data-testid="signage-w-reviews" data-count={n} data-name={r.name}>
{size && <>
{w.reviews_stars !== false && (
<div style={{ display: 'flex', gap: f * 0.15, justifyContent: 'inherit' }} aria-label={`${r.stars}/5`}>
{[1, 2, 3, 4, 5].map(i => <Star key={i} style={{ width: f * 1.1, height: f * 1.1, color: STAR, fill: i <= r.stars ? STAR : 'none', opacity: i <= r.stars ? 1 : 0.4 }} aria-hidden="true" />)}
</div>
)}
<div style={{ fontSize: f, lineHeight: 1.35, fontWeight: w.bold ? 700 : 500, ...(w.underline ? { textDecoration: 'underline' } : {}) }}>“{r.text}”</div>
{who && <div style={{ fontSize: f * 0.72, fontWeight: 700, opacity: 0.85 }}>— {who}</div>}
</>}
</div>
)
}
/** A shape (6R.15) filling its box: a rectangle (rounded corners) or circle as a box, the others as SVG corners; a fill or a gradient, a border. */
function ShapeBody({ w, id }) {
const fill = w.fill || '#f59e0b'