This commit is contained in:
Pc
2025-04-08 22:19:54 +02:00
parent 670f995df5
commit acb68496fd
7 changed files with 164 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
from flask import render_template, request, make_response
from FlaskWebProject import app
@app.route('/')
def index():
# Odczyt ciasteczka "darkMode" <20> domy<6D>lnie "disabled"
dark_mode = request.cookies.get('darkMode', 'disabled')
return render_template('index.html', dark_mode=dark_mode)
@app.route('/toggle_dark_mode')
def toggle_dark_mode():
# Prze<7A><65>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

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,8 @@
// Funkcja prze<7A><65>czaj<61>ca tryb ciemny
function toggleDarkMode() {
const body = document.body;
const isDarkMode = body.classList.toggle("dark");
// Zapisuje stan trybu ciemnego w localStorage
localStorage.setItem("darkMode", isDarkMode ? "enabled" : "disabled");
}

View File

@@ -0,0 +1,62 @@
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background: #f7f7f7;
color: #222;
transition: all 0.3s ease;
}
nav {
background: #d32f2f;
padding: 10px;
display: flex;
justify-content: space-around;
color: white;
}
nav a, nav button {
color: white;
text-decoration: none;
font-weight: bold;
background: none;
border: none;
cursor: pointer;
}
main {
padding: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 10px;
border-bottom: 1px solid #ccc;
text-align: center;
}
.photo {
width: 200px;
border-radius: 50%;
display: block;
margin: 20px auto;
}
/* Dark Mode */
body.dark-mode {
background-color: #121212;
color: white;
}
body.dark-mode nav {
background: #333;
}
body.dark-mode table {
color: #e0e0e0;
}

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Lewandowski Stats{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<nav>
<a href="/">🏠 Strona główna</a> |
<a href="/mecze">📅 Mecze</a> |
<a href="/statystyki">📊 Statystyki</a> |
<button id="theme-toggle" onclick="toggleTheme()">🌙 / 🌞</button>
</nav>
<header>
<img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski" style="width: 200px; height: auto; border-radius: 50%;">
<h1>Statystyki Roberta Lewandowskiego</h1>
</header>
<main>
{% block content %}{% endblock %}
</main>
<script>
function toggleTheme() {
const currentMode = document.body.classList.contains('dark-mode') ? 'dark' : 'light';
const newMode = currentMode === 'light' ? 'dark' : 'light';
document.body.classList.toggle('dark-mode');
localStorage.setItem('theme', newMode);
}
window.onload = function () {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.body.classList.add('dark-mode');
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,23 @@
{% extends 'base.html' %}
{% block title %}Historia meczów{% endblock %}
{% block content %}
<h2>Historia ostatnich meczów</h2>
<table>
<tr>
<th>Data</th>
<th>Przeciwnik</th>
<th>Gole</th>
<th>Asysty</th>
<th>Minuty</th>
</tr>
{% for match in matches %}
<tr>
<td>{{ match.date }}</td>
<td>{{ match.opponent }}</td>
<td>{{ match.goals }}</td>
<td>{{ match.assists }}</td>
<td>{{ match.minutes }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block title %}Statystyki{% endblock %}
{% block content %}
<h2>Statystyki Roberta Lewandowskiego</h2>
<ul>
<li>Gole: {{ stats.goals }}</li>
<li>Asysty: {{ stats.assists }}</li>
<li>Mecze: {{ stats.matches }}</li>
</ul>
{% endblock %}