Files
ELM/src/elm/pages/SeatingPlanPage.py
T
David Rodenkirchen 5d422a9863 migrate seaing plan
2026-05-23 01:49:17 +02:00

30 lines
947 B
Python

from __future__ import annotations
from typing import Optional
from rio import Component, page, Rectangle, PointerEvent, ProgressCircle, Row
from rio.event import on_populate
from elm.components import SeatingPlan
from elm.types import Seat
@page(name="Seating Plan", url_segment="seating")
class SeatingPlanPage(Component):
preloaded_seats: Optional[list[Seat]] = None
@on_populate
async def on_populate(self) -> None:
self.preloaded_seats = await Seat.find_all().to_list()
def build(self) -> Component:
return Rectangle(
content=Row(ProgressCircle(), margin=self.session.screen_width // 6) if self.preloaded_seats is None else SeatingPlan(margin=0, preloaded_seats=self.preloaded_seats),
fill=self.session.theme.box_color,
stroke_width = 0.1,
stroke_color = self.session.theme.box_border_color,
margin_left=1,
margin_top=1
)