feat(signage): widget settings regrouped (main / Text and colours / More), alignment that lines up multi-line widgets, multi-line texts, gallery title, logos larger than the slide; calibration past the recognised resolution and shown the first time
Owner review 2026-11-23 of every widget: - A widget card is its main settings (the row and what needs room under it: pictures, a gallery's pictures or folder, weather details and place, a countdown's start and end, reviews' stars and author, a scrolling text's speed, a shape's colours and border, QR caption), then "Text and colours" (new LookFields.jsx: text colour, plate, font, style, size, weight, highlight, shadow, QR colours; a logo's / gallery's border), then More settings (opacity, rotation, animation, fit, typing, blink, QR logo; shadow / border only where there is no Text and colours). - Date format / separator and clock 12/24 / separator are main settings. - Alignment only where it lines something up; the TV now aligns the lines of a text, the hours (centre: days and times meet in the middle), contact rows, Wi-Fi (code left / right / above), the weather's column / card / list / hourly, reviews (stars too), a countdown, a QR caption. - Text and message: a 2-line textarea in its own row; Enter makes new lines (the TV sizes by the longest line and the number of lines). - Gallery: a title above or below the pictures (title_position). - A widget's box may reach 400 % of the slide (a logo zoomed in past the slide's edges saved again). - "Auto" stays "Auto" in Greek; scrolling text Left / Right; reviews' stars choice no longer clipped; countdown "When it ends" hint as an info tip (fields level). Calibration: an edge may go past the recognised window (down to -2000 px); the dialog's rows are centred, "Each click moves" sits above its choice, the window size is labelled "Recognised resolution" with what it means; the TV asks for its screen answer on every calibrate event and while calibrating (the outline shows the first time), the dialog sends "on" again after 1.5 s. NumberInput takes a leading minus when min < 0. E2E: waits for the Add-a-slide dialog to go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,11 +11,14 @@ const Icon = ({ d }) => (
|
||||
* <NumberInput value={seconds} min={1} max={3600} onChange={setSeconds} suffix="s" />
|
||||
* The field may be emptied while typing: onChange(null). The form shows its own error for an empty
|
||||
* value and keeps it from being saved. A value over `max` is brought down; under `min`, brought up
|
||||
* when the field is left. Inside a <Field> it takes the field's id.
|
||||
* when the field is left. Inside a <Field> it takes the field's id. With a `min` below 0 a minus
|
||||
* may be typed in front (2026-11-23).
|
||||
*/
|
||||
export function NumberInput({ value, onChange, min = 0, max = Infinity, step = 1, suffix, size = 'md', invalid = false, disabled = false, className, id, ...rest }) {
|
||||
const labels = useLabels()
|
||||
const [focus, setFocus] = useState(false)
|
||||
const [draft, setDraft] = useState(null) // "-" typed, no digits yet
|
||||
const signed = min < 0
|
||||
const n = value === '' || value == null ? null : Number(value)
|
||||
const clamp = v => Math.min(max, Math.max(min, v))
|
||||
const stepBy = d => onChange?.(clamp((n ?? min) + d))
|
||||
@@ -24,14 +27,16 @@ export function NumberInput({ value, onChange, min = 0, max = Infinity, step = 1
|
||||
<button type="button" className="x-number__btn" onClick={() => stepBy(-step)} disabled={disabled || (n != null && n <= min)} aria-label={labels.decrease} tabIndex={-1}>
|
||||
<Icon d="M5 12h14" />
|
||||
</button>
|
||||
<input id={id} type="text" inputMode="numeric" className="x-number__input" value={n == null ? '' : String(n)} disabled={disabled}
|
||||
<input id={id} type="text" inputMode={signed ? 'text' : 'numeric'} className="x-number__input" value={draft ?? (n == null ? '' : String(n))} disabled={disabled}
|
||||
aria-invalid={invalid || undefined}
|
||||
onChange={e => {
|
||||
const minus = signed && /^\s*-/.test(e.target.value)
|
||||
const digits = e.target.value.replace(/\D/g, '')
|
||||
onChange?.(digits === '' ? null : Math.min(max, Number(digits)))
|
||||
setDraft(minus && digits === '' ? '-' : null)
|
||||
onChange?.(digits === '' ? null : Math.min(max, (minus ? -1 : 1) * Number(digits)))
|
||||
}}
|
||||
onFocus={() => setFocus(true)}
|
||||
onBlur={() => { setFocus(false); if (n != null && n < min) onChange?.(min) }}
|
||||
onBlur={() => { setFocus(false); setDraft(null); if (n != null && n < min) onChange?.(min) }}
|
||||
onKeyDown={e => {
|
||||
if (e.key === 'ArrowUp') { e.preventDefault(); stepBy(step) }
|
||||
if (e.key === 'ArrowDown') { e.preventDefault(); stepBy(-step) }
|
||||
|
||||
Reference in New Issue
Block a user