feat(signage): menu look part by part, board-only names, stack bar, Delete key (owner review 3)
- Menus (slides and widgets): headings / names / prices each with size, colour, font, bold / italic / underline and alignment; dots size, colour and style; line and letter spacing; photo size and shape (menuLook) - Names aligned right end together, prices in a page-wide column - Names for one board only (names, category_names) with a pencil on the board's list; the catalogue name stays for the waiters - Fixed: menu lists inherited the page's fixed line height (big text overlapped); a menu slide's list grew past the screen (no 2nd column) - Stacks: parts sized by dragging the lines on the bar; "Add a widget" - Delete / Backspace removes the picked widget Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,34 @@ Position = Literal["top-left", "top-center", "top-right", "bottom-left", "bottom
|
||||
|
||||
|
||||
Badge = Literal["new", "chef", "offer", "popular", "spicy", "vegetarian", "vegan"]
|
||||
Align = Literal["left", "center", "right"]
|
||||
|
||||
|
||||
class TextStyle(_Strict):
|
||||
"""How a menu's headings, product names or prices look (owner review 3, 2026-11-21). Empty
|
||||
values follow the board: its text size and font, the text colour (names) or the accent colour
|
||||
(headings, prices)."""
|
||||
size: Optional[int] = Field(default=None, ge=50, le=300) # % like the board's text size
|
||||
colour: Optional[str] = Field(default=None, pattern=HEX)
|
||||
font: Optional[Font] = None
|
||||
bold: bool = True
|
||||
italic: bool = False
|
||||
underline: bool = False
|
||||
align: Optional[Align] = None # None: names left, prices right, headings as the list
|
||||
|
||||
|
||||
class DotStyle(_Strict):
|
||||
"""The line between a product's name and its price."""
|
||||
size: int = Field(default=100, ge=50, le=300)
|
||||
colour: Optional[str] = Field(default=None, pattern=HEX) # None: the text colour, faint
|
||||
style: Literal["dotted", "dashed", "solid", "none"] = "dotted"
|
||||
|
||||
|
||||
def _names(v: dict) -> dict:
|
||||
if any(not k.isdigit() for k in v):
|
||||
raise ValueError("names are keyed by id")
|
||||
out = {k: " ".join(str(x).split())[:80] for k, x in v.items()}
|
||||
return {k: x for k, x in out.items() if x}
|
||||
|
||||
|
||||
class MenuList(_Strict):
|
||||
@@ -107,6 +135,23 @@ class MenuList(_Strict):
|
||||
text_colour: str = Field(default="#ffffff", pattern=HEX)
|
||||
accent_colour: str = Field(default="#f59e0b", pattern=HEX) # prices, headings, badges
|
||||
text_size: int = Field(default=100, ge=50, le=250)
|
||||
# the look of each part (owner review 3, 2026-11-21)
|
||||
heading_style: TextStyle = Field(default_factory=TextStyle)
|
||||
item_style: TextStyle = Field(default_factory=TextStyle)
|
||||
price_style: TextStyle = Field(default_factory=TextStyle)
|
||||
dot_style: DotStyle = Field(default_factory=DotStyle)
|
||||
line_height: Optional[float] = Field(default=None, ge=0.8, le=3) # × the text; None = auto
|
||||
letter_spacing: Optional[float] = Field(default=None, ge=-0.1, le=0.5) # em; None = auto
|
||||
photo_size: int = Field(default=100, ge=50, le=250)
|
||||
photo_shape: Literal["square", "rounded", "round"] = "rounded"
|
||||
# this board's own names (the menu's "official" names; the catalogue keeps its own)
|
||||
names: Dict[str, str] = Field(default_factory=dict) # product id → name
|
||||
category_names: Dict[str, str] = Field(default_factory=dict) # category id → name
|
||||
|
||||
@field_validator("names", "category_names")
|
||||
@classmethod
|
||||
def _own_names(cls, v):
|
||||
return _names(v)
|
||||
|
||||
@field_validator("sales_point")
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user