51 lines
2.6 KiB
Python
51 lines
2.6 KiB
Python
from nicegui import ui, app
|
|
from gui import discord_login
|
|
|
|
def setup_routes():
|
|
@ui.page('/')
|
|
def home_page():
|
|
ui.dark_mode(True)
|
|
|
|
# --- NAVIGATIONSLEISTE (HEADER) ---
|
|
with ui.header().classes('items-center justify-between bg-zinc-900 p-4 shadow-lg'):
|
|
ui.label('Diceghost Liga').classes('text-2xl font-bold text-white')
|
|
|
|
if app.storage.user.get('authenticated', False):
|
|
with ui.row().classes('items-center gap-4'):
|
|
ui.label(app.storage.user.get('discord_name')).classes('text-lg text-gray-300')
|
|
avatar = app.storage.user.get('avatar_url')
|
|
if avatar:
|
|
ui.image(avatar).classes('w-12 h-12 rounded-full border-2 border-blue-500')
|
|
|
|
def logout():
|
|
app.storage.user.clear()
|
|
ui.navigate.to('/')
|
|
|
|
ui.button('Logout', on_click=logout).classes('mt-4 bg-red-500 text-white')
|
|
|
|
else:
|
|
auth_url = discord_login.get_auth_url()
|
|
ui.button('Login with Discord', on_click=lambda: ui.navigate.to(auth_url))
|
|
|
|
|
|
# --- Spielsysteme ---
|
|
if app.storage.user.get('authenticated', False):
|
|
with ui.card().classes("w-full"):
|
|
ui.button('Enter Match', on_click=lambda: ui.navigate.to('/add-match')).classes('mt-4 bg-blue-500 text-white')
|
|
ui.label(text="Meine Ligaplätze").classes("font-bold text-white")
|
|
with ui.row().classes("w-full h-30 gap-4 items-center"):
|
|
#Einfügen: Eine UI Card PRO Spielsystem des Spielers.
|
|
with ui.card().classes("flex-1 h-24 items-center justify-center cursor-pointer hover:bg-zinc-800 transition-colors").on('click', lambda: ui.navigate.to('/statistic/Warhammer 40k')):
|
|
ui.label(text="Warhammer 40k").classes('text-xl font-bold')
|
|
|
|
with ui.card().classes("flex-1 h-24 items-center justify-center cursor-pointer hover:bg-zinc-800 transition-colors").on('click', lambda: ui.navigate.to('/statistic/Age of Sigmar')):
|
|
ui.label(text="Age of Sigmar").classes('text-xl font-bold')
|
|
|
|
with ui.card().classes("flex-1 h-24 items-center justify-center cursor-pointer hover:bg-zinc-800 transition-colors").on('click', lambda: ui.navigate.to('/statistic/Spearhead')):
|
|
ui.label(text="Spearhead").classes('text-xl font-bold')
|
|
|
|
with ui.card().classes("w-full"):
|
|
ui.label(text="Meine Statistik").classes("font-bold text-white")
|
|
|
|
|