migrate seaing plan
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user