diff --git a/assets/modern/modern.rml b/assets/modern/modern.rml index 0baec07..80a8364 100644 --- a/assets/modern/modern.rml +++ b/assets/modern/modern.rml @@ -1,6 +1,6 @@ OpenBMH - +
diff --git a/assets/modern/postmatch.rcss b/assets/modern/postmatch.rcss new file mode 100644 index 0000000..0d87654 --- /dev/null +++ b/assets/modern/postmatch.rcss @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: GPL-3.0-only */ +.postmatch {position:absolute;left:0;right:0;top:0;bottom:0;display:flex;flex-direction:column;gap:30dp;font-size:34dp;line-height:1.3;color:var(--text);} +.postmatch h2,.postmatch h3,.postmatch p,.postmatch ol {margin:0;} +.postmatch h2>span,.postmatch h3>span,.postmatch p>span {display:block;min-width:0;} +.postmatch button {font-size:30dp;font-weight:normal;color:var(--text);background-color:transparent;} +.postmatch button[disabled] {opacity:.35;} +.postmatch button:hover,.postmatch button:focus-visible {background-color:var(--hover);} +.postmatch .selected {background-color:var(--selected);color:var(--accent);} +.postmatch-heading {display:flex;align-items:center;justify-content:space-between;gap:28dp;min-height:130dp;flex-shrink:0;} +.postmatch-heading>div {flex:1;min-width:0;} +.postmatch-heading p {font-size:28dp;color:var(--muted);margin-bottom:10dp;} +.postmatch-heading h2 {font-size:54dp;font-weight:normal;letter-spacing:-1dp;} +.postmatch-pickers {width:900dp;height:84dp;display:flex;gap:18dp;flex-shrink:0;} +.postmatch-pickers select {flex:1;min-width:0;height:84dp;font-size:30dp;} +.postmatch-tabs {display:flex;gap:8dp;flex-shrink:0;padding:8dp;border-radius:22dp;background-color:var(--panel);border:1dp var(--border);} +.postmatch-tabs button {flex:1;min-width:0;height:84dp;border:0;border-radius:16dp;padding:22dp 12dp;white-space:nowrap;color:var(--muted);} +.postmatch-tabs button.selected {color:var(--text);} +.postmatch-panel {position:relative;min-height:0;flex:1;display:flex;flex-direction:column;} +.postmatch-actions {display:flex;align-items:center;justify-content:space-between;gap:32dp;min-height:84dp;flex-shrink:0;} +.postmatch-actions button {min-width:330dp;height:84dp;font-size:32dp;border:2dp var(--border);background-color:var(--soft);} +.postmatch-actions button:last-child {background-color:var(--selected);border-color:var(--accent);} +.postmatch-status {flex:1;font-size:26dp;text-align:center;color:var(--muted);} +.postmatch-team {display:flex;align-items:center;gap:24dp;flex:1;min-width:0;} +.postmatch-team-name {display:block;min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.postmatch-team.home .postmatch-team-name {text-align:right;} +.postmatch-team.away .postmatch-team-name {text-align:left;} +.postmatch-team>.live-badge {flex-shrink:0;} +.postmatch-results-head {display:flex;align-items:center;gap:18dp;padding:0 35dp 20dp;font-size:26dp;color:var(--muted);flex-shrink:0;} +.postmatch-results-head .home,.postmatch-results-head .away {flex:1;text-align:center;} +.postmatch-results-head .score {width:160dp;text-align:center;flex-shrink:0;} +.postmatch-results {min-height:0;flex:1;overflow-y:auto;} +.postmatch .postmatch-result-row {width:100%;min-height:116dp;border:0;border-top:1dp var(--border);border-radius:14dp;padding:15dp 35dp;display:flex;align-items:center;gap:18dp;font-size:34dp;} +.postmatch-result-row:nth-child(odd) {background-color:var(--panel);} +.postmatch-result-score {width:160dp;flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:22dp;font-size:46dp;font-weight:normal;} +.postmatch-result-score .separator {font-size:32dp;color:var(--muted);} +.postmatch .postmatch-own {color:var(--accent);} +.postmatch-scope-note {font-size:26dp;color:var(--muted);line-height:1.4;flex-shrink:0;margin-top:18dp;} +.postmatch-report {min-height:0;height:100%;display:flex;flex-direction:column;gap:24dp;} +.postmatch-report-teams {display:flex;align-items:flex-start;gap:30dp;flex-shrink:0;} +.postmatch-report-teams>div {flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:18dp;text-align:center;} +.postmatch-report-teams strong {font-size:38dp;font-weight:normal;} +.postmatch-report-teams strong>span {display:block;} +.postmatch-report-teams>.postmatch-report-score {width:340dp;height:140dp;flex:none;flex-direction:row;align-items:center;justify-content:center;gap:30dp;font-size:100dp;} +.postmatch-report-score>.separator {font-size:55dp;color:var(--muted);} +.postmatch-report-meta {font-size:26dp;color:var(--muted);text-align:center;flex-shrink:0;} +.postmatch-event-columns {display:flex;gap:70dp;min-height:0;flex:1;overflow-y:auto;} +.postmatch-event-column {width:50%;min-width:0;padding:0;} +.postmatch-event-column+.postmatch-event-column {border-left:1dp var(--border);padding-left:70dp;} +.postmatch .postmatch-event {display:flex;width:100%;align-items:center;gap:25dp;border:0;border-radius:12dp;text-align:left;padding:17dp 10dp;font-size:30dp;} +.postmatch-event-time {width:75dp;flex-shrink:0;font-size:28dp;color:var(--muted);} +.postmatch-event>.image-frame {flex-shrink:0;} +.postmatch-event-copy {flex:1;min-width:0;display:flex;flex-direction:column;gap:4dp;} +.postmatch-event-copy>strong {font-weight:normal;} +.postmatch-event-copy>span {font-size:26dp;color:var(--muted);} +.postmatch-no-events {padding:35dp 10dp;font-size:28dp;color:var(--muted);} +.postmatch-timeline {display:flex;gap:25dp;padding:10dp 20dp 0;flex-shrink:0;} +.postmatch-timeline-teams {width:440dp;flex-shrink:0;display:flex;flex-direction:column;font-size:25dp;} +.postmatch-timeline-teams>span {height:65dp;line-height:65dp;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.postmatch-timeline-tracks {flex:1;min-width:0;} +.postmatch-track {height:65dp;position:relative;border-bottom:1dp var(--border);background-color:var(--panel);} +.postmatch .postmatch-marker {position:absolute;top:50%;transform:translate(-50%,-50%);width:48dp;height:48dp;min-width:0;padding:4dp;border:0;border-radius:10dp;opacity:.22;} +.postmatch-marker.is-visible {opacity:1;} +.postmatch-ticks {display:flex;justify-content:space-between;padding-top:12dp;font-size:24dp;color:var(--muted);} +.postmatch-seek {display:flex;align-items:center;gap:25dp;padding:0 20dp;flex-shrink:0;} +.postmatch-seek>button {width:380dp;border:1dp var(--border);border-radius:12dp;background-color:var(--soft);padding:18dp;font-size:28dp;} +.postmatch-seek input {flex:1;min-width:0;height:50dp;margin:0;padding:0;border:0;background-color:transparent;} +.postmatch-seek>span {width:85dp;text-align:right;font-size:30dp;color:var(--accent);} +.postmatch-recorded-note {font-size:24dp;color:var(--muted);text-align:center;flex-shrink:0;} +.postmatch-fixture-nav {display:flex;justify-content:space-between;align-items:center;gap:24dp;padding-top:20dp;border-top:1dp var(--border);flex-shrink:0;} +.postmatch-fixture-nav>span {flex:1;min-width:0;font-size:25dp;text-align:center;color:var(--muted);} +.postmatch-fixture-nav>button {min-height:65dp;font-size:26dp;white-space:nowrap;} +.postmatch-eleven {display:flex;gap:75dp;flex:1;min-height:0;} +.postmatch-pitch {width:45%;height:100%;min-width:0;border:2dp var(--border);border-radius:26dp;background-color:#31595077;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:35dp;padding:45dp;} +.postmatch-pitch p {font-size:30dp;color:var(--text);text-align:center;} +.postmatch-eleven-list {flex:1;min-width:0;overflow-y:auto;padding-top:60dp;} +.postmatch-eleven-list h3 {font-size:42dp;font-weight:normal;margin-bottom:35dp;} +.postmatch-eleven-list p {font-size:32dp;line-height:1.6;margin-bottom:35dp;color:var(--muted);} +.postmatch-overview {display:flex;flex-direction:column;justify-content:center;gap:55dp;flex:1;min-height:0;} +.postmatch-total-grid {display:flex;flex-wrap:wrap;gap:35dp;} +.postmatch-total {width:48%;flex-grow:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20dp;min-height:405dp;border:1dp var(--border);border-radius:28dp;background-color:var(--panel);} +.postmatch-total strong {font-size:100dp;font-weight:normal;letter-spacing:-2dp;} +.postmatch-total strong>span {display:block;} +.postmatch-total>span {font-size:32dp;} +.postmatch-overview>p {font-size:28dp;color:var(--muted);text-align:center;} +.postmatch-table-note {font-size:25dp;color:var(--muted);margin-bottom:20dp;flex-shrink:0;} +.postmatch-table-scroll {min-height:0;flex:1;overflow-y:auto;} +.postmatch-table-row {display:flex;align-items:center;min-height:65dp;border-bottom:1dp var(--border);font-size:30dp;} +.postmatch-table-row>span {flex:1;min-width:0;text-align:center;} +.postmatch-table-row>span:nth-child(1) {width:85dp;flex:none;} +.postmatch-table-row>span:nth-child(2) {width:790dp;flex:none;text-align:left;} +.postmatch-table-row>span:nth-child(7) {width:180dp;flex:none;} +.postmatch-table-row .postmatch-team {font-size:29dp;gap:20dp;} +.postmatch-table-row.heading {color:var(--muted);background-color:var(--panel);} +.postmatch-table-row:nth-child(even) {background-color:var(--panel);} +.postmatch-dialog {width:2484dp;} +.postmatch-dialog h2 {text-align:center;width:100%;} + +.postmatch-event-column li {display:block;} +/* Same portrait field/list geometry for supplied records and the honest empty state. */ +.postmatch-pitch-holder {position:relative;width:46%;height:100%;min-height:0;flex-shrink:0;} +.postmatch-pitch-surface {position:absolute;overflow:hidden;border-radius:26dp;background-color:#31595077;} +.postmatch-pitch-art {position:absolute;left:0;top:0;} +.postmatch .postmatch-field-player {position:absolute;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:10dp;width:160dp;padding:0;border:0;border-radius:15dp;background-color:transparent;text-align:center;} +.postmatch-field-badge {display:flex;align-items:center;justify-content:center;width:82dp;height:82dp;border-radius:41dp;background-color:var(--panel);} +.postmatch-field-player strong {width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:24dp;font-weight:normal;} +.postmatch-field-player strong>span {display:block;} +.postmatch-eleven-list {padding-top:0;} +.postmatch-eleven-list ol {padding:0;} +.postmatch-eleven-notice {font-size:24dp;line-height:1.3;margin-bottom:18dp;} +.postmatch-nominee-row {display:flex;align-items:center;gap:30dp;min-height:99dp;border-bottom:1dp var(--border);padding:10dp 0;} +.postmatch-position {font-size:23dp;background-color:var(--panel);border:1dp var(--border);border-radius:12dp;padding:12dp;min-width:90dp;text-align:center;} +.postmatch-nominee-copy {display:flex;flex-direction:column;gap:8dp;min-width:0;flex:1;} +.postmatch .postmatch-nominee-name {border:0;padding:0;justify-content:flex-start;text-align:left;font-size:31dp;} +.postmatch .postmatch-nominee-club {display:flex;align-items:center;gap:15dp;border:0;padding:0;justify-content:flex-start;font-size:25dp;color:var(--muted);} +.postmatch-nominee-club .live-badge {flex-shrink:0;} +.postmatch-player-summary {display:flex;flex-direction:column;align-items:center;gap:28dp;text-align:center;} +.postmatch-player-facts {display:flex;flex-wrap:wrap;gap:25dp;} +.postmatch-player-facts>div {width:47%;flex-grow:1;display:flex;flex-direction:column;align-items:center;gap:15dp;padding:30dp;border:1dp var(--border);border-radius:18dp;} +.postmatch-player-facts dt {font-size:30dp;color:var(--muted);} +.postmatch-player-facts dd {margin:0;font-size:60dp;font-weight:normal;} +.postmatch-detail-result {text-align:center;margin:28dp 0;font-size:34dp;} diff --git a/docs/new_ui/README.md b/docs/new_ui/README.md index a81c727..af8192a 100644 --- a/docs/new_ui/README.md +++ b/docs/new_ui/README.md @@ -21,6 +21,7 @@ Implementierung in der Spiel-Engine. | Saisonvorbereitung | [Teilnehmer, Ziehung und Fortsetzung](main-menu/opening/README.md) | | Desktop | [Statusleiste, Gestaltung und Fenster](desktop/README.md) | | Live-Ticker-Demo | [Vorgegebene Aufzeichnung, unabhängige Managerdetails und Read-Provider](desktop/live/README.md) | +| Nach dem Spiel | [Native 5/3-Seitenauswertung der gehaltenen Aufnahme](desktop/post-match/README.md) | | Manager & Rollen | [Aktive Person, Nationalansicht, Abgabe und Hallenaufgebot](desktop/manager/README.md) | | Widgets | [17 Typen, 48 Größen, Raster, Fixierung und Arbeitsanordnung](desktop/widgets/README.md) | | Dateiverwaltung | [Spielstände und Desktopansichten mit Vorschauen](desktop/save-load/README.md) | diff --git a/docs/new_ui/desktop/post-match/README.md b/docs/new_ui/desktop/post-match/README.md new file mode 100644 index 0000000..e7c5e4e --- /dev/null +++ b/docs/new_ui/desktop/post-match/README.md @@ -0,0 +1,82 @@ + +# Nach dem Spiel · native Modern UI + +Stand: 27. Oktober 2026. Layoutreferenz ist der private HTML-Goldstand +`673021b0`, `desktop/post-match.js/.css`. Die native Ansicht verwendet dieselbe +proportionale 4:3-Glasscheibe, Kopf-/Tab-/Fußabstände, zentrierte Ergebnispaare, +zweispurige Ereigniszeitleiste und getrennte Seiten-/Partienavigation. + +Club/Rasen zeigt Ergebnisse, Spielbericht, Elf des Tages, Übersicht und Tabelle. +National- oder Hallenkontext zeigt ausschließlich Ergebnisse, Spielbericht und +Übersicht; dort gibt es keine Club-Ligapicker. Alle menschlichen Teams aus dem +DTO werden gleich markiert. Eine zusätzliche Managerleiste wird nicht erfunden. +Die vorhandenen Land-/Ligapicker sind auf tatsächlich aufgezeichnete Gruppen +begrenzt; fehlende Partien anderer Ligen werden nicht ergänzt. + +## Daten und Darstellung + +Die [Providerbeschreibung](PROVIDER.md) und +[optional gelieferte Nominierungen](PROVIDER.md) definieren die reinen Projektionen. +Ergebnisse, Bericht, Karten, Chancen und vorhandene finale Tabellenzeilen stammen +unverändert aus der gehaltenen UI-Liveaufnahme. Die Übersicht summiert jede +sichtbare Partie einmal. Unbekannte Zuschauer, Spielerzuordnungen, Noten sowie +Siege/Unentschieden/Niederlagen bleiben — oder ausdrücklich nicht aufgezeichnet. +Es entstehen keine geschätzten Individualstatistiken oder Saisonergebnisse. + +Der Standard-Demodatensatz enthält keine Nominierungen. Der Elf-Reiter zeigt +deshalb ein leeres proportionales Spielfeld und eine verständliche Leermeldung. +Ein ausdrücklich geliefertes, vom Provider validiertes Elfobjekt rendert dagegen +alle elf Positionen in 3-4-3, volle Namen und Teamangaben in der Liste sowie +Spieler-/Teamdetails. `rating:null` bleibt —. Ein eigener synthetischer +Layoutdatensatz prüft diesen Produktionsbuilder; er wird nicht heimlich in +fehlende Nominierungen des Standardspiels eingesetzt. Es gibt keinen neuen +Produkt-Debugschalter. + +Beim Öffnen wird der vorhandene `read_post_match`-Hook einmal konsultiert, nur +solange Quelle, Katalog und Aufnahmerevision noch gebunden sind. Schema, +Fixture-ID, Revision, Abschlusssequenz und die unveränderten Aufnahmefakten +müssen passen. Gelieferte Nominierungen durchlaufen erneut die strenge +Recordsvalidierung des Providers. Veraltete oder beschädigte Antworten werden +abgewiesen. Nur eine ausdrücklich als `ui-demo-fixture` markierte Aufnahme darf +bei `post_match_unavailable` ihren vorhandenen reinen Demorückblick verwenden; +für einen späteren Engineanbieter wird kein Ersatzresultat erfunden. + +## Lokale Bedienung + +Ergebniszeilen öffnen ihren Bericht; vorige/nächste Partie bleibt auf die +vorhandene Gruppe begrenzt. Ereignisse und Zeitleistenmarker wählen die +Berichtsminute. Range, Pfeiltasten/Home/End und lokale Rückblickwiedergabe +verändern nur diesen Cursor. Der echte Range-Knoten bleibt beim Seek erhalten. +Der angezeigte Stand ist jeweils der letzte vorhandene Aufnahmeframe bis zur +Cursor-Minute; es wird kein Zwischenstand berechnet. + +Pfeile/Home/End auf den Tabs wechseln wie Gold die Seite. Tab bleibt im +Fenster beziehungsweise offenen Detaildialog. Escape/Rechtsklick schließt +zuerst Details, ansonsten führt es zum Ticker. „Zum Ticker“ zeigt ausschließlich +dieselbe gehaltene Aufnahme mit unverändertem Owner, Cursor, Filtern, +Aufstellungsentwürfen und Scrollstand. Die lokale Reviewwiedergabe pausiert bei +Fokusverlust. Die letzte Seite führt zum Desktop, ohne Saisonfortsetzung. +Erneuter Anstoß öffnet bei derselben fertigen Aufnahme direkt die zuletzt +gewählte Auswertungsseite; neue Quelle/Revision verwirft den alten lokalen Cache. + +Navigation, Scroll, Details und Rückblick sind reiner Ansichtsstatus. Sie +verändern weder Sourcezustand, Revision, Dirty, RNG, Welt, Kalender, Budget noch +Engine. Sie werden nicht als absolvierte Enginepartie in ein Karrierecheckpoint +übernommen. Eine tatsächliche Fortsetzung braucht später einen Backendvertrag. + +## Prüfung und Grenzen + +Der native App-Link sowie `modern_post_match_ui_tests` und der vorhandene +`modern_control_layout_tests` bestehen. Letzterer rendert auch den ausdrücklich +synthetischen 11er-Builder in drei Themes und vier Dichten, prüft elf sichtbare +Feld-/Listensteuerungen, das Seitenverhältnis und Position/Note im Detail. + +Die erste geschlossene native Eingabekohorte besteht mit 33/33 Prüfungen: +vier menschliche Clubmanager in Midnight 1080p, National in Silver 720p und +Halle in Matchday 1080p. Sie prüft 5/3 Tabs, Bericht, Range-/Ereignisseek, +unveränderten Source/Revision/Dirty, unveränderte Tickeraufnahme/Entwürfe/Scroll +bei Rückkehr und Desktop→erneuter Anstoß auf die erhaltene letzte Seite. +Private Bilder und Zustände werden getrennt mit tatsächlichem Binaryhash +geführt. Eine numerische Glyphenparität oder Windows-/macOS-Laufzeitabnahme +wird damit nicht behauptet. Der verfügbare Elfzweig hat zusätzlich einen +separaten synthetischen Dokument-Rendernachweis; die Standardaufnahme bleibt leer. diff --git a/src/modern/ui/CMakeLists.txt b/src/modern/ui/CMakeLists.txt index e43c716..7d8fbf8 100644 --- a/src/modern/ui/CMakeLists.txt +++ b/src/modern/ui/CMakeLists.txt @@ -38,7 +38,7 @@ endif() set(modern_assets "${CMAKE_BINARY_DIR}/assets/modern") FetchContent_GetProperties(rmlui) file(MAKE_DIRECTORY "${modern_assets}") -foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss indoor.rcss planning.rcss almanac.rcss finance.rcss bank.rcss contracts.rcss amount.rcss environment.rcss advertising.rcss toto.rcss lineup.rcss live.rcss transfer.rcss career_reports.rcss rankings.rcss stadium.rcss statistics.rcss news.rcss news-catalog.json settings.rcss widgets.rcss files.rcss front.rcss entry.rcss opening.rcss select_menu.rcss career.rcss national.rcss) +foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss indoor.rcss planning.rcss almanac.rcss finance.rcss bank.rcss contracts.rcss amount.rcss environment.rcss advertising.rcss toto.rcss lineup.rcss live.rcss transfer.rcss career_reports.rcss rankings.rcss stadium.rcss statistics.rcss news.rcss news-catalog.json settings.rcss widgets.rcss files.rcss front.rcss entry.rcss opening.rcss select_menu.rcss career.rcss national.rcss postmatch.rcss) configure_file("${CMAKE_SOURCE_DIR}/assets/modern/${asset}" "${modern_assets}/${asset}" COPYONLY) endforeach() diff --git a/src/modern/ui/live_controls.inc b/src/modern/ui/live_controls.inc index 316f655..cb96b7c 100644 --- a/src/modern/ui/live_controls.inc +++ b/src/modern/ui/live_controls.inc @@ -10,6 +10,7 @@ bool App::live_open() { message("Live-Ticker nicht verfügbar: " + fixture.value("error", "invalid_live_fixture")); return false; } live_source_ = source_.get(); live_world_ = snapshot.world; + postmatch_data_=Json::object();postmatch_scrolls_=Json::object();postmatch_playing_=false; live_drafts_ = Json::object(); live_dialog_.clear(); live_dialog_draft_ = Json(); live_coverage_ = "all"; live_filter_ = "all"; live_tab_ = "team"; live_selected_match_ = fixture.at("matches").front().at("id"); @@ -19,10 +20,12 @@ bool App::live_open() { } live_review_ = false; live_speed_dragging_ = false; live_last_tick_ = SDL_GetTicks64(); scene_ = "live"; menu_.clear(); - focus_after_render_ = live_.finished() ? "live-review" : "live-next"; + if(live_.finished())return postmatch_open(); + focus_after_render_ = "live-next"; refresh(); return true; } void App::live_close() { + live_review_=false;postmatch_playing_=false; live_.speed(0); live_dialog_.clear(); live_dialog_draft_ = Json(); live_resume_speed_ = 0; live_speed_dragging_ = false; scene_ = "desktop"; menu_.clear(); focus_after_render_ = "object-app-kickoff"; refresh(); @@ -48,6 +51,7 @@ void App::live_set_speed(int value) { void App::live_tick() { if (scene_ != "live" || !live_.available()) return; const auto now = SDL_GetTicks64(), elapsed = now - live_last_tick_; live_last_tick_ = now; + if(live_review_){postmatch_tick(now);return;} if (!popup_.empty() || !live_dialog_.empty() || live_speed_dragging_ || live_review_) return; const auto current = source_ ? source_->snapshot() : Snapshot(); if (!source_ || source_.get() != live_source_ || current.world != live_world_ || @@ -79,6 +83,7 @@ void App::live_dialog_close(bool apply_draft) { refresh(); } bool App::live_action(const std::string &action, Rml::Element *target) { + if(action.starts_with("postmatch-"))return postmatch_action(action,target); if (action == "open:kickoff") { live_open(); return true; } if (!action.starts_with("live-")) return false; if (scene_ != "live" || !live_.available()) return true; @@ -111,9 +116,9 @@ bool App::live_action(const std::string &action, Rml::Element *target) { } else if (action == "live-pause") { live_set_speed(live_.speed() ? 0 : 1); } else if (action == "live-review" && live_.finished()) { - live_review_ = true; + postmatch_open();return true; } else if (action == "live-review-back") { - live_review_ = false; + postmatch_action("postmatch-ticker",target);return true; } else if (action == "live-intervene-lineup" || action == "live-intervene-tactics") { if (live_.finished()) return true; const auto owner = live_owner(); live_dialog_draft_ = live_owner_state(owner); @@ -138,6 +143,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) { refresh(); return true; } bool App::live_event(Rml::Event &event) { + if(live_review_)return postmatch_event(event); if (scene_ != "live" || !live_.available() || !popup_.empty()) return false; const auto type = event.GetType(); auto *target = event.GetTargetElement(); bool speed_control = false; @@ -199,7 +205,7 @@ bool App::live_event(Rml::Event &event) { Json App::live_snapshot() const { auto status = live_.status(); status["tab"] = live_tab_; status["coverage"] = live_coverage_; status["selected_match"] = live_selected_match_; status["filter"] = live_filter_; - status["review"] = live_review_; status["dialog"] = live_dialog_; + status["review"] = live_review_; status["postmatch"] = postmatch_snapshot(); status["dialog"] = live_dialog_; status["drafts"] = live_drafts_; status["dialog_draft"] = live_dialog_draft_; status["ticker_scroll"] = element("live-ticker") ? element("live-ticker")->GetScrollTop() : live_ticker_scroll_; status["frame"] = live_.frame(); diff --git a/src/modern/ui/live_screens.inc b/src/modern/ui/live_screens.inc index f960be5..0ac34bd 100644 --- a/src/modern/ui/live_screens.inc +++ b/src/modern/ui/live_screens.inc @@ -137,6 +137,7 @@ std::string App::live_dialog_markup(const Json &owner) { return "
" + body + "
"; } std::string App::render_live() { + if(live_review_) return render_postmatch(); if (!live_.available()) return ""; if (auto *node = element("live-ticker")) live_ticker_scroll_ = live_reset_ticker_ ? 0 : node->GetScrollTop(); if (auto *node = element("live-detail-body")) live_detail_scroll_ = live_reset_detail_ ? 0 : node->GetScrollTop(); @@ -152,12 +153,6 @@ std::string App::render_live() { const auto &value = live_score_by_id(frame, match.at("id")); return "
" + live_text(match.at("home").at("name"), "live-team-name home") + live_badge(match.at("home"), 58) + live_text(live_score_text(value.at("score")), "live-score") + live_badge(match.at("away"), 58) + live_text(match.at("away").at("name"), "live-team-name away") + "
"; }; - if (live_review_) { - out += "

" + live_text("Die Demoaufzeichnung ist abgeschlossen.") + "

" + live_text("Diese Ergebnisse und Berichte sind vorgegeben. Datum, Tabellen, Konten und Saisonfortschritt der Quelle wurden nicht verändert.") + "

"; - for (const auto &match : fixture.at("matches")) out += "
()) + "\">" + scoreline(match) + "

" + live_text("1:0 · Führung der Heimelf | Halbzeit 1:0 | 1:1 · Ausgleich | 2:1 · Endstand nach " + std::to_string(fixture.at("duration").get()) + " Minuten") + "

"; - out += "
"; - return out; - } out += "
"; } void App::live_after_render() { + if(live_review_){postmatch_after_render();return;} if (scene_ != "live" || !live_restore_scroll_) return; live_restore_scroll_ = false; if (auto *node = element("live-ticker")) node->SetScrollTop(live_ticker_scroll_); diff --git a/src/modern/ui/postmatch_controls.inc b/src/modern/ui/postmatch_controls.inc new file mode 100644 index 0000000..c961f0d --- /dev/null +++ b/src/modern/ui/postmatch_controls.inc @@ -0,0 +1,463 @@ +// SPDX-License-Identifier: GPL-3.0-only +bool App::postmatch_open() { + if (!live_.available() || !live_.finished()) + return false; + auto data = make_demo_post_match(live_.fixture(), live_.sequence()); + if (!data.value("ok", false)) { + message("Die Auswertung dieser Aufnahme ist nicht verfügbar."); + return false; + } + try { + const auto current = snap(); + if (source_.get() != live_source_ || current.world != live_world_ || + current.revision != live_.fixture().at("source_revision")) { + message("Die Quelle dieser Aufnahme hat sich geändert. Eine neue " + "Auswertung wird nicht angenommen."); + return false; + } + const auto reply = source_->read_post_match( + {{"kind", "review"}, + {"fixture_id", live_.fixture().at("fixture_id")}, + {"revision", current.revision}, + {"completed_sequence", live_.sequence()}}); + if (reply.is_object() && reply.value("ok", false)) { + for (const auto *key : + {"schema", "source", "fixture_id", "source_revision", + "completed_sequence", "world", "role", "surface", "duration", + "owners", "tabs", "matches", "tables", "overview"}) + if (!reply.contains(key) || reply.at(key) != data.at(key)) + throw editor::Error("incompatible_review_reply"); + if (reply.at("kind") != "review") + throw editor::Error("invalid_review_kind"); + const auto &eleven = reply.at("eleven"); + if (eleven.is_object() && eleven.value("available", false)) { + auto checked = make_demo_post_match( + live_.fixture(), live_.sequence(), + {{"schema", "openbmh-post-match-records@1"}, + {"fixture_id", data.at("fixture_id")}, + {"source_revision", data.at("source_revision")}, + {"eleven", eleven}}); + if (!checked.value("ok", false)) + throw editor::Error("invalid_review_records"); + data = std::move(checked); + } else if (eleven != data.at("eleven")) + throw editor::Error("invalid_unavailable_review"); + } else if (!(reply.is_object() && + reply.value("error", "") == "post_match_unavailable" && + live_.fixture().value("source", "") == "ui-demo-fixture")) + throw editor::Error("review_source_unavailable"); + } catch (const std::exception &) { + message("Die Auswertungsdaten sind veraltet, unvollständig oder nicht " + "verfügbar. Die gehaltene Aufnahme bleibt unverändert."); + return false; + } + if (!postmatch_data_.value("ok", false) || + postmatch_data_.at("fixture_id") != data.at("fixture_id")) { + postmatch_data_ = data; + postmatch_tab_ = "results"; + postmatch_owner_ = live_.owner(); + postmatch_match_ = live_selected_match_; + if (std::none_of(postmatch_data_.at("matches").begin(), + postmatch_data_.at("matches").end(), [&](const auto &m) { + return m.at("id") == postmatch_match_; + })) + postmatch_match_ = postmatch_data_.at("matches")[0].at("id"); + for (const auto &g : postmatch_groups()) + if (std::find(g.at("match_ids").begin(), g.at("match_ids").end(), + Json(postmatch_match_)) != g.at("match_ids").end()) { + postmatch_country_ = g.at("country"); + postmatch_league_ = g.at("id"); + break; + } + postmatch_minute_ = postmatch_data_.at("duration"); + postmatch_scrolls_ = Json::object(); + postmatch_rendered_scope_.clear(); + } + postmatch_data_ = std::move(data); + if (auto *n = element("live-ticker")) + live_ticker_scroll_ = n->GetScrollTop(); + if (auto *n = element("live-detail-body")) + live_detail_scroll_ = n->GetScrollTop(); + postmatch_playing_ = false; + postmatch_elapsed_ = 0; + postmatch_dialog_.clear(); + live_review_ = true; + focus_after_render_ = "postmatch-tab-" + postmatch_tab_; + refresh(); + return true; +} +void App::postmatch_seek(int minute, bool stop) { + if (!postmatch_data_.value("ok", false)) + return; + if (stop) { + postmatch_playing_ = false; + postmatch_elapsed_ = 0; + } + postmatch_minute_ = + std::clamp(minute, 0, postmatch_data_.at("duration").get()); + postmatch_update_report(); +} +void App::postmatch_update_report() { + if (!live_review_ || postmatch_tab_ != "report") + return; + const auto report = postmatch_report(); + if (!report.value("ok", false)) + return; + const auto &score = report.at("score"); + if (auto *n = element("postmatch-score")) + n->SetInnerRML(live_text(std::to_string(score[0].get())) + + live_text(":", "separator") + + live_text(std::to_string(score[1].get()))); + if (auto *n = element("postmatch-events")) { + const float scroll = n->GetScrollTop(); + n->SetInnerRML(postmatch_events(report, "home") + + postmatch_events(report, "away")); + context_->Update(); + n->SetScrollTop(scroll); + } + size_t index = 0; + for (const auto &event : report.at("timeline")) { + if (auto *n = element("postmatch-marker-" + std::to_string(index))) + n->SetClass("is-visible", event.at("sequence") <= report.at("sequence")); + ++index; + } + postmatch_updating_ = true; + if (auto *n = + dynamic_cast(element("postmatch-minute"))) + n->SetValue(std::to_string(postmatch_minute_)); + postmatch_updating_ = false; + if (auto *n = element("postmatch-minute-label")) + n->SetInnerRML(std::to_string(postmatch_minute_) + "′"); + if (auto *n = element("postmatch-recorded-note")) + n->SetInnerRML( + live_text("Aufgezeichneter Stand: " + + std::to_string(report.at("recorded_minute").get()) + + "′ · keine Zwischenberechnung")); + if (auto *n = element("postmatch-play")) { + n->SetInnerRML(live_text( + postmatch_playing_ ? "Pause" : "Rückblick abspielen", "control-label")); + n->SetAttribute("aria-pressed", postmatch_playing_ ? "true" : "false"); + } + dirty_ = true; +} +void App::postmatch_tick(uint64_t now) { + const auto elapsed = postmatch_last_tick_ ? now - postmatch_last_tick_ : 0; + postmatch_last_tick_ = now; + if (!live_review_ || !postmatch_playing_ || postmatch_tab_ != "report" || + !popup_.empty() || !postmatch_dialog_.empty()) + return; + const auto flags = SDL_GetWindowFlags(video_.window); + if (!(flags & SDL_WINDOW_INPUT_FOCUS) || + (flags & (SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED))) { + postmatch_playing_ = false; + postmatch_update_report(); + return; + } + postmatch_elapsed_ += std::min(elapsed, 1000); + if (postmatch_elapsed_ >= 180) { + const int step = int(postmatch_elapsed_ / 180); + postmatch_elapsed_ %= 180; + const int duration = postmatch_data_.at("duration"); + if (postmatch_minute_ + step >= duration) + postmatch_playing_ = false; + postmatch_seek(std::min(duration, postmatch_minute_ + step), false); + } +} +bool App::postmatch_action(const std::string &action, Rml::Element *target) { + if (!action.starts_with("postmatch-")) + return false; + if (!live_review_ || !postmatch_data_.value("ok", false) || !popup_.empty()) + return true; + const auto id = + target ? target->GetAttribute("data-id", "") : ""; + if (!postmatch_dialog_.empty() && action != "postmatch-detail-close" && + action != "postmatch-detail-report") + return true; + if (action == "postmatch-ticker") { + postmatch_playing_ = false; + live_review_ = false; + live_last_tick_ = SDL_GetTicks64(); + focus_after_render_ = "live-review"; + refresh(); + return true; + } + if (action == "postmatch-desktop") { + postmatch_playing_ = false; + live_close(); + return true; + } + if (action == "postmatch-detail-close") { + postmatch_dialog_.clear(); + focus_after_render_ = "postmatch-heading"; + refresh(); + return true; + } + if (action == "postmatch-detail-report") { + for (const auto &m : postmatch_data_.at("matches")) + if (m.at("home").at("id") == postmatch_detail_team_ || + m.at("away").at("id") == postmatch_detail_team_) { + postmatch_match_ = m.at("id"); + for (const auto &g : postmatch_groups()) + if (std::find(g.at("match_ids").begin(), g.at("match_ids").end(), + m.at("id")) != g.at("match_ids").end()) { + postmatch_country_ = g.at("country"); + postmatch_league_ = g.at("id"); + break; + } + postmatch_dialog_.clear(); + postmatch_tab_ = "report"; + postmatch_minute_ = postmatch_data_.at("duration"); + postmatch_playing_ = false; + focus_after_render_ = "postmatch-heading"; + refresh(); + break; + } + return true; + } + if (action == "postmatch-player" || action == "postmatch-club") { + const auto &eleven = postmatch_data_.at("eleven"); + if (eleven.value("available", false)) + for (const auto &row : eleven.at("rows")) + if ((action == "postmatch-player" && row.at("player").at("id") == id) || + (action == "postmatch-club" && row.at("team").at("id") == id)) { + postmatch_detail_team_ = row.at("team").at("id"); + postmatch_detail_player_ = + action == "postmatch-player" + ? row.at("player").at("id").get() + : ""; + postmatch_dialog_ = action == "postmatch-player" ? "player" : "club"; + postmatch_playing_ = false; + focus_after_render_ = "postmatch-detail-close"; + refresh(); + break; + } + return true; + } + if (!postmatch_dialog_.empty()) + return true; + const auto &tabs = postmatch_data_.at("tabs"); + if (action == "postmatch-tab") { + if (std::find(tabs.begin(), tabs.end(), Json(id)) == tabs.end()) + return true; + postmatch_tab_ = id; + postmatch_playing_ = false; + focus_after_render_ = "postmatch-tab-" + id; + } else if (action == "postmatch-prev" || action == "postmatch-next") { + const auto current = + std::find(tabs.begin(), tabs.end(), Json(postmatch_tab_)); + int at = + int(current - tabs.begin()) + (action == "postmatch-next" ? 1 : -1); + if (at < 0) + return true; + if (at >= int(tabs.size())) { + postmatch_playing_ = false; + live_close(); + return true; + } + postmatch_tab_ = tabs[size_t(at)]; + postmatch_playing_ = false; + focus_after_render_ = "postmatch-heading"; + } else if (action == "postmatch-fixture" || + action == "postmatch-fixture-prev" || + action == "postmatch-fixture-next") { + const auto matches = postmatch_matches(); + std::string chosen = id; + if (action != "postmatch-fixture") + for (size_t i = 0; i < matches.size(); ++i) + if (matches[i].at("id") == postmatch_match_) { + const int next = + int(i) + (action == "postmatch-fixture-prev" ? -1 : 1); + if (next >= 0 && next < int(matches.size())) + chosen = matches[size_t(next)].at("id"); + break; + } + if (std::none_of(matches.begin(), matches.end(), + [&](const auto &m) { return m.at("id") == chosen; })) + return true; + postmatch_match_ = chosen; + postmatch_tab_ = "report"; + postmatch_minute_ = postmatch_data_.at("duration"); + postmatch_playing_ = false; + focus_after_render_ = "postmatch-heading"; + } else if (action == "postmatch-event") { + const auto report = postmatch_report(); + for (const auto &e : report.at("timeline")) + if (e.at("id") == id) { + postmatch_seek(e.at("minute")); + break; + } + return true; + } else if (action == "postmatch-play") { + postmatch_playing_ = !postmatch_playing_; + postmatch_last_tick_ = SDL_GetTicks64(); + postmatch_elapsed_ = 0; + if (postmatch_playing_ && + postmatch_minute_ == postmatch_data_.at("duration")) + postmatch_minute_ = 0; + postmatch_update_report(); + return true; + } else + return true; + refresh(); + return true; +} +bool App::postmatch_event(Rml::Event &event) { + if (scene_ != "live" || !live_review_ || !menu_.empty() || !popup_.empty()) + return false; + const auto type = event.GetType(); + auto *target = event.GetTargetElement(); + if ((type == "change" || type == "input") && target) { + if (postmatch_updating_ || setting_menu_markup_) + return true; + const auto id = target->GetId(); + if (id == "postmatch-minute") { + try { + postmatch_seek(std::stoi(field(id))); + } catch (const std::exception &) { + } + return true; + } + if (id == "postmatch-country" || id == "postmatch-league") { + const auto value = field(id); + const auto groups = postmatch_groups(); + for (const auto &g : groups) + if ((id == "postmatch-country" && g.at("country") == value) || + (id == "postmatch-league" && g.at("id") == value && + g.at("country") == postmatch_country_)) { + postmatch_country_ = g.at("country"); + postmatch_league_ = g.at("id"); + postmatch_match_ = g.at("match_ids")[0]; + postmatch_minute_ = postmatch_data_.at("duration"); + postmatch_playing_ = false; + focus_after_render_ = id; + refresh(); + break; + } + return true; + } + } + bool minute_control = false; + for (auto *n = target; n && n != doc_; n = n->GetParentNode()) + if (n->GetId() == "postmatch-minute") + minute_control = true; + const auto key = type == "keydown" + ? Rml::Input::KeyIdentifier( + event.GetParameter("key_identifier", 0)) + : Rml::Input::KI_UNKNOWN; + if (minute_control && + (key == Rml::Input::KI_LEFT || key == Rml::Input::KI_RIGHT || + key == Rml::Input::KI_UP || key == Rml::Input::KI_DOWN || + key == Rml::Input::KI_HOME || key == Rml::Input::KI_END)) { + postmatch_seek(key == Rml::Input::KI_HOME ? 0 + : key == Rml::Input::KI_END + ? postmatch_data_.at("duration").get() + : postmatch_minute_ + ((key == Rml::Input::KI_RIGHT || + key == Rml::Input::KI_UP) + ? 1 + : -1)); + event.StopImmediatePropagation(); + return true; + } + if (key == Rml::Input::KI_ESCAPE || + (type == "mouseup" && event.GetParameter("button", 0) == 1)) { + postmatch_action(postmatch_dialog_.empty() ? "postmatch-ticker" + : "postmatch-detail-close", + nullptr); + event.StopImmediatePropagation(); + return true; + } + if (key == Rml::Input::KI_TAB) { + Rml::ElementList rows; + doc_->QuerySelectorAll(rows, + postmatch_dialog_.empty() + ? ".postmatch-window button,.postmatch-window " + "input,.postmatch-window select" + : "#postmatch-dialog-layer button"); + std::erase_if(rows, [](auto *n) { + return !n->IsVisible(true) || n->HasAttribute("disabled") || + n->template GetAttribute("tabindex", "") == "-1"; + }); + if (!rows.empty()) { + auto at = + std::find(rows.begin(), rows.end(), context_->GetFocusElement()); + const bool back = event.GetParameter("shift_key", 0) != 0; + int index = at == rows.end() ? (back ? 0 : -1) : int(at - rows.begin()); + rows[size_t((index + int(rows.size()) + (back ? -1 : 1)) % + int(rows.size()))] + ->Focus(true); + } + event.StopImmediatePropagation(); + return true; + } + if (postmatch_dialog_.empty() && target && + target->GetId().starts_with("postmatch-tab-") && + (key == Rml::Input::KI_LEFT || key == Rml::Input::KI_RIGHT || + key == Rml::Input::KI_HOME || key == Rml::Input::KI_END)) { + const auto &tabs = postmatch_data_.at("tabs"); + const auto at = std::find(tabs.begin(), tabs.end(), Json(postmatch_tab_)); + int index = key == Rml::Input::KI_HOME ? 0 + : key == Rml::Input::KI_END + ? int(tabs.size()) - 1 + : (int(at - tabs.begin()) + int(tabs.size()) + + (key == Rml::Input::KI_RIGHT ? 1 : -1)) % + int(tabs.size()); + postmatch_action( + "postmatch-tab", + element("postmatch-tab-" + tabs[size_t(index)].get())); + event.StopImmediatePropagation(); + return true; + } + if (type == "click") + for (auto *n = target; n && n != doc_; n = n->GetParentNode()) + if (n->HasAttribute("data-action")) { + const auto action = n->GetAttribute("data-action", ""); + if (action.starts_with("postmatch-")) { + if (!n->HasAttribute("disabled")) + postmatch_action(action, n); + event.StopImmediatePropagation(); + return true; + } + } + return false; +} +void App::postmatch_after_render() { + if (scene_ != "live" || !live_review_) + return; + fit_postmatch_pitch(*doc_); + if (postmatch_restore_scroll_) { + for (const auto *id : {"postmatch-results", "postmatch-events", + "postmatch-eleven-list", "postmatch-table"}) + if (auto *n = element(id)) { + const auto key = postmatch_rendered_scope_ + "|" + id; + if (postmatch_scrolls_.contains(key)) + n->SetScrollTop(postmatch_scrolls_.at(key).get()); + } + postmatch_restore_scroll_ = false; + } + if (!postmatch_dialog_.empty()) { + Rml::ElementList underlay; + doc_->QuerySelectorAll(underlay, + "#postmatch-underlay button,#postmatch-underlay " + "input,#postmatch-underlay select,#postmatch-close"); + for (auto *n : underlay) { + n->SetProperty("pointer-events", "none"); + n->SetAttribute("tabindex", -1); + } + } + Rml::ElementList behind; + doc_->QuerySelectorAll(behind, + ".desktop-layer button,.desktop-layer [data-action]"); + for (auto *n : behind) { + n->SetProperty("pointer-events", "none"); + n->SetAttribute("tabindex", -1); + } +} +Json App::postmatch_snapshot() const { + if (!postmatch_data_.value("ok", false)) + return Json(); + return {{"tab", postmatch_tab_}, {"match_id", postmatch_match_}, + {"minute", postmatch_minute_}, {"playing", postmatch_playing_}, + {"dialog", postmatch_dialog_}, {"country", postmatch_country_}, + {"league", postmatch_league_}, {"scroll", postmatch_scrolls_}, + {"data", postmatch_data_}, {"report", postmatch_report()}}; +} diff --git a/src/modern/ui/postmatch_eleven_markup.hpp b/src/modern/ui/postmatch_eleven_markup.hpp new file mode 100644 index 0000000..60efaee --- /dev/null +++ b/src/modern/ui/postmatch_eleven_markup.hpp @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-3.0-only +#pragma once +#include "modern/ui/controls.hpp" +#include +#include + +namespace bmh::modern_ui { +using PostmatchBadge = std::function; +inline std::string postmatch_position_label(const std::string &position) { + return position == "gk" ? "TW" + : position == "def" ? "ABW" + : position == "mid" ? "MIT" + : "STU"; +} +inline std::string postmatch_pitch_svg(const std::string &color) { + return ""; +} +inline std::string postmatch_eleven_markup(const Json &eleven, + const PostmatchBadge &badge, + const std::string &pitch) { + const auto text = [](const std::string &s) { + return "" + editor::escaped(s) + ""; + }; + const bool available = + eleven.value("available", false) && eleven.contains("rows") && + eleven.at("rows").is_array() && eleven.at("rows").size() == 11; + std::string out = + "
" + + pitch + "
"; + if (available) { + for (const auto &[position, top] : + std::array, 4>{ + {{"gk", 89}, {"def", 68}, {"mid", 45}, {"fwd", 22}}}) { + size_t count = 0; + for (const auto &row : eleven.at("rows")) + if (row.at("position") == position) + ++count; + size_t column = 0, index = 0; + for (const auto &row : eleven.at("rows")) { + const auto n = index++; + if (row.at("position") != position) + continue; + ++column; + const auto name = row.at("player").at("name").get(); + const auto at = name.find_last_of(' '); + out += button_markup( + "postmatch-player", + "" + + badge(row.at("team"), 60) + "" + + text(at == name.npos ? name : name.substr(at + 1)) + + "", + "postmatch-field-player", + "id=\"postmatch-nominee-" + std::to_string(n) + "\" data-id=\"" + + editor::escaped(row.at("player").at("id").get()) + + "\" style=\"left:" + + std::to_string(100.0 * column / (count + 1)) + + "%;top:" + std::to_string(top) + "%;\" aria-label=\"" + + editor::escaped(name + " · " + + row.at("team").at("name").get()) + + "\""); + } + } + } + out += "
"; + if (!available) + out += "

" + text("Keine Nominierungen aufgezeichnet") + "

" + + text("Die feste Liveaufnahme enthält keine Spielernoten oder " + "Nominierungen. Es wird keine Elf aus Kaderstärken oder " + "vermuteten Ereignisakteuren erfunden.") + + "

" + + text("Ergebnisse und Bericht zeigen ausschließlich die vorhandene " + "Aufzeichnung.") + + "

"; + else { + out += "

" + + text(eleven.value("notice", "Explizit gelieferte Nominierungen")) + + "

    "; + size_t index = 0; + for (const auto &row : eleven.at("rows")) { + const auto n = index++; + const auto id = row.at("player").at("id").get(); + out += + "
  1. " + + text(postmatch_position_label(row.at("position"))) + + "" + + button_markup( + "postmatch-player", + editor::escaped(row.at("player").at("name").get()), + "postmatch-nominee-name", + "id=\"postmatch-nominee-name-" + std::to_string(n) + + "\" data-id=\"" + editor::escaped(id) + "\"") + + button_markup( + "postmatch-club", + badge(row.at("team"), 38) + text(row.at("team").at("name")), + "postmatch-nominee-club", + "data-id=\"" + + editor::escaped(row.at("team").at("id").get()) + + "\"") + + "
  2. "; + } + out += "
"; + } + return out + "
"; +} +inline void fit_postmatch_pitch(Rml::ElementDocument &doc) { + auto *holder = doc.GetElementById("postmatch-pitch-holder"), + *surface = doc.GetElementById("postmatch-pitch-surface"); + if (!holder || !surface) + return; + const auto size = holder->GetBox().GetSize(Rml::BoxArea::Content); + const float height = std::min(size.y, size.x * 1110.f / 740), + width = height * 740 / 1110; + const auto set = [](Rml::Element *node, Rml::PropertyId id, float value) { + const auto *old = node->GetLocalProperty(id); + if (!old || old->unit != Rml::Unit::PX || + std::abs(old->Get() - value) > .02f) + node->SetProperty(id, Rml::Property(value, Rml::Unit::PX)); + }; + set(surface, Rml::PropertyId::Width, width); + set(surface, Rml::PropertyId::Height, height); + set(surface, Rml::PropertyId::Left, (size.x - width) / 2); + set(surface, Rml::PropertyId::Top, (size.y - height) / 2); + if (auto *art = doc.GetElementById("postmatch-pitch-art")) + for (auto *node : + {art, art->QuerySelector(".image-frame"), art->QuerySelector("img")}) + if (node) { + set(node, Rml::PropertyId::Width, width); + set(node, Rml::PropertyId::Height, height); + } +} +inline std::string postmatch_nominee_detail(const Json &row, + const PostmatchBadge &badge) { + const auto text = [](const std::string &v) { + return "" + editor::escaped(v) + ""; + }; + return "
" + + badge(row.at("team"), 120) + "

" + text(row.at("team").at("name")) + + "

Position
" + + text(postmatch_position_label(row.at("position"))) + + "
Note
" + + text(row.at("rating").is_null() ? "—" : row.at("rating").dump()) + + "
"; +} +} // namespace bmh::modern_ui diff --git a/src/modern/ui/postmatch_screens.inc b/src/modern/ui/postmatch_screens.inc new file mode 100644 index 0000000..d904d39 --- /dev/null +++ b/src/modern/ui/postmatch_screens.inc @@ -0,0 +1,501 @@ +// SPDX-License-Identifier: GPL-3.0-only +namespace { +std::string postmatch_label(const std::string &tab) { + if (tab == "results") + return "Ergebnisse"; + if (tab == "report") + return "Spielbericht"; + if (tab == "eleven") + return "Elf des Tages"; + if (tab == "overview") + return "Übersicht"; + return "Tabelle"; +} +std::string postmatch_count(const Json &v) { + return v.is_number_integer() ? number(v.get()) : "—"; +} +std::string postmatch_kind(const std::string &kind) { + if (kind == "goal") + return "Tor"; + if (kind == "yellow") + return "Gelbe Karte"; + if (kind == "red") + return "Rote Karte"; + if (kind == "injury") + return "Behandlung"; + if (kind == "attack") + return "Angriff"; + if (kind == "chance" || kind == "save") + return "Torchance"; + if (kind == "kickoff") + return "Anpfiff"; + if (kind == "interval") + return "Halbzeit"; + if (kind == "restart") + return "Wiederanpfiff"; + if (kind == "fulltime") + return "Abpfiff"; + return "Ereignis"; +} +} // namespace +std::string App::postmatch_icon(const std::string &kind, double size) { + const std::string color = kind == "yellow" ? "#dfbd66" + : kind == "red" ? "#e5938b" + : theme_ == "silver" ? "#42627d" + : theme_ == "matchday" ? "#d6b9bf" + : "#b4cfde"; + const std::string path = + kind == "goal" + ? "" + : kind == "yellow" || kind == "red" + ? "" + : kind == "crowd" + ? "" + : kind == "injury" ? "" + : ""; + return picture( + renderer_.diagram("postmatch-icon-" + kind, + "" + + path + "", + int(size * 2)), + size, size); +} +std::string App::postmatch_team(const Json &team, bool home, double size) { + const auto name = live_text(team.value("name", "—"), "postmatch-team-name"); + const auto badge = live_badge(team, size); + return "" + (home ? name + badge : badge + name) + ""; +} +Json App::postmatch_groups() const { + Json groups = Json::array(); + if (!postmatch_data_.value("ok", false)) + return groups; + for (const auto &m : postmatch_data_.at("matches")) { + const auto *club = live_world_ + ? live_world_->find("clubs", m.at("home").at("id")) + : nullptr; + const std::string league = club ? club->value("competition", "") : ""; + const auto *competition = + live_world_ ? live_world_->find("competitions", league) : nullptr; + const std::string country = + competition ? competition->value("nation", "") : ""; + const auto *nation = + live_world_ ? live_world_->find("nations", country) : nullptr; + const std::string key = league.empty() ? "recording" : league; + auto group = std::find_if(groups.begin(), groups.end(), + [&](const auto &g) { return g.at("id") == key; }); + if (group == groups.end()) { + groups.push_back( + {{"id", key}, + {"name", competition ? live_world_->name(*competition) + : m.at("competition").get()}, + {"country", country.empty() ? "recording" : country}, + {"country_name", + nation ? live_world_->name(*nation) : "Aufzeichnung"}, + {"match_ids", Json::array()}}); + group = groups.end() - 1; + } + (*group)["match_ids"].push_back(m.at("id")); + } + return groups; +} +Json App::postmatch_matches() const { + if (postmatch_data_.at("role") != "club" || + postmatch_data_.at("surface") != "outdoor") + return postmatch_data_.at("matches"); + const auto groups = postmatch_groups(); + Json rows = Json::array(); + for (const auto &group : groups) + if (group.at("id") == postmatch_league_) + for (const auto &m : postmatch_data_.at("matches")) + if (std::find(group.at("match_ids").begin(), + group.at("match_ids").end(), + m.at("id")) != group.at("match_ids").end()) + rows.push_back(m); + return rows; +} +Json App::postmatch_report() const { + if (!live_.available() || !postmatch_data_.value("ok", false)) + return Json(); + return query_demo_post_match( + live_.fixture(), + {{"kind", "report"}, + {"completed_sequence", postmatch_data_.at("completed_sequence")}, + {"fixture_id", postmatch_data_.at("fixture_id")}, + {"revision", postmatch_data_.at("source_revision")}, + {"match_id", postmatch_match_}, + {"minute", postmatch_minute_}}); +} +std::string App::postmatch_events(const Json &report, const std::string &side) { + std::string out = + "
    ()) + "\">"; + size_t index = 0, shown = 0; + for (const auto &e : report.at("timeline")) { + const auto n = index++; + if (e.at("side") != side || e.at("sequence") > report.at("sequence")) + continue; + out += "
  1. " + + btn("postmatch-event", + live_text(std::to_string(e.at("minute").get()) + "′", + "postmatch-event-time") + + postmatch_icon(e.at("kind"), 42) + + "" + + live_text(e.at("headline")) + "" + + esc(e.at("body").get()) + "", + "postmatch-event", + "id=\"postmatch-event-" + std::to_string(n) + "\" data-id=\"" + + esc(e.at("id").get()) + "\"") + + "
  2. "; + ++shown; + } + if (!shown) + out += "
  3. " + + live_text("Noch keine aufgezeichneten Ereignisse") + "
  4. "; + return out + "
"; +} +std::string App::postmatch_report_markup(const Json &report) { + const auto score = report.at("score"); + std::string out = "
" + + live_badge(report.at("home"), 120) + "" + + live_text(report.at("home").at("name")) + + "
" + + live_text(std::to_string(score[0].get())) + + live_text(":", "separator") + + live_text(std::to_string(score[1].get())) + + "
" + live_badge(report.at("away"), 120) + + "" + live_text(report.at("away").at("name")) + + "
"; + out += "

" + + live_text("Spielort und Zuschauer nicht aufgezeichnet · " + "Spielerzuordnung nicht aufgezeichnet") + + "

" + + postmatch_events(report, "home") + postmatch_events(report, "away") + + "
" + + live_text(report.at("home").at("name")) + + live_text(report.at("away").at("name")) + + "
"; + for (const auto *side : {"home", "away"}) { + out += "
()) + "\">"; + size_t index = 0; + for (const auto &e : report.at("timeline")) { + const auto n = index++; + if (e.at("side") != side) + continue; + const auto minute = e.at("minute").get(); + out += + btn("postmatch-event", postmatch_icon(e.at("kind"), 34), + "postmatch-marker " + + std::string(e.at("sequence") <= report.at("sequence") + ? "is-visible" + : ""), + "id=\"postmatch-marker-" + std::to_string(n) + "\" data-id=\"" + + esc(e.at("id").get()) + "\" style=\"left:" + + scalar(100.0 * minute / + postmatch_data_.at("duration").get()) + + "%;\" aria-label=\"" + std::to_string(minute) + + " Minute: " + esc(postmatch_kind(e.at("kind"))) + "\""); + } + out += "
"; + } + out += "
"; + for (int i = 0; i < 7; ++i) + out += + live_text(std::to_string(int(std::lround( + i * postmatch_data_.at("duration").get() / 6.0))) + + "′"); + out += + "
" + + btn("postmatch-play", + postmatch_playing_ ? "Pause" : "Rückblick abspielen", {}, + "id=\"postmatch-play\" aria-pressed=\"" + + std::string(postmatch_playing_ ? "true" : "false") + "\"") + + "()) + + "\" step=\"1\" value=\"" + std::to_string(postmatch_minute_) + + "\" aria-label=\"Berichtsminute\"/>" + + std::to_string(postmatch_minute_) + + "′

" + + live_text("Aufgezeichneter Stand: " + + std::to_string(report.at("recorded_minute").get()) + + "′ · keine Zwischenberechnung") + + "

"; + const auto matches = postmatch_matches(); + size_t at = 0; + for (size_t i = 0; i < matches.size(); ++i) + if (matches[i].at("id") == postmatch_match_) + at = i; + out += "
"; + return out; +} +std::string App::render_postmatch() { + if (!postmatch_data_.value("ok", false)) + return ""; + for (const auto *id : {"postmatch-results", "postmatch-events", + "postmatch-eleven-list", "postmatch-table"}) + if (auto *node = element(id)) + postmatch_scrolls_[postmatch_rendered_scope_ + "|" + id] = + node->GetScrollTop(); + postmatch_restore_scroll_ = true; + const auto &tabs = postmatch_data_.at("tabs"); + const auto matches = postmatch_matches(); + postmatch_rendered_scope_ = postmatch_tab_ + "|" + postmatch_match_; + const auto selected = live_match_by_id(matches, postmatch_match_); + std::set own; + for (const auto &owner : postmatch_data_.at("owners")) + own.insert(owner.at("team").at("id")); + std::string body = + "

" + + live_text(selected.at("competition").get() + " · " + + postmatch_data_.at("date").get()) + + "

" + + live_text(postmatch_label(postmatch_tab_)) + "

"; + if (postmatch_data_.at("role") == "club" && + postmatch_data_.at("surface") == "outdoor") { + std::vector> countries, leagues; + for (const auto &g : postmatch_groups()) { + const auto country = g.at("country").get(); + if (std::none_of(countries.begin(), countries.end(), + [&](const auto &c) { return c.first == country; })) + countries.emplace_back(country, g.at("country_name")); + if (country == postmatch_country_) + leagues.emplace_back(g.at("id"), g.at("name")); + } + body += ""; + } + body += "
"; + if (postmatch_tab_ == "results") { + body += "
" + + live_text("Heim", "home") + live_text("Ergebnis", "score") + + live_text("Auswärts", "away") + + "
"; + for (size_t i = 0; i < matches.size(); ++i) { + const auto &m = matches[i]; + const bool owned = own.contains(m.at("home").at("id")) || + own.contains(m.at("away").at("id")); + body += btn( + "postmatch-fixture", + postmatch_team(m.at("home"), true) + + "" + + live_text( + std::to_string(m.at("final").at("score")[0].get())) + + live_text(":", "separator") + + live_text( + std::to_string(m.at("final").at("score")[1].get())) + + "" + postmatch_team(m.at("away"), false), + "postmatch-result-row " + std::string(owned ? "postmatch-own" : ""), + "id=\"postmatch-result-" + std::to_string(i) + "\" data-id=\"" + + esc(m.at("id").get()) + "\""); + } + body += "

" + + live_text("Vorgegebene Aufzeichnung der menschlichen Partien · " + "kein vollständiger Ligaspieltag") + + "

"; + } else if (postmatch_tab_ == "report") + body += postmatch_report_markup(postmatch_report()); + else if (postmatch_tab_ == "eleven") { + const auto color = theme_ == "silver" ? "#42627d" + : theme_ == "matchday" ? "#d2b8be" + : "#abcbbf"; + const auto pitch = picture( + renderer_.diagram("postmatch-pitch", postmatch_pitch_svg(color), 1110), + 740, 1110); + body += postmatch_eleven_markup( + postmatch_data_.at("eleven"), + [&](const Json &team, double size) { return live_badge(team, size); }, + pitch); + } else if (postmatch_tab_ == "overview") { + auto total = postmatch_data_.at("overview"); + total["games"] = matches.size(); + for (const auto *key : {"goals", "yellow", "red"}) + total[key] = 0; + for (const auto &m : matches) + for (const auto *key : {"goals", "yellow", "red"}) { + const auto &pair = + m.at("final").at(std::string(key) == "goals" ? "score" : key); + total[key] = + total.at(key).get() + pair[0].get() + pair[1].get(); + } + body += "
"; + for (const auto &[key, icon, label] : + std::array, 4>{ + {{"yellow", "yellow", "Gelbe Karten"}, + {"red", "red", "Platzverweise"}, + {"attendance", "crowd", "Zuschauer"}, + {"goals", "goal", "Tore"}}}) + body += "
" + postmatch_icon(icon, 70) + + "" + live_text(postmatch_count(total.at(key))) + + "" + live_text(label) + "
"; + const int games = total.at("games"); + body += + "

" + + live_text(std::to_string(games) + " aufgezeichnete Partien · " + + (games ? scalar(double(total.at("goals").get()) / games) + : "—") + + " Tore pro Partie") + + "

" + + live_text("Zuschauer nicht aufgezeichnet · keine Ligagesamtwertung") + + "

"; + } else { + const Json *table = nullptr; + for (const auto &t : postmatch_data_.at("tables")) + if (std::find(t.at("match_ids").begin(), t.at("match_ids").end(), + Json(postmatch_match_)) != t.at("match_ids").end()) { + table = &t; + break; + } + body += + "

" + + live_text("Vorgegebener POC-Tabellenstand · Siege, Unentschieden und " + "Niederlagen nicht aufgezeichnet") + + "

"; + for (const auto *label : + {"Pl.", "Verein", "Sp.", "S", "U", "N", "Tore", "Diff.", "Pkt."}) + body += live_text(label); + body += "
"; + if (table) + for (const auto &r : table->at("rows")) { + const int diff = r.at("gf").get() - r.at("ga").get(); + body += + "
" + live_text(postmatch_count(r.at("position"))) + + postmatch_team(r.at("team"), false, 43) + + live_text(postmatch_count(r.at("played"))) + live_text("—") + + live_text("—") + live_text("—") + + live_text(postmatch_count(r.at("gf")) + ":" + + postmatch_count(r.at("ga"))) + + live_text((diff > 0 ? "+" : "") + std::to_string(diff)) + + live_text(postmatch_count(r.at("points"))) + "
"; + } + if (!table) + body += + "

" + + live_text("Für diese Partie ist kein Tabellenstand aufgezeichnet.") + + "

"; + body += "
"; + } + body += + "
" + + btn("postmatch-prev", "‹ Zurück", {}, + "id=\"postmatch-prev\" " + + std::string(position == 0 ? "disabled" : "")) + + live_text(std::to_string(position + 1) + " / " + + std::to_string(tabs.size()) + " · UI-Aufzeichnung", + "postmatch-status") + + btn("postmatch-ticker", "Zum Ticker", + {}, "id=\"postmatch-ticker\"") + + btn("postmatch-next", + position + 1 == tabs.size() ? "Zum Desktop" : "Weiter ›", {}, + "id=\"postmatch-next\"") + + "
"; + if (!postmatch_dialog_.empty()) { + Json team; + const Json *nominee = nullptr, *match = nullptr; + for (const auto &row : postmatch_data_.at("eleven").at("rows")) { + if (row.at("team").at("id") == postmatch_detail_team_) + team = row.at("team"); + if (row.at("player").at("id") == postmatch_detail_player_) + nominee = &row; + } + for (const auto &m : postmatch_data_.at("matches")) + if (m.at("home").at("id") == postmatch_detail_team_ || + m.at("away").at("id") == postmatch_detail_team_) + match = &m; + std::string detail; + if (nominee) + detail = + postmatch_nominee_detail(*nominee, [&](const Json &t, double size) { + return live_badge(t, size); + }); + else if (team.is_object()) + detail = "
" + + live_badge(team, 150) + "
"; + if (match) { + const bool home = match->at("home").at("id") == postmatch_detail_team_; + const auto &final = match->at("final"); + const size_t side = home ? 0 : 1; + detail += "

" + + live_text(match->at("home").at("name").get() + + " · " + live_score_text(final.at("score")) + " · " + + match->at("away").at("name").get()) + + "

"; + for (const auto &[key, label] : + std::array, 3>{ + {{"yellow", "Gelbe Karten"}, + {"red", "Platzverweise"}, + {"score", "Tore"}}}) + detail += "
" + live_text(label) + "
" + + live_text(postmatch_count(final.at(key)[side])) + + "
"; + detail += "
Zuschauer
—
"; + } else + detail += "

" + + live_text("Keine Partie dieses Teams in der gehaltenen " + "Aufnahme enthalten.") + + "

"; + body += + "

" + + live_text(nominee ? nominee->at("player").at("name").get() + : team.value("name", "Spieltagsinfo")) + + "

" + detail + "
" + + btn("postmatch-detail-close", "Schließen", {}, + "id=\"postmatch-detail-close\"") + + btn("postmatch-detail-report", "Spielbericht", {}, + "id=\"postmatch-detail-report\" " + + std::string(match ? "" : "disabled")) + + "
"; + } + return render_desktop() + + "
" + + btn("postmatch-desktop", "×", "close", + "id=\"postmatch-close\" aria-label=\"Auswertung schließen\"") + + "

Nach dem Spiel

" + body + + "
"; +} diff --git a/src/modern/ui/postmatch_state.inc b/src/modern/ui/postmatch_state.inc new file mode 100644 index 0000000..96eca6c --- /dev/null +++ b/src/modern/ui/postmatch_state.inc @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-3.0-only +Json postmatch_data_ = Json::object(), postmatch_scrolls_ = Json::object(); +std::string postmatch_tab_ = "results", postmatch_owner_, postmatch_match_, + postmatch_country_, postmatch_league_, postmatch_rendered_scope_, + postmatch_dialog_, postmatch_detail_team_, postmatch_detail_player_; +int postmatch_minute_ = 0; +bool postmatch_playing_ = false, postmatch_updating_ = false, + postmatch_restore_scroll_ = false; +uint64_t postmatch_last_tick_ = 0, postmatch_elapsed_ = 0; +bool postmatch_open(); +bool postmatch_action(const std::string &, Rml::Element *); +bool postmatch_event(Rml::Event &); +void postmatch_tick(uint64_t); +void postmatch_seek(int, bool = true); +void postmatch_update_report(); +void postmatch_after_render(); +Json postmatch_report() const; +Json postmatch_groups() const; +Json postmatch_matches() const; +Json postmatch_snapshot() const; +std::string render_postmatch(); +std::string postmatch_events(const Json &, const std::string &); +std::string postmatch_report_markup(const Json &); +std::string postmatch_icon(const std::string &, double); +std::string postmatch_team(const Json &, bool, double = 68); diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 615abe2..486f04f 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -17,6 +17,8 @@ #include "modern/ui/demo_sports.hpp" #include "modern/ui/demo_lineup.hpp" #include "modern/ui/demo_live.hpp" +#include "modern/ui/demo_post_match.hpp" +#include "modern/ui/postmatch_eleven_markup.hpp" #include "modern/ui/demo_career.hpp" #include "modern/ui/demo_national_ui.hpp" #include "modern/ui/demo_transfer.hpp" @@ -41,6 +43,7 @@ #include "version.hpp" #include #include +#include #include #include #include @@ -454,6 +457,7 @@ class App final : public Rml::EventListener { #include "modern/ui/files_state.inc" #include "modern/ui/front_state.inc" #include "modern/ui/live_state.inc" +#include "modern/ui/postmatch_state.inc" #include "modern/ui/national_state.inc" std::map selections_; Rml::Element *element(const std::string &id) const { @@ -1473,6 +1477,8 @@ public: #include "modern/ui/settings_controls.inc" #include "modern/ui/live_screens.inc" #include "modern/ui/live_controls.inc" +#include "modern/ui/postmatch_screens.inc" +#include "modern/ui/postmatch_controls.inc" } // namespace bool is_modern_world(const fs::path &file) { try { diff --git a/tests/modern_control_layout_tests.cpp b/tests/modern_control_layout_tests.cpp index 831c556..5aaac16 100644 --- a/tests/modern_control_layout_tests.cpp +++ b/tests/modern_control_layout_tests.cpp @@ -2,6 +2,7 @@ // Exercise the production control builder and stylesheet with synthetic labels. #include "modern/ui/controls.hpp" #include "modern/ui/script_locator.hpp" +#include "modern/ui/postmatch_eleven_markup.hpp" #include #include #include @@ -153,6 +154,22 @@ void script_locator_cases(Rml::Context &context, float density) { context.Update(); } } +void postmatch_eleven_cases(Rml::Context &context,const std::string &css,const char *theme) { + const auto fixture=std::filesystem::path(__FILE__).parent_path()/"fixtures/modern_post_match_eleven.json"; + std::ifstream file(fixture);require(bool(file),"Synthetic supplied eleven fixture missing"); + const auto data=Json::parse(file).at("eleven"); + const PostmatchBadge badge=[](const Json &,double size){return "B";}; + const auto markup=postmatch_eleven_markup(data,badge,"
"); + auto *doc=context.LoadDocumentFromMemory("
"+markup+"
"); + require(doc,"Supplied eleven document missing");doc->Show();context.Update();context.Render();fit_postmatch_pitch(*doc);context.Update();context.Render(); + Rml::ElementList field,list;doc->QuerySelectorAll(field,".postmatch-field-player");doc->QuerySelectorAll(list,".postmatch-nominee-name");require(field.size()==11&&list.size()==11,"Supplied eleven must render eleven field and list controls"); + auto *pitch=doc->GetElementById("postmatch-pitch-surface");const auto bounds=pitch->GetBox().GetSize(Rml::BoxArea::Content);require(std::abs(bounds.x/bounds.y-740.f/1110.f)<.003f,"Supplied eleven field aspect changed"); + for(size_t i=0;i0,"Nominee full name lost its text");} + doc->Close();context.Update(); + const auto detail=postmatch_nominee_detail(data.at("rows")[0],badge); + auto *dialog=context.LoadDocumentFromMemory("
"+detail+"
"); + require(dialog,"Nominee detail missing");dialog->Show();context.Update();context.Render();Rml::ElementList facts;dialog->QuerySelectorAll(facts,"dd");require(facts.size()==2&&visible_text_lines(*facts[0])>0&&visible_text_lines(*facts[1])>0,"Nominee position/unknown rating must render");dialog->Close();context.Update(); +} } // namespace int main(int argc, char **argv) try { require(argc == 2, "Pass the Modern asset directory"); @@ -177,7 +194,7 @@ int main(int argc, char **argv) try { std::ostringstream css; for (const auto *name : {"theme.rcss", "ticket.rcss", "sports.rcss", "calendar.rcss", "reports.rcss", "report_details.rcss", - "report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss", "statistics.rcss", "news.rcss", "settings.rcss", "widgets.rcss", "files.rcss", "front.rcss"}) { + "report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss", "statistics.rcss", "news.rcss", "settings.rcss", "widgets.rcss", "files.rcss", "front.rcss", "postmatch.rcss"}) { std::ifstream input(root / name); require(bool(input), "Production stylesheet missing"); css << input.rdbuf() << '\n';