merge new front-end #3

Merged
sherl merged 8 commits from frontend into master 2025-06-05 10:30:28 +02:00
12 changed files with 357 additions and 63 deletions
Showing only changes of commit f65a174089 - Show all commits

View File

@@ -67,7 +67,10 @@ def setup():
app.add_url_rule('/mecze', view_func=lewy_routes.mecze)
app.add_url_rule('/statystyki', view_func=lewy_routes.statystyki)
app.add_url_rule('/toggle_dark_mode', view_func=lewy_routes.toggle_dark_mode)
app.add_url_rule('/historia', view_func=lewy_routes.historia)
app.add_url_rule('/club', view_func=lewy_routes.clubs)
app.add_url_rule('/representation', view_func=lewy_routes.representation)
app.add_url_rule('/compare', view_func=lewy_routes.compare)
app.add_url_rule('/trophies', view_func=lewy_routes.trophies)
# API:
app.add_url_rule('/api/', view_func=lewy_api.api_greeting)

View File

@@ -3,6 +3,39 @@ import lewy_api_v1
import lewy_db
import lewy_globals
def get_lewy_stats():
return {
'all_time_stats': {
'goals': 380,
'assists': 120,
'matches': 450,
},
'club_stats': {
'goals': 132,
'assists': 112,
'matches': 245,
},
'nation_stats': {
'goals': 86,
'assists': 52,
'matches': 158,
},
'worldcup': {
'goals': 7,
'assists': 2,
'matches': 11,
},
'euro': {
'goals': 6,
'assists': 2,
'matches': 18,
},
'cards': {
'yellow': 24,
'red': 4,
}
}
def index():
dark_mode = request.cookies.get('darkMode', 'disabled')
# Przykładowe użycie endpointu last_goal_for():
@@ -32,20 +65,38 @@ def mecze():
return render_template('matches.html', matches=matches)
def statystyki():
stats = {
'goals': 38,
'assists': 12,
'matches': 45,
}
return render_template('stats.html', stats=stats)
dane=get_lewy_stats()
return render_template('stats.html', **dane)
def historia():
def clubs():
selected_club = request.args.get("club","FC Barcelona")
history = [
{'club': 'FC Barcelona', 'goals': 22},
clubs = [
{'club': 'FC Barcelona', 'goals': 22,'assist':12},
{'club': 'Bayern Monachium', 'goals': 132},
{'club': 'Borussia Dortmund', 'goals': 132},
{'club': 'Lech Poznan', 'goals': 132},
]
return render_template('history.html', history=history, selected_club=selected_club)
return render_template('club.html', clubs=clubs, selected_club=selected_club)
def representation():
nation_stats = {
'goals': 86,
'assists': 52,
'matches': 158,
}
return render_template('representation.html', nation_stats=nation_stats)
def compare():
selected_player = request.args.get("player","Leo Messi")
lewy=get_lewy_stats()
player2 = [
{'name':'Leo Messi','goals': 34,'assists': 12},
]
return render_template('compare.html',player2=player2, selected_player=selected_player,**lewy, )
def trophies():
trophy = {
'name': 'asdasd'
}
return render_template('trophies.html',trophy=trophy)
def toggle_dark_mode():
# Przełącz tryb i zapisz w ciasteczku

View File

@@ -24,7 +24,7 @@
--polska-red: #E30B17;
--polska-white: #FFFFFF;
--polska-section-color: #05204A;
--polska-section-color: #970000;
--section-color: #051839;
--pink-highlight: #E1317E;
--blue-highlight: #00B9BF;
@@ -82,6 +82,7 @@ body {
width: 40%;
padding: 20px;
position: relative;
}
.profile-image-cover {

View File

@@ -23,7 +23,13 @@
<li><a href="/">Strona główna</a></li>
<li><a href="/mecze">Mecze</a></li>
<li><a href="/statystyki">Statystyki</a></li>
<li><a href="/historia">Osiągnięcia</a></li>
<li><a href="/club">Kluby</a></li>
<li><a href="/representation">Reprezentacja</a></li>
<li><a href="/trophies">Trofea</a></li>
<li><a href="/compare">Porównaj</a></li>
<li><button id="theme-toggle" onclick="toggleTheme()"></button></li>
</ul>
<div class="hamburger"></div>

View File

@@ -0,0 +1,60 @@
{% extends "base.html" %}
{% block title %}Strona Główna{% endblock %}
{% block content %}
<section class="choose-club">
<a href="{{ url_for('clubs', club='FC Barcelona') }}">
<button><img src="{{ url_for('static', filename='FC_Barcelona.png') }}"></button>
</a>
<a href="{{ url_for('clubs', club='Bayern Monachium') }}">
<button><img src="{{ url_for('static', filename='FC_Bayern.png') }}"></button>
</a>
<a href="{{ url_for('clubs', club='Borussia Dortmund') }}">
<button><img src="{{ url_for('static', filename='Borussia_Dortmund.png') }}"></button>
</a>
<a href="{{ url_for('clubs', club='Lech Poznan') }}">
<button><img src="{{ url_for('static', filename='Lech_Poznan.png') }}"></button>
</a>
</section>
<!-- Wyświetlanie danych tylko dla wybranego klubu -->
{% for stats in clubs %}
{% if stats.club == selected_club %}
<section class="club-stats">
<h3>Statystyki dla {{selected_club}}</h3>
<div class="stat-box">
Gole: {{ stats.goals }}
</div>
<div class="stat-box">
Asysty: {{ stats.assist }}
</div>
<div class="stat-box">
Występy: {{ stats.goals }}
</div>
<div class="stat-box">
Łączny czas gry: {{ stats.goals }}
</div>
<div class="stat-box">
Hat-tricki: {{ stats.goals }}
</div>
<div class="stat-box">
Zwycięstwa: {{ stats.goals }}
</div>
<div class="stat-box">
Porażki: {{ stats.goals }}
</div>
<div class="stat-box">
Żółte kartki: {{ stats.goals }}
</div>
<div class="stat-box">
Czerwone kartki: {{ stats.goals }}
</div>
</section>
{% endif %}
{% endfor %}
{% endblock %}
{% block footer %}
{{ commit_in_html | safe }}
{% endblock %}

View File

@@ -0,0 +1,68 @@
{% extends "base.html" %}
{% block title %}Statystyki{% endblock %}
{% block content %}
<select onchange="location = this.value;">
<option disabled selected>Wybierz zawodnika</option>
<option value="{{ url_for('compare', player='Leo Messi') }}">Leo Messi</option>
<option value="{{ url_for('compare', player='Ronaldo') }}">Cristiano Ronaldo</option>
<option value="{{ url_for('compare', player='Neymar') }}">Neymar</option>
</select>
{%for player in player2 %}
{% if player.name == selected_player %}
<section class="section-stats">
<h2>Gole</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ all_time_stats.goals }}</h3>
</div>
<div class="stat-box">
<h3>{{ player.goals}}</h3>
</div>
</div>
<h2>Asysty</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ all_time_stats.assists }}</h3>
</div>
<div class="stat-box">
<h3>{{ player.assists}}</h3>
</div>
</div>
<h2>Wystąpienia</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ all_time_stats.assists }}</h3>
</div>
<div class="stat-box">
<h3>{{ player.assists}}</h3>
</div>
</div>
<h2>Minuty zagrane</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ all_time_stats.assists }}</h3>
</div>
<div class="stat-box">
<h3>{{ player.assists}}</h3>
</div>
</div>
</section>
{% endif %}
{% endfor%}
{% endblock %}

View File

@@ -1,30 +0,0 @@
{% extends "base.html" %}
{% block title %}Strona Główna{% endblock %}
{% block content %}
<section class="choose-club">
<a href="{{ url_for('historia', club='FC Barcelona') }}">
<button><img src="{{ url_for('static', filename='FC_Barcelona.png') }}"></button>
</a>
<a href="{{ url_for('historia', club='Bayern Monachium') }}">
<button><img src="{{ url_for('static', filename='FC_Bayern.png') }}"></button>
</a>
</section>
<!-- Wyświetlanie danych tylko dla wybranego klubu -->
{% for stats in history %}
{% if stats.club == selected_club %}
<section class="club-stats">
<h2>{{ stats.club }} - All time stats</h2>
<div class="stats">
Gole: {{ stats.goals }}
</div>
</section>
{% endif %}
{% endfor %}
{% endblock %}
{% block footer %}
{{ commit_in_html | safe }}
{% endblock %}

View File

@@ -30,7 +30,7 @@
<article>
<h3>Osiągnięcia</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod dicta veritatis quibusdam eligendi corrupti. Expedita delectus assumenda ipsum illum molestias a voluptates, voluptas quia reprehenderit, quod non, eum veritatis tenetur!</p>
<a href="/historia">Zobacz osiągnięcia</a>
<a href="/club">Zobacz osiągnięcia</a>
</article>
</section>

View File

@@ -3,6 +3,18 @@
{% block title %}Lista meczów{% endblock %}
{% block content %}
<select>
<option disabled selected>Wybierz zawodnika</option>
<option value="{{ url_for('compare', player='Leo Messi') }}">2024/2025</option>
<option value="{{ url_for('compare', player='Ronaldo') }}">2023/2024</option>
<option value="{{ url_for('compare', player='Neymar') }}">2022/2023</option>
<option value="{{ url_for('compare', player='Neymar') }}">2021/2022</option>
<option value="{{ url_for('compare', player='Neymar') }}">2020/2021</option>
<option value="{{ url_for('compare', player='Neymar') }}">2019/2020</option>
<option value="{{ url_for('compare', player='Neymar') }}">2018/2019</option>
<option value="{{ url_for('compare', player='Neymar') }}">2017/2018</option>
<option value="{{ url_for('compare', player='Neymar') }}">2016/2017</option>
</select>
<section class="section__matches">
<h2>📅 Mecze Roberta</h2>
<table>

View File

@@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block title %}Statystyki{% endblock %}
{% block content %}
<section class="club-stats">
<h3>Statystyki w reprezentacji Polski</h3>
<div class="stat-box">
Gole: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Asysty: {{ nation_stats.assist }}
</div>
<div class="stat-box">
Występy: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Łączny czas gry: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Hat-tricki: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Zwycięstwa: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Porażki: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Żółte kartki: {{ nation_stats.goals }}
</div>
<div class="stat-box">
Czerwone kartki: {{ nation_stats.goals }}
</div>
</section>
{% endblock %}

View File

@@ -4,36 +4,99 @@
{% block content %}
<section class="section-stats">
<h2>All time stats</h2>
<h2>Ogólne statystyki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ stats.goals }}</h3>
<p>Goals</p>
<h3>{{ all_time_stats.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ stats.assists }}</h3>
<p>Assists</p>
<h3>{{ all_time_stats.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ stats.matches }}</h3>
<p>Apps</p>
<h3>{{ all_time_stats.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>All time stats</h2>
<h2>Klubowe statystyki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ stats.goals }}</h3>
<p>Goals</p>
<h3>{{ club_stats.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ stats.assists }}</h3>
<p>Assists</p>
<h3>{{ club_stats.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ stats.matches }}</h3>
<p>Apps</p>
<h3>{{ club_stats.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>Reprezentacja statystyki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ nation_stats.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ nation_stats.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ nation_stats.matches }}</h3>
<p>Występy</p>
</div>
</section>
<section class="section-stats">
<h2>Mistrzostwa świata</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ worldcup.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ worldcup.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ worldcup.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>EURO</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ euro.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ euro.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ euro.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>Kartki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ cards.yellow }}</h3>
<p>Żółte</p>
</div>
<div class="stat-box">
<h3>{{ cards.red }}</h3>
<p>Czerwone</p>
</div>
</div>
</section>

View File

@@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}Statystyki{% endblock %}
{% block content %}
<section class="section-stats">
<h2>Ogólne statystyki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ trophy.name}}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ trophy.name }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ trophy.name }}</h3>
<p>Występy</p>
</div>
</div>
</section>
{% endblock %}