Port statistics and the news tablet to the Modern UI (by Codex)

This commit is contained in:
Codex committed 2026-10-25 20:10:57 +01:00
1 parent 349c416f3a
commit a45217c362
32 files changed
+2493 -23

No files matched your search

+15 -4
View File
@@ -2,11 +2,12 @@
namespace {
bool report_picker_menu(const std::string &menu) {
return menu == "tables" || menu == "strengths" || menu == "league" ||
menu == "other" || menu == "calendar" || menu == "friendlies" || menu == "almanac" || menu == "scorers";
menu == "other" || menu == "calendar" || menu == "friendlies" || menu == "almanac" || menu == "scorers" || menu == "statistics";
}
bool report_picker_kind(const std::string &kind) {
return kind == "country" || kind == "league" || kind == "filter" ||
kind == "competition" || kind == "year" || kind == "scorer-scope";
kind == "competition" || kind == "year" || kind == "scorer-scope" ||
kind == "stat-section" || kind == "stat-category" || kind == "stat-country" || kind == "winner-country";
}
} // namespace
@@ -15,6 +16,8 @@ App::report_picker_items(const std::string &kind) const {
std::vector<std::pair<std::string, std::string>> items;
if (!world_ || !report_picker_kind(kind))
return items;
if (menu_ == "statistics")
return statistics_picker_items(kind);
if (kind == "scorer-scope") {
if (menu_ == "scorers")
items = {{"0", "Gesamte Liga"}, {"1", "Eigener Verein"}};
@@ -70,6 +73,8 @@ App::report_picker_items(const std::string &kind) const {
std::string App::report_picker_value(const std::string &kind) const {
if (!world_ || !report_picker_kind(kind))
return {};
if (menu_ == "statistics")
return statistics_picker_value(kind);
if (kind == "year") return std::to_string(almanac_year_);
if (menu_ == "scorers") {
if (kind == "scorer-scope") return std::to_string(rankings_view_.value("scope", 0));
@@ -104,7 +109,11 @@ std::string App::report_picker(const std::string &kind, double left,
const bool open = report_picker_ == kind;
const std::string menu_label = kind == "country" ? "Land"
: kind == "league" ? "Liga"
: kind == "filter" ? "Spiele" : kind == "year" ? "Kalenderjahr" : kind == "scorer-scope" ? "Bereich" : "Wettbewerb";
: kind == "filter" ? "Spiele" : kind == "year" ? "Kalenderjahr" : kind == "scorer-scope" ? "Bereich"
: kind == "stat-section" ? "Statistik"
: kind == "stat-category" ? "Wettbewerbsgruppe"
: kind == "winner-country" ? "Land"
: kind == "stat-country" ? "Statistikbereich" : "Wettbewerb";
std::string out =
"<div class=\"report-picker-wrapper\" data-report-picker=\"" + kind +
"\" style=\"left:" + scalar(left) + "dp;width:" + scalar(width) + "dp;\">" +
@@ -198,7 +207,9 @@ bool App::report_picker_action(const std::string &action, Rml::Element *target)
? Json(std::stoi(value)) : Json(value);
close_report_picker(false);
// Commit even an unchanged country: the Gold resets its first league.
if (kind == "year" && menu_ == "almanac") {
if (menu_ == "statistics") {
statistics_picker_select(kind, value);
} else if (kind == "year" && menu_ == "almanac") {
almanac_year_ = std::stoi(value);
almanac_day_.clear();
almanac_match_.clear();