From 041ddaa334c9f54ac1b141b88dc72b73d355758c Mon Sep 17 00:00:00 2001 From: David Rodenkirchen Date: Sat, 30 May 2026 11:43:18 +0200 Subject: [PATCH] Add participants page --- VERSION | 2 +- src/elm/components/NavigationBar.py | 1 + src/elm/pages/ParticipantsPage.py | 66 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/elm/pages/ParticipantsPage.py diff --git a/VERSION b/VERSION index d46e687..7ceb040 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.1git asd \ No newline at end of file +0.6.1 \ No newline at end of file diff --git a/src/elm/components/NavigationBar.py b/src/elm/components/NavigationBar.py index be02884..26fda23 100644 --- a/src/elm/components/NavigationBar.py +++ b/src/elm/components/NavigationBar.py @@ -94,6 +94,7 @@ class NavigationBar(Component): NavigationButton("material/house", "Startseite", "/", extension_state_changed=self.on_extension_pressed), NavigationButton("material/local_activity", "Tickets", "/tickets", extension_state_changed=self.on_extension_pressed), NavigationButton("material/chair_alt", "Sitzplan", "/seating", extension_state_changed=self.on_extension_pressed), + NavigationButton("material/group", "Teilnehmer", "/participants", extension_state_changed=self.on_extension_pressed), NavigationButton("material/local_dining", "Catering", "/catering", extension_state_changed=self.on_extension_pressed), NavigationButton("material/trophy", "Turniere", "/tournaments", extension_state_changed=self.on_extension_pressed), margin_bottom=6 diff --git a/src/elm/pages/ParticipantsPage.py b/src/elm/pages/ParticipantsPage.py new file mode 100644 index 0000000..dc13af3 --- /dev/null +++ b/src/elm/pages/ParticipantsPage.py @@ -0,0 +1,66 @@ +from __future__ import annotations + +from copy import copy +from typing import Any, Optional +from uuid import uuid4 + +from rio import Component, Column, Row, Text, Spacer, page, Color, Rectangle, TextInput, GuardEvent +from rio.event import on_populate + +from elm.types import UserSession, User, Ticket, Seat +from elm.services import UserService, LocalData, LocalDataService, ConfigurationService +from elm.components import ElmButton + +@page(name="Participants", url_segment="participants") +class ParticipantsPage(Component): + participants: list[tuple[User, Seat]] = [] + + @on_populate + async def on_populate(self) -> None: + seats = await Seat.find_many( + Seat.user != None, + fetch_links=True + ).to_list() + + self.participants = [(seat.user, seat) for seat in seats] + + def build(self) -> Component: + return Row( + Rectangle( + content=Column( + Rectangle( + content=Rectangle( + content=Text("Teilnehmer", margin=0.5, selectable=False, overflow="wrap"), + fill=self.session.theme.header_box_background_color, + margin=0.4 + ), + stroke_width=0.1, + stroke_color=self.session.theme.box_border_color, + ), + Column( + Row( + Text("Nutzer", grow_x=True, font_weight="bold"), + Text("Sitzplatz", font_weight="bold"), + margin=0.5 + ), + *[ + Rectangle( + content=Row( + Text(user.user_name, grow_x=True, font_size=0.8), + Text(seat.seat_id, font_size=0.8), + margin=0.5 + ), + hover_fill=self.session.theme.secondary_color, + transition_time=0.2 + ) for user, seat in self.participants], + margin=1 + ), + Spacer() + ), + fill=self.session.theme.box_color, + stroke_width=0.1, + stroke_color=self.session.theme.box_border_color + ), + margin=1, + grow_x=True + )