57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
from flask import render_template, request, make_response
|
|
import lewy_api_v1
|
|
import lewy_db
|
|
import lewy_globals
|
|
|
|
def index():
|
|
dark_mode = request.cookies.get('darkMode', 'disabled')
|
|
# Przykładowe użycie endpointu last_goal_for():
|
|
# roberts_last_goals_club = lewy_api_v1.last_goal_for()
|
|
# print(roberts_last_goals_club.id_klubu)
|
|
stats = {
|
|
'goals': 38,
|
|
'assists': 12,
|
|
'matches': 45,
|
|
'matches_list': [
|
|
{'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90},
|
|
{'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
|
# Możesz dodać więcej meczów...
|
|
]
|
|
}
|
|
return render_template('index.html', goals=stats['goals'], assists=stats['assists'],
|
|
matches=stats['matches'], matches_list=stats['matches_list'],
|
|
commit_in_html=lewy_globals.getCommitInFormattedHTML(),
|
|
dark_mode=dark_mode)
|
|
|
|
def mecze():
|
|
# Możesz dostarczyć szczegóły dotyczące meczów
|
|
matches = [
|
|
{'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90},
|
|
{'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
|
]
|
|
return render_template('matches.html', matches=matches)
|
|
|
|
def statystyki():
|
|
stats = {
|
|
'goals': 38,
|
|
'assists': 12,
|
|
'matches': 45,
|
|
}
|
|
return render_template('stats.html', stats=stats)
|
|
|
|
def historia():
|
|
selected_club = request.args.get("club","FC Barcelona")
|
|
history = [
|
|
{'club': 'FC Barcelona', 'goals': 22},
|
|
{'club': 'Bayern Monachium', 'goals': 132},
|
|
]
|
|
return render_template('history.html', history=history, selected_club=selected_club)
|
|
|
|
def toggle_dark_mode():
|
|
# Przełącz tryb i zapisz w ciasteczku
|
|
dark_mode = request.cookies.get('darkMode', 'disabled')
|
|
new_mode = 'enabled' if dark_mode == 'disabled' else 'disabled'
|
|
response = make_response("OK")
|
|
response.set_cookie('darkMode', new_mode, max_age=31536000) # Ustawienie ciasteczka na 1 rok
|
|
return response
|