add WIP frontend

This commit is contained in:
David Rodenkirchen
2024-08-24 01:57:47 +02:00
parent 69c3ea9b68
commit 446956f721
11 changed files with 328 additions and 24 deletions
@@ -0,0 +1,60 @@
from rio import *
from src.ez_lan_manager import ConfigurationService
from src.ez_lan_manager.components.LoginBox import LoginBox
class DesktopNavigationButton(Component):
STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9)
label: str
target_url: str
open_new_tab: bool = False
def build(self) -> Component:
return Link(
content=Button(
content=Text(self.label, style=self.STYLE),
shape="rectangle",
style="minor",
color="secondary",
grow_x=True,
margin_left=0.6,
margin_right=0.6,
margin_top=0.6
),
target_url=self.target_url,
open_in_new_tab=self.open_new_tab
)
class DesktopNavigation(Component):
def build(self) -> Component:
lan_info = self.session[ConfigurationService].get_lan_info()
return Card(
Column(
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=2.5)),
Text(f"Edition {lan_info.iteration}", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.2), margin_top=0.3, margin_bottom=2),
LoginBox(),
DesktopNavigationButton("News", "./news"),
Spacer(min_height=1),
DesktopNavigationButton(f"Über {lan_info.name} {lan_info.iteration}", "./overview"),
DesktopNavigationButton("Ticket kaufen", "./buy_ticket"),
DesktopNavigationButton("Sitzplan", "./seating"),
DesktopNavigationButton("Catering", "./catering"),
DesktopNavigationButton("Teilnehmer", "./guests"),
DesktopNavigationButton("Turniere", "./tournaments"),
DesktopNavigationButton("FAQ", "./faq"),
DesktopNavigationButton("Regeln & AGB", "./rules-and-agb"),
Spacer(min_height=1),
DesktopNavigationButton("Die EZ GG e.V.", "https://ezgg-ev.de/about", open_new_tab=True),
DesktopNavigationButton("Kontakt", "./contact"),
DesktopNavigationButton("Impressum & DSGVO", "./imprint"),
Spacer(min_height=1),
align_y=0
),
color=self.session.theme.neutral_color,
min_width=15,
grow_y=True,
corner_radius=(0.5, 0, 0, 0),
margin_right=0.1
)
+56
View File
@@ -0,0 +1,56 @@
from rio import Component, Card, Column, Text, Row, Rectangle, Button, TextStyle, Color, Spacer, TextInput
class LoginBox(Component):
TEXT_STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9)
def build(self) -> Component:
return Rectangle(
content=Column(
TextInput(
text="",
label="Benutzername",
accessibility_label = "Benutzername",
min_height=0.5
),
TextInput(
text="",
label="Passwort",
accessibility_label="Passwort",
is_secret=True
),
Column(
Row(
Button(
Text("LOGIN", style=self.TEXT_STYLE, justify="center"),
shape="rectangle",
style="minor",
color="secondary",
margin_bottom=0.4
)
),
Row(
Button(
Text("REG", style=self.TEXT_STYLE, justify="center"),
shape="rectangle",
style="minor",
color="secondary"
),
Spacer(),
Button(
Text("LST PWD",style=self.TEXT_STYLE, justify="center"),
shape="rectangle",
style="minor",
color="secondary"
),
proportions=(49, 2, 49)
)
),
spacing=0.4
),
fill=Color.TRANSPARENT,
min_height=8,
min_width=12,
align_x=0.5,
margin_top=0.3,
margin_bottom=2
)
+54
View File
@@ -0,0 +1,54 @@
from rio import Component, Rectangle, Text, TextStyle, Column, Row
class NewsPost(Component):
title: str = ""
text: str = ""
date: str = ""
def build(self) -> Component:
return Rectangle(
content=Column(
Row(
Text(
self.title,
align_x=0,
grow_x=True,
margin=2,
margin_bottom=0,
style=TextStyle(
fill=self.session.theme.background_color,
font_size=1.3
),
wrap=False
),
Text(
self.date,
margin=2,
align_x=1,
style=TextStyle(
fill=self.session.theme.background_color,
font_size=0.6
),
wrap=True
)
),
Text(
self.text,
margin=2,
style=TextStyle(
fill=self.session.theme.background_color
),
wrap=True
)
),
fill=self.session.theme.primary_color,
margin_left=1,
margin_right=1,
margin_top=2,
margin_bottom=1,
shadow_radius=0.5,
shadow_color=self.session.theme.hud_color,
shadow_offset_y=0,
corner_radius=0.2
)