Release 0.3.2 #48
@ -157,6 +157,12 @@ if __name__ == "__main__":
|
|||||||
build=pages.ManageTournamentsPage,
|
build=pages.ManageTournamentsPage,
|
||||||
guard=team_guard
|
guard=team_guard
|
||||||
),
|
),
|
||||||
|
ComponentPage(
|
||||||
|
name="AdminNavigationPage",
|
||||||
|
url_segment="admin",
|
||||||
|
build=pages.AdminNavigationPage,
|
||||||
|
guard=team_guard
|
||||||
|
),
|
||||||
ComponentPage(
|
ComponentPage(
|
||||||
name="DbErrorPage",
|
name="DbErrorPage",
|
||||||
url_segment="db-error",
|
url_segment="db-error",
|
||||||
|
|||||||
36
src/ezgg_lan_manager/components/AdminNavigationCard.py
Normal file
36
src/ezgg_lan_manager/components/AdminNavigationCard.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
from rio import Component, Rectangle, Text, Column, Icon, TextStyle, PointerEventListener, PointerEvent
|
||||||
|
|
||||||
|
|
||||||
|
class AdminNavigationCard(Component):
|
||||||
|
icon_name: str
|
||||||
|
display_text: str
|
||||||
|
target_url: str
|
||||||
|
|
||||||
|
def on_press(self, _: PointerEvent) -> None:
|
||||||
|
if self.target_url:
|
||||||
|
self.session.navigate_to(self.target_url)
|
||||||
|
|
||||||
|
def build(self) -> Component:
|
||||||
|
return PointerEventListener(
|
||||||
|
Rectangle(
|
||||||
|
content=Column(
|
||||||
|
Icon(
|
||||||
|
self.icon_name,
|
||||||
|
min_width=3.5,
|
||||||
|
min_height=3.5,
|
||||||
|
fill="background",
|
||||||
|
margin=1
|
||||||
|
),
|
||||||
|
Text(self.display_text, style=TextStyle(fill=self.session.theme.background_color), justify="center", margin=1, margin_top=0)
|
||||||
|
),
|
||||||
|
cursor="pointer",
|
||||||
|
stroke_width=0.2,
|
||||||
|
stroke_color=self.session.theme.background_color,
|
||||||
|
hover_stroke_width=0.2,
|
||||||
|
hover_stroke_color=self.session.theme.hud_color,
|
||||||
|
min_width=10,
|
||||||
|
min_height=10,
|
||||||
|
corner_radius=0.2
|
||||||
|
),
|
||||||
|
on_press=self.on_press
|
||||||
|
)
|
||||||
@ -43,7 +43,7 @@ class DesktopNavigation(Component):
|
|||||||
lan_info = self.session[ConfigurationService].get_lan_info()
|
lan_info = self.session[ConfigurationService].get_lan_info()
|
||||||
user_info_and_login_box = UserInfoAndLoginBox()
|
user_info_and_login_box = UserInfoAndLoginBox()
|
||||||
self.force_login_box_refresh.append(user_info_and_login_box.force_refresh)
|
self.force_login_box_refresh.append(user_info_and_login_box.force_refresh)
|
||||||
user_navigation = [
|
navigation = [
|
||||||
DesktopNavigationButton("News", "./news"),
|
DesktopNavigationButton("News", "./news"),
|
||||||
Spacer(min_height=0.7),
|
Spacer(min_height=0.7),
|
||||||
DesktopNavigationButton(f"Über {lan_info.name} {lan_info.iteration}", "./overview"),
|
DesktopNavigationButton(f"Über {lan_info.name} {lan_info.iteration}", "./overview"),
|
||||||
@ -60,29 +60,16 @@ class DesktopNavigation(Component):
|
|||||||
DesktopNavigationButton("Die EZ GG e.V.", "https://ezgg-ev.de/about", open_new_tab=True),
|
DesktopNavigationButton("Die EZ GG e.V.", "https://ezgg-ev.de/about", open_new_tab=True),
|
||||||
Spacer(min_height=0.7)
|
Spacer(min_height=0.7)
|
||||||
]
|
]
|
||||||
team_navigation = [
|
|
||||||
Text("Verwaltung", align_x=0.5, margin_top=0.3, style=TextStyle(fill=Color.from_hex("F0EADE"), font_size=1.2)),
|
|
||||||
Text("Vorsichtig sein!", align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.danger_color, font_size=0.6)),
|
|
||||||
DesktopNavigationButton("News", "./manage-news", is_team_navigation=True),
|
|
||||||
DesktopNavigationButton("Benutzer", "./manage-users", is_team_navigation=True),
|
|
||||||
DesktopNavigationButton("Catering", "./manage-catering", is_team_navigation=True),
|
|
||||||
DesktopNavigationButton("Turniere", "./manage-tournaments", is_team_navigation=True),
|
|
||||||
Spacer(min_height=0.7),
|
|
||||||
Revealer(
|
|
||||||
header="Normale Navigation",
|
|
||||||
content=Column(*user_navigation),
|
|
||||||
header_style=TextStyle(fill=self.session.theme.primary_color, font_size=0.9)
|
|
||||||
)
|
|
||||||
] if self.user is not None and self.user.is_team_member else []
|
|
||||||
|
|
||||||
nav_to_use = copy(team_navigation) if self.user is not None and self.user.is_team_member else copy(user_navigation)
|
if self.user is not None and self.user.is_team_member:
|
||||||
|
navigation.insert(0, DesktopNavigationButton("Adminbereich", "./admin", is_team_navigation=True))
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
Column(
|
Column(
|
||||||
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.9)),
|
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.9)),
|
||||||
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),
|
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),
|
||||||
user_info_and_login_box,
|
user_info_and_login_box,
|
||||||
*nav_to_use,
|
*navigation,
|
||||||
Text("Unsere Sponsoren", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=0.9), margin_bottom=0.5, margin_top=1),
|
Text("Unsere Sponsoren", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=0.9), margin_bottom=0.5, margin_top=1),
|
||||||
NavigationSponsorBox(img_name="crackz", url="https://www.crackz.gg/"),
|
NavigationSponsorBox(img_name="crackz", url="https://www.crackz.gg/"),
|
||||||
align_y=0
|
align_y=0
|
||||||
|
|||||||
44
src/ezgg_lan_manager/pages/AdminNavigationPage.py
Normal file
44
src/ezgg_lan_manager/pages/AdminNavigationPage.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
from rio import Column, Component, event, Text, TextStyle, Row
|
||||||
|
|
||||||
|
from src.ezgg_lan_manager.components.AdminNavigationCard import AdminNavigationCard
|
||||||
|
from src.ezgg_lan_manager.components.MainViewContentBox import MainViewContentBox
|
||||||
|
from src.ezgg_lan_manager.services.ConfigurationService import ConfigurationService
|
||||||
|
|
||||||
|
|
||||||
|
class AdminNavigationPage(Component):
|
||||||
|
@event.on_populate
|
||||||
|
async def on_populate(self) -> None:
|
||||||
|
await self.session.set_title(f"{self.session[ConfigurationService].get_lan_info().name} - Admin")
|
||||||
|
|
||||||
|
def build(self) -> Component:
|
||||||
|
return Column(
|
||||||
|
MainViewContentBox(
|
||||||
|
Text(
|
||||||
|
text="Admin",
|
||||||
|
style=TextStyle(
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
|
font_size=1.2
|
||||||
|
),
|
||||||
|
margin_top=2,
|
||||||
|
margin_bottom=2,
|
||||||
|
align_x=0.5
|
||||||
|
)
|
||||||
|
),
|
||||||
|
MainViewContentBox(
|
||||||
|
Column(
|
||||||
|
Row(
|
||||||
|
AdminNavigationCard(icon_name="material/supervised_user_circle", display_text="Nutzer", target_url="manage-users"),
|
||||||
|
AdminNavigationCard(icon_name="material/fastfood", display_text="Catering", target_url="manage-catering"),
|
||||||
|
spacing=1
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
AdminNavigationCard(icon_name="material/text_ad", display_text="News", target_url="manage-news"),
|
||||||
|
AdminNavigationCard(icon_name="material/trophy", display_text="Turniere", target_url="manage-tournaments"),
|
||||||
|
spacing=1
|
||||||
|
),
|
||||||
|
margin=1,
|
||||||
|
spacing=1
|
||||||
|
)
|
||||||
|
),
|
||||||
|
align_y=0
|
||||||
|
)
|
||||||
@ -24,3 +24,4 @@ from .TournamentDetailsPage import TournamentDetailsPage
|
|||||||
from .TournamentRulesPage import TournamentRulesPage
|
from .TournamentRulesPage import TournamentRulesPage
|
||||||
from .ConwayPage import ConwayPage
|
from .ConwayPage import ConwayPage
|
||||||
from .TeamsPage import TeamsPage
|
from .TeamsPage import TeamsPage
|
||||||
|
from .AdminNavigationPage import AdminNavigationPage
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user