Match formular für mobile angepasst. Punkte Eintrag hat jetzt + - Buttons für Präzise Einstellungen.

This commit is contained in:
Daniel Nagel 2026-03-26 08:55:11 +00:00
parent b861ebf79d
commit 9cf54bd051
2 changed files with 37 additions and 17 deletions

View File

@ -0,0 +1 @@
{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verzweifelter Kultist","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"}

View File

@ -19,7 +19,6 @@ def setup_routes():
# --- Eingabeformular --- # --- Eingabeformular ---
with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6 shadow-xl'): with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6 shadow-xl'):
system_id = data_api.get_gamesystem_id_by_name(system_name) system_id = data_api.get_gamesystem_id_by_name(system_name)
system_data = data_api.get_gamesystem_data(system_id) system_data = data_api.get_gamesystem_data(system_id)
min_score = system_data["min_score"] min_score = system_data["min_score"]
@ -27,32 +26,52 @@ def setup_routes():
# Text-Center hinzugefügt, falls der Systemname sehr lang ist und auf dem Handy umbricht # Text-Center hinzugefügt, falls der Systemname sehr lang ist und auf dem Handy umbricht
ui.label(f'Neues Spiel für {system_name} eintragen').classes('text-2xl font-bold text-center mb-6') ui.label(f'Neues Spiel für {system_name} eintragen').classes('text-2xl font-bold text-center mb-6')
ui.label("Meine Punkte:").classes('text-xl font-bold w-full text-left')
with ui.column().classes("w-full items-center gap-6"): with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6'):
# 1. Daten aus der DB holen ui.label("Meine Punkte:").classes('text-xl font-bold w-full text-left')
raw_players = data_api.get_all_players_from_system(system_name) with ui.column().classes("w-full items-center gap-6"):
my_id = app.storage.user.get('db_id') # 1. Daten aus der DB holen
raw_players = data_api.get_all_players_from_system(system_name)
my_id = app.storage.user.get('db_id')
def add_point():
p1_points.value += 1
def sub_point():
p1_points.value -= 1
with ui.row().classes("w-full items-center justify-between"):
p1_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-35")
with ui.column().classes("items-center justify-between"):
# Punkte Up- Down- Buttons. und Textanzeige
ui.button(icon="expand_less", on_click=add_point)
ui.label().bind_text_from(p1_points, 'value').classes("text-lg text-normaltext")
ui.button(icon="expand_more", on_click=sub_point)
with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6'):
dropdown_options = {} dropdown_options = {}
for p in raw_players: for p in raw_players:
if p['player_id'] == my_id: if p['player_id'] == my_id:
continue continue
dropdown_options[p['player_id']] = f"{p['display_name']} 'aka' {p['discord_name']}" dropdown_options[p['player_id']] = f"{p['display_name']} 'aka' {p['discord_name']}"
with ui.row().classes("w-full items-center justify-between"):
p1_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-70")
ui.label().bind_text_from(p1_points, 'value').classes("text-lg text-normaltext")
ui.separator().classes('w-full mt-4') # Ein schöner Trennstrich für die Optik
ui.label("Gegner:").classes('text-xl font-bold w-full text-left')
opponent_select = ui.select(options=dropdown_options, label='Gegner auswählen').classes('w-full') opponent_select = ui.select(options=dropdown_options, label='Gegner auswählen').classes('w-full')
with ui.row().classes("w-full items-center justify-between"):
p2_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-70")
ui.label().bind_text_from(p2_points, 'value').classes("text-lg text-normaltext")
ui.space() def add_point():
p2_points.value += 1
def sub_point():
p2_points.value -= 1
with ui.row().classes("w-full items-center justify-between"):
p2_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-35")
with ui.column().classes("items-center justify-between"):
# Punkte Up- Down- Buttons. und Textanzeige
ui.button(icon="expand_less", on_click=add_point)
ui.label().bind_text_from(p2_points, 'value').classes("text-lg text-normaltext")
ui.button(icon="expand_more", on_click=sub_point)
# Das Match in die Datenbank eintragen lassen und die MMR Berechnung triggern. # Das Match in die Datenbank eintragen lassen und die MMR Berechnung triggern.
def input_match_to_database(): def input_match_to_database():