From 9f164b4d6105ff47fb438c3e0c804747fe88d3bb Mon Sep 17 00:00:00 2001 From: Weyoune Date: Sun, 15 Nov 2026 20:20:18 +0100 Subject: [PATCH] The statistics as five pages of the notebook with markers of their own Analysis (the club's season as figures and charts), course (the recorded series as curves, the seasons' finances), winners under their trophies, records (all-time table, series and records, world cups) and players (transfer history, minutes, chances). A page with several kinds shows them as tabs; the old list of kinds in the foot is gone in a career. Co-Authored-By: Claude Fable 5.2 --- assets/modern/pages.rcss | 41 ++++++ src/modern/ui/engine_controls.inc | 2 +- src/modern/ui/notebook.inc | 11 +- src/modern/ui/pages.inc | 2 +- src/modern/ui/statistics_analysis.inc | 204 ++++++++++++-------------- src/modern/ui/statistics_controls.inc | 21 +++ src/modern/ui/statistics_screens.inc | 126 +++++++++------- src/modern/ui/statistics_state.inc | 5 + 8 files changed, 239 insertions(+), 173 deletions(-) diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index e53b267..542cf6e 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -466,3 +466,44 @@ body .pg-btn.pg-go[disabled] {opacity:1;background-color:var(--p-a3);border-colo .nw-excerpt {display:block;font-size:28dp;line-height:36dp;} .nw-body {display:block;font-size:36dp;line-height:54dp;} .pg-root .news-art,.pg-ov .news-art {background-color:transparent;} + +/* --- statistics: the club's season as charts, and the archive --- */ +.st-course-panel {flex:1.15;} +.st-course {display:flex;flex:none;justify-content:center;} +.st-strip {display:flex;flex:none;gap:6dp;height:100dp;border-radius:18dp;decorator:linear-gradient(180deg,#00000000 0%,#00000000 48%,var(--p-n4) 48%,var(--p-n4) 52%,#00000000 52%,#00000000 100%);} +.st-strip-column {display:block;position:relative;flex:1;max-width:100dp;height:100dp;} +.st-strip-column div {position:absolute;left:10%;right:10%;border-radius:7dp;} +.st-strip-column .won,.st-won {background-color:var(--p-s7);} +.st-strip-column .lost {background-color:var(--p-a7);} +.st-strip-column .drawn {background-color:var(--p-n5);} +.st-lost {background-color:var(--p-a4);} +.st-minutes {display:flex;flex:1;align-items:flex-end;gap:14dp;} +.st-minute {display:flex;flex:1;flex-direction:column;align-items:center;gap:6dp;} +.st-minute-bars {display:flex;align-items:flex-end;gap:9dp;height:260dp;} +.st-minute-bars div {width:45dp;border-radius:11dp 11dp 0 0;} +.st-minute small {display:block;font-size:24dp;line-height:30dp;color:var(--p-n7);} +.st-minute strong {display:block;font-size:26dp;line-height:32dp;font-weight:bold;} +.st-stack {display:flex;flex:1;height:50dp;border-radius:18dp;overflow:hidden;font-size:26dp;font-weight:bold;} +.st-stack div {display:block;height:50dp;line-height:50dp;text-align:center;overflow:hidden;} +.st-stack span {display:block;white-space:nowrap;} +.st-stack .won {background-color:var(--p-s7);color:var(--p-n1);} +.st-stack .drawn {background-color:var(--p-n4);color:var(--p-n9);} +.st-stack .lost {background-color:var(--p-a8);color:var(--p-n1);} +.st-stack .none {background-color:var(--p-n2);color:var(--p-n7);font-weight:normal;} +.st-reading {display:block;font-size:29dp;line-height:40dp;} +.st-scorer {display:block;flex:none;padding:6dp 0;} +.st-scorer-bar {display:flex;height:16dp;margin-top:6dp;border-radius:8dp;background-color:var(--p-n3);overflow:hidden;} +.st-scorer-bar .goals {height:16dp;background-color:var(--p-a6);} +.st-scorer-bar .assists {height:16dp;background-color:var(--p-a3);} +.st-graph {display:flex;flex:1;align-items:center;justify-content:center;min-height:0;} +.st-th {display:flex;align-items:center;gap:12dp;padding:0 18dp;} +.st-th.r {justify-content:flex-end;} .st-th.c {justify-content:center;} +.st-th span {display:block;} +.pg-thead.st-trophies {height:372dp;align-items:flex-end;padding-bottom:14dp;} +.pg-root .st-trophy,.pg-root .st-trophy:hover {align-items:center;width:100%;gap:8dp;padding:16dp 12dp;} +.st-trophy-art {display:block;width:230dp;height:230dp;} +.st-trophy-name {font-size:32dp;line-height:40dp;text-align:center;letter-spacing:0dp;color:var(--p-text);} +.st-trophy-small {display:block;flex:none;width:88dp;height:88dp;} +.st-td .pg-link {max-width:100%;} +.st-text {display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.pg-root .pg-dd .report-picker-popup {min-width:560dp;} diff --git a/src/modern/ui/engine_controls.inc b/src/modern/ui/engine_controls.inc index 0009f41..31e164e 100644 --- a/src/modern/ui/engine_controls.inc +++ b/src/modern/ui/engine_controls.inc @@ -483,7 +483,7 @@ void App::engine_event(Rml::Event &event) { else if(action=="engine-open"&&id=="transfer"){menu_=id;transfer_view_=Json::object();transfer_dialog_.clear();engine_transfer_sync();refresh();} else if(action=="engine-open"&&id=="stadium"){menu_=id;stadium_view_=Json::object();stadium_view_defaults(stadium_view_);engine_stadium_sync();refresh();} else if(action=="engine-open"&&id=="toto"){menu_=id;engine_toto_sync();refresh();} - else if(action=="engine-open"&&id=="statistics"){menu_=id;engine_reports_sync();engine_statistics_load();} + else if(action=="engine-open"&&(id=="statistics"||id.starts_with("stat-"))){statistics_open(id);} else if(action=="engine-open"&&id=="load"){engine_files_begin("load");} else if(action=="engine-open"&&id=="scorers"){menu_=id;engine_reports_sync();engine_rankings_load(engine_rankings_state_.at("league"),engine_rankings_state_.at("scope"));} else if(action=="engine-open"&&id=="fairplay"){menu_=id;engine_reports_sync();engine_fairplay_load();} diff --git a/src/modern/ui/notebook.inc b/src/modern/ui/notebook.inc index 6b42b4d..a6aec31 100644 --- a/src/modern/ui/notebook.inc +++ b/src/modern/ui/notebook.inc @@ -17,7 +17,7 @@ const std::vector ¬ebook_sections() { {"club", "Verein", {"stadium", "environment", "advertising"}}, {"finance", "Finanzen", {"balance", "bank", "toto"}}, {"fixtures", "Spielplan", {"calendar", "league", "tables", "other", "friendlies", "postpone", "indoor"}}, - {"records", "Statistik", {"statistics", "achievements", "almanac", "fairplay", "highscore"}}, + {"records", "Statistik", {"statistics", "stat-trend", "stat-winners", "stat-records", "stat-players", "achievements", "almanac", "fairplay", "highscore"}}, {"inbox", "Posteingang", {"news"}}, {"options", "Optionen", {"settings", "save", "load", "newplayer"}}}; return value; @@ -28,7 +28,7 @@ std::string notebook_page_label(const std::string &route) { {"scorers", "Spielerstatistik"}, {"transfer", "Transfermarkt"}, {"contracts", "Verträge"}, {"stadium", "Stadion"}, {"environment", "Umfeld"}, {"advertising", "Werbung"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"}, {"tables", "Tabellen"}, {"other", "Übrige Spiele"}, {"friendlies", "Testspiele"}, {"postpone", "Verlegen"}, {"indoor", "Halle"}, - {"statistics", "Statistiken"}, {"achievements", "Erfolge"}, {"almanac", "Almanach"}, {"fairplay", "Fairplay"}, {"highscore", "Highscore"}, + {"statistics", "Analyse"}, {"stat-trend", "Verlauf"}, {"stat-winners", "Sieger"}, {"stat-records", "Rekorde"}, {"stat-players", "Spieler"}, {"achievements", "Erfolge"}, {"almanac", "Almanach"}, {"fairplay", "Fairplay"}, {"highscore", "Highscore"}, {"news", "Nachrichten"}, {"settings", "Einstellungen"}, {"save", "Speichern"}, {"load", "Laden"}, {"newplayer", "Manager"}}; const auto found = labels.find(route); return found == labels.end() ? route : found->second; @@ -198,7 +198,10 @@ std::string App::notebook_shell(const std::function & } size_t n = 0; for (const char *r : section.routes) { - const bool here = menu_ == r; + // the statistics are one menu with several pages; the demo has only its first + const bool part = std::string_view(r).starts_with("stat-") || std::string_view(r) == "statistics"; + if (!engine_mode_ && std::string_view(r).starts_with("stat-")) continue; + const bool here = part && engine_mode_ ? menu_ == "statistics" && statistics_page_ == r : menu_ == r; if (here) { kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size()); heading = notebook_page_label(r); @@ -207,7 +210,7 @@ std::string App::notebook_shell(const std::function & std::string("nb-sub") + (here ? " active" : ""), "id=\"page-" + std::string(r) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"transform:translateY(" + (here ? std::string("-13") : std::to_string(sub_rest[n % sub_rest.size()])) + "dp) rotate(" + scalar(sub_turns[n % sub_turns.size()]) + "deg);\"", - enabled(r)); + enabled(part ? "statistics" : r)); ++n; } } diff --git a/src/modern/ui/pages.inc b/src/modern/ui/pages.inc index b11827d..092fd86 100644 --- a/src/modern/ui/pages.inc +++ b/src/modern/ui/pages.inc @@ -5,7 +5,7 @@ // The menus that are laid out as a page of the notebook. Every other career menu is still a // sheet of the old format, shown scaled inside the book. bool App::page_native() const { - static const std::set native{"news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; + static const std::set native{"statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_; // a national coach arranges friendlies on the older sheet if (menu_ == "friendlies") return notebook_page() && engine_mode_ && engine_data_.contains("desktop") && engine_data_.at("desktop").at("meta").at("scope").at("role") == "club"; diff --git a/src/modern/ui/statistics_analysis.inc b/src/modern/ui/statistics_analysis.inc index 80846b5..e25d4e9 100644 --- a/src/modern/ui/statistics_analysis.inc +++ b/src/modern/ui/statistics_analysis.inc @@ -1,35 +1,30 @@ // SPDX-License-Identifier: GPL-3.0-only -// The club's running season as charts, counted by the engine from the almanac -// (read "analysis", modern::club_analysis). Bars are plain boxes so that every figure is -// type; only the points course is a drawing. +// The club's running season as a page of figures and charts, counted by the engine from the +// almanac (read "analysis", modern::club_analysis). Bars are plain boxes so that every figure +// is type; only the points course is a drawing. std::string App::render_statistics_analysis() { const auto tabs = [&](const std::string ¤t) { - std::string out = "