Release 0.3.2 #48

Closed
Typhus wants to merge 17 commits from main into prod
2 changed files with 25 additions and 9 deletions
Showing only changes of commit d7df5161d4 - Show all commits

View File

@ -1 +1 @@
0.3.1 0.3.2

View File

@ -19,14 +19,18 @@ class BuyTicketPage(Component):
popup_message: str = "" popup_message: str = ""
is_popup_success: bool = False is_popup_success: bool = False
is_buying_enabled: bool = False is_buying_enabled: bool = False
is_user_logged_in: bool = False
@event.on_populate @event.on_populate
async def on_populate(self) -> None: async def on_populate(self) -> None:
self.session[SessionStorage].subscribe_to_logged_in_or_out_event(str(self.__class__), self.on_populate)
await self.session.set_title(f"{self.session[ConfigurationService].get_lan_info().name} - Ticket kaufen") await self.session.set_title(f"{self.session[ConfigurationService].get_lan_info().name} - Ticket kaufen")
self.user = await self.session[UserService].get_user(self.session[SessionStorage].user_id) self.user = await self.session[UserService].get_user(self.session[SessionStorage].user_id)
if self.user is None: # No user logged in if self.user is None: # No user logged in
self.is_buying_enabled = False self.is_buying_enabled = False
self.is_user_logged_in = False
else: # User is logged in else: # User is logged in
self.is_user_logged_in = True
possible_ticket = await self.session[TicketingService].get_user_ticket(self.user.user_id) possible_ticket = await self.session[TicketingService].get_user_ticket(self.user.user_id)
self.user_ticket = possible_ticket self.user_ticket = possible_ticket
if possible_ticket is not None: # User already has a ticket if possible_ticket is not None: # User already has a ticket
@ -67,17 +71,29 @@ class BuyTicketPage(Component):
def build(self) -> Component: def build(self) -> Component:
ticket_infos = self.session[ConfigurationService].get_ticket_info() ticket_infos = self.session[ConfigurationService].get_ticket_info()
header = Text( header = Column(
Text(
"Tickets & Preise", "Tickets & Preise",
style=TextStyle( style=TextStyle(
fill=self.session.theme.background_color, fill=self.session.theme.background_color,
font_size=1.2 font_size=1.2
), ),
margin_top=2, margin_top=2,
margin_bottom=2,
align_x=0.5 align_x=0.5
),
spacing=0.2
) )
if not self.is_user_logged_in:
header.add(Text(
"Du musst eingeloggt sein\num ein Ticket zu kaufen",
style=TextStyle(
fill=self.session.theme.background_color,
font_size=0.6
),
align_x=0.5
))
return Column( return Column(
MainViewContentBox( MainViewContentBox(
Column( Column(