The evaluation after the final whistle is a note on the match sheet
Its five steps are pills in the note's head. The results scale with their number: one match fills the note, two share it, three or four are large rows. The day's totals carry large pictures. Notes have no drop shadow, which drew a stray line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
79b0a75c14
commit
13f5b1e4d4
7 files changed
+192
-125
No files matched your search
@@ -556,6 +556,10 @@ std::string App::live_card(const Json &match, const Json &frame, const std::stri
|
||||
}
|
||||
std::string App::render_live() {
|
||||
if(live_review_) return render_postmatch();
|
||||
return live_sheet({});
|
||||
}
|
||||
// The match sheet; `over` replaces the sheet's own notes (substitution, tactics) on top of it.
|
||||
std::string App::live_sheet(const std::string &over) {
|
||||
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();
|
||||
@@ -640,7 +644,7 @@ std::string App::render_live() {
|
||||
}
|
||||
out += "<span id=\"live-playback-status\" class=\"mv-status\">" + esc(live_feedback_.empty() ? (recorded ? std::string() : std::string(phase_text) + " · " + std::to_string(minute) + "′ · keine Spielwertänderung") : live_feedback_) + "</span>" +
|
||||
btn(live_.finished() ? "live-review" : "live-next", live_.finished() ? "Zur Auswertung" : live_.running() ? "Nächste Minute" : "Nächste Meldung", "mv-btn primary", "id=\"" + std::string(live_.finished() ? "live-review" : "live-next") + "\"") + "</footer>";
|
||||
return out + live_dialog_markup(owner) + "</section>";
|
||||
return out + (over.empty() ? live_dialog_markup(owner) : over) + "</section>";
|
||||
}
|
||||
void App::live_after_render() {
|
||||
if(live_review_){postmatch_after_render();return;}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
void live_update_parts();
|
||||
float live_ticker_scroll_ = 0, live_detail_scroll_ = 0;
|
||||
std::string render_live();
|
||||
std::string live_sheet(const std::string &over);
|
||||
std::string live_roster(const Json &owner);
|
||||
std::string live_detail(const Json &owner, const Json &frame);
|
||||
std::string live_dialog_markup(const Json &owner);
|
||||
|
||||
@@ -446,7 +446,7 @@ void App::postmatch_after_render() {
|
||||
Rml::ElementList underlay;
|
||||
doc_->QuerySelectorAll(underlay,
|
||||
"#postmatch-underlay button,#postmatch-underlay "
|
||||
"input,#postmatch-underlay select,#postmatch-close");
|
||||
"input,#postmatch-underlay select");
|
||||
for (auto *n : underlay) {
|
||||
n->SetProperty("pointer-events", "none");
|
||||
n->SetAttribute("tabindex", -1);
|
||||
@@ -454,7 +454,7 @@ void App::postmatch_after_render() {
|
||||
}
|
||||
Rml::ElementList behind;
|
||||
doc_->QuerySelectorAll(behind,
|
||||
".desktop-layer button,.desktop-layer [data-action]");
|
||||
".desktop-layer button,.desktop-layer [data-action],#live-underlay button,#live-underlay [tabindex],#live-stage .mv-bar button");
|
||||
for (auto *n : behind) {
|
||||
n->SetProperty("pointer-events", "none");
|
||||
n->SetAttribute("tabindex", -1);
|
||||
|
||||
@@ -66,6 +66,29 @@ std::string App::postmatch_icon(const std::string &kind, double size) {
|
||||
int(size * 2)),
|
||||
size, size);
|
||||
}
|
||||
// The pictures of the day's totals: drawn large and filled, in the sheet's colours.
|
||||
std::string App::postmatch_art(const std::string &kind, double size) {
|
||||
const bool dark = theme_ != "silver" && theme_ != "matchday";
|
||||
const std::string ink = dark ? "#f0ece2" : "#2a211a", paper = dark ? "#2a2d34" : "#fffdf6";
|
||||
const auto card = [&](const char *fill, const char *turn) {
|
||||
return std::string("<g transform='rotate(") + turn + " 50 50)'><rect x='33' y='20' width='44' height='64' rx='6' fill='#000000' fill-opacity='.16'/><rect x='28' y='14' width='44' height='64' rx='6' fill='" + fill +
|
||||
"' stroke='" + ink + "' stroke-width='3'/><path d='M37 25h18' stroke='#ffffff' stroke-opacity='.55' stroke-width='5' stroke-linecap='round'/></g>";
|
||||
};
|
||||
std::string g;
|
||||
if (kind == "yellow") g = card("#e9c53a", "-12");
|
||||
else if (kind == "red") g = card("#c8372d", "12");
|
||||
else if (kind == "crowd") {
|
||||
const auto person = [&](double x, double y, double k, const char *fill) {
|
||||
return "<g transform='translate(" + scalar(x) + " " + scalar(y) + ") scale(" + scalar(k) + ")'><path d='M-24 40c0-18 10-28 24-28s24 10 24 28z' fill='" + std::string(fill) + "' stroke='" + paper +
|
||||
"' stroke-width='3'/><circle cx='0' cy='-6' r='13' fill='" + fill + "' stroke='" + paper + "' stroke-width='3'/></g>";
|
||||
};
|
||||
g = person(26, 46, .8, "#7a8a5e") + person(74, 46, .8, "#7a8a5e") + person(50, 52, 1.05, "#c67139");
|
||||
} else {
|
||||
g = "<g stroke='" + ink + "' stroke-opacity='.3' stroke-width='1.6'><path d='M27 26v50M42 26v50M57 26v50M72 26v50M12 39h76M12 52h76M12 65h76'/></g><path d='M12 80V26h76v54' fill='none' stroke='" + ink +
|
||||
"' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/><circle cx='58' cy='63' r='16' fill='" + paper + "' stroke='" + ink + "' stroke-width='3'/><path d='M58 53.5l8.5 6.2-3.200 10h-10.600l-3.200-10z' fill='" + ink + "'/>";
|
||||
}
|
||||
return picture(renderer_.diagram("postmatch-art-" + kind + (dark ? "-d" : "-l"), "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>" + g + "</svg>", 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);
|
||||
@@ -264,75 +287,63 @@ std::string App::render_postmatch() {
|
||||
std::set<std::string> own;
|
||||
for (const auto &owner : postmatch_data_.at("owners"))
|
||||
own.insert(owner.at("team").at("id"));
|
||||
std::string body =
|
||||
"<section id=\"postmatch-underlay\" class=\"postmatch\"><header "
|
||||
"class=\"postmatch-heading\"><div><p>" +
|
||||
live_text(selected.at("competition").get<std::string>() + " · " +
|
||||
ui_long_date(postmatch_data_.at("date").get<std::string>())) +
|
||||
"</p><h2 id=\"postmatch-heading\" tabindex=\"-1\">" +
|
||||
live_text(postmatch_label(postmatch_tab_)) + "</h2></div>";
|
||||
if (postmatch_data_.at("role") == "club" &&
|
||||
postmatch_data_.at("surface") == "outdoor") {
|
||||
size_t position = 0;
|
||||
for (size_t i = 0; i < tabs.size(); ++i)
|
||||
if (tabs[i].get<std::string>() == postmatch_tab_) position = i;
|
||||
std::string steps;
|
||||
for (size_t i = 0; i < tabs.size(); ++i) {
|
||||
const auto tab = tabs[i].get<std::string>();
|
||||
steps += btn("postmatch-tab", std::to_string(i + 1) + ". " + postmatch_label(tab),
|
||||
tab == postmatch_tab_ ? "selected" : i < position ? "done" : "",
|
||||
"id=\"postmatch-tab-" + tab + "\" data-id=\"" + tab + "\" role=\"tab\" aria-selected=\"" +
|
||||
std::string(tab == postmatch_tab_ ? "true" : "false") + "\" tabindex=\"" + std::string(tab == postmatch_tab_ ? "0" : "-1") + "\"");
|
||||
}
|
||||
std::string pickers;
|
||||
if (postmatch_data_.at("role") == "club" && postmatch_data_.at("surface") == "outdoor") {
|
||||
std::vector<std::pair<std::string, std::string>> countries, leagues;
|
||||
for (const auto &g : postmatch_groups()) {
|
||||
const auto country = g.at("country").get<std::string>();
|
||||
if (std::none_of(countries.begin(), countries.end(),
|
||||
[&](const auto &c) { return c.first == country; }))
|
||||
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"));
|
||||
if (country == postmatch_country_) leagues.emplace_back(g.at("id"), g.at("name"));
|
||||
}
|
||||
body += "<nav class=\"postmatch-pickers\" aria-label=\"Aufgezeichnete "
|
||||
"Ligagruppe\">" +
|
||||
select("postmatch-country", countries, postmatch_country_) +
|
||||
select("postmatch-league", leagues, postmatch_league_) + "</nav>";
|
||||
pickers = "<nav class=\"postmatch-pickers\" aria-label=\"Aufgezeichnete Ligagruppe\">" + select("postmatch-country", countries, postmatch_country_) +
|
||||
select("postmatch-league", leagues, postmatch_league_) + "</nav>";
|
||||
}
|
||||
body += "</header><nav class=\"postmatch-tabs\" role=\"tablist\">";
|
||||
size_t position = 0;
|
||||
for (size_t i = 0; i < tabs.size(); ++i) {
|
||||
const auto tab = tabs[i].get<std::string>();
|
||||
if (tab == postmatch_tab_)
|
||||
position = i;
|
||||
body += btn("postmatch-tab", postmatch_label(tab),
|
||||
tab == postmatch_tab_ ? "selected" : "",
|
||||
"id=\"postmatch-tab-" + tab + "\" data-id=\"" + tab +
|
||||
"\" role=\"tab\" aria-selected=\"" +
|
||||
std::string(tab == postmatch_tab_ ? "true" : "false") +
|
||||
"\" tabindex=\"" +
|
||||
std::string(tab == postmatch_tab_ ? "0" : "-1") + "\"");
|
||||
}
|
||||
body += "</nav><div id=\"postmatch-panel\" class=\"postmatch-panel\" "
|
||||
std::string body = "<section id=\"postmatch-underlay\" class=\"postmatch\"><header class=\"postmatch-heading\"><div><span class=\"mv-k\">" +
|
||||
esc(pg_upper("Auswertung · Schritt " + std::to_string(position + 1) + " von " + std::to_string(tabs.size()))) +
|
||||
"</span><h2 id=\"postmatch-heading\" tabindex=\"-1\">" + live_text(postmatch_label(postmatch_tab_)) +
|
||||
"</h2></div><nav class=\"postmatch-tabs\" role=\"tablist\">" + steps + "</nav></header><div class=\"pm-sub\"><span>" +
|
||||
esc(selected.at("competition").get<std::string>() + " · " + ui_long_date(postmatch_data_.at("date").get<std::string>())) + "</span>" + pickers + "</div>";
|
||||
body += "<div id=\"postmatch-panel\" class=\"postmatch-panel\" "
|
||||
"role=\"tabpanel\" aria-labelledby=\"postmatch-tab-" +
|
||||
postmatch_tab_ + "\">";
|
||||
if (postmatch_tab_ == "results") {
|
||||
// the score board of the match day's stage, at its final whistle
|
||||
if (live_.available())
|
||||
for (const auto &played : live_.fixture().at("matches"))
|
||||
if (played.at("home").at("id") == selected.at("home").at("id") && played.at("away").at("id") == selected.at("away").at("id")) {
|
||||
try { body += "<div class=\"postmatch-stage\">" + live_card(played, live_.frame(), "solo", 0) + "</div>"; } catch (const std::exception &) {}
|
||||
break;
|
||||
}
|
||||
body += "<div class=\"postmatch-results-head\">" +
|
||||
live_text("Heim", "home") + live_text("Ergebnis", "score") +
|
||||
live_text("Auswärts", "away") +
|
||||
"</div><div id=\"postmatch-results\" class=\"postmatch-results\">";
|
||||
// the fewer matches, the larger each is shown: one fills the note, a full match day is a list
|
||||
const size_t shown = matches.size();
|
||||
const std::string scale = shown <= 1 ? "one" : shown == 2 ? "two" : shown <= 4 ? "few" : "many";
|
||||
const double badge = shown <= 1 ? 300 : shown == 2 ? 210 : shown <= 4 ? 130 : 68;
|
||||
const bool hall = postmatch_data_.at("surface") == "indoor" || live_indoor();
|
||||
body += std::string(scale == "many" ? "<div class=\"postmatch-results-head\">" + live_text("Heim", "home") + live_text("Ergebnis", "score") + live_text("Auswärts", "away") + "</div>" : std::string()) +
|
||||
"<div id=\"postmatch-results\" class=\"postmatch-results " + scale + "\">";
|
||||
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) +
|
||||
postmatch_team(m.at("home"), true, badge) +
|
||||
"<strong class=\"postmatch-result-score\">" +
|
||||
live_text(
|
||||
std::to_string(m.at("final").at("score")[0].get<int>())) +
|
||||
live_text(":", "separator") +
|
||||
live_text(
|
||||
std::to_string(m.at("final").at("score")[1].get<int>())) +
|
||||
"</strong>" + postmatch_team(m.at("away"), false),
|
||||
"</strong>" + postmatch_team(m.at("away"), false, badge),
|
||||
"postmatch-result-row " + std::string(owned ? "postmatch-own" : ""),
|
||||
"id=\"postmatch-result-" + std::to_string(i) + "\" data-id=\"" +
|
||||
esc(m.at("id").get<std::string>()) + "\"");
|
||||
if (shown <= 2) body += "<p class=\"postmatch-result-info\">" + esc(m.at("competition").get<std::string>() + " · " + live_match_info_text(m, hall)) + "</p>";
|
||||
}
|
||||
body += "</div><p class=\"postmatch-scope-note\">" +
|
||||
live_text(postmatch_data_.at("source") == "engine-recording"
|
||||
@@ -378,9 +389,8 @@ std::string App::render_postmatch() {
|
||||
{"red", "red", "Platzverweise"},
|
||||
{"attendance", "crowd", "Zuschauer"},
|
||||
{"goals", "goal", "Tore"}}})
|
||||
body += "<article class=\"postmatch-total\">" + postmatch_icon(icon, 70) +
|
||||
"<strong>" + live_text(postmatch_count(total.at(key))) +
|
||||
"</strong>" + live_text(label) + "</article>";
|
||||
body += "<article class=\"postmatch-total\">" + postmatch_art(icon, 310) + "<div class=\"pm-total-copy\"><strong>" + live_text(postmatch_count(total.at(key))) +
|
||||
"</strong>" + live_text(label) + "</div></article>";
|
||||
const int games = total.at("games");
|
||||
body +=
|
||||
"</div><p>" +
|
||||
@@ -438,20 +448,13 @@ std::string App::render_postmatch() {
|
||||
"</p>";
|
||||
body += "</div>";
|
||||
}
|
||||
body +=
|
||||
"</div><footer class=\"postmatch-actions\">" +
|
||||
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()) + (engine_mode_ ? "" : " · UI-Aufzeichnung"),
|
||||
"postmatch-status") +
|
||||
btn("postmatch-ticker", "<span id=\"live-review-back\">Zum Ticker</span>",
|
||||
{}, "id=\"postmatch-ticker\"") +
|
||||
btn("postmatch-next",
|
||||
position + 1 == tabs.size() ? (engine_mode_ ? "Zum Schreibtisch" : "Zum Desktop") : "Weiter ›", {},
|
||||
"id=\"postmatch-next\"") +
|
||||
"</footer></section>";
|
||||
body += "</div><footer class=\"postmatch-actions\">" +
|
||||
btn("postmatch-prev", "Zurück", "mv-btn", "id=\"postmatch-prev\" " + std::string(position == 0 ? "disabled" : "")) +
|
||||
btn("postmatch-ticker", "<span id=\"live-review-back\">Zum Ticker</span>", "mv-btn", "id=\"postmatch-ticker\"") +
|
||||
live_text(engine_mode_ ? std::string() : std::string("UI-Aufzeichnung"), "postmatch-status") +
|
||||
btn("postmatch-next", position + 1 == tabs.size() ? (engine_mode_ ? "Zum Schreibtisch" : "Zum Desktop") : "Weiter", "mv-btn primary", "id=\"postmatch-next\"") +
|
||||
"</footer></section>";
|
||||
std::string dialog;
|
||||
if (!postmatch_dialog_.empty()) {
|
||||
Json team;
|
||||
const Json *nominee = nullptr, *match = nullptr;
|
||||
@@ -497,26 +500,22 @@ std::string App::render_postmatch() {
|
||||
live_text("Keine Partie dieses Teams in der gehaltenen "
|
||||
"Aufnahme enthalten.") +
|
||||
"</p>";
|
||||
body +=
|
||||
dialog =
|
||||
"<div id=\"postmatch-dialog-layer\" "
|
||||
"class=\"entry-dialog-layer\"><section class=\"entry-dialog "
|
||||
"postmatch-dialog\" role=\"dialog\" aria-modal=\"true\"><h2>" +
|
||||
"class=\"mv-veil\"><section class=\"mv-note "
|
||||
"postmatch-dialog\" role=\"dialog\" aria-modal=\"true\"><div class=\"mv-tape\"></div><h2>" +
|
||||
live_text(nominee ? nominee->at("player").at("name").get<std::string>()
|
||||
: team.value("name", "Spieltagsinfo")) +
|
||||
"</h2>" + detail + "<footer>" +
|
||||
btn("postmatch-detail-close", "Schließen", {},
|
||||
btn("postmatch-detail-close", "Schließen", "mv-btn",
|
||||
"id=\"postmatch-detail-close\"") +
|
||||
btn("postmatch-detail-report", "Spielbericht", {},
|
||||
btn("postmatch-detail-report", "Spielbericht", "mv-btn primary",
|
||||
"id=\"postmatch-detail-report\" " +
|
||||
std::string(match ? "" : "disabled")) +
|
||||
"</footer></section></div>";
|
||||
}
|
||||
// An engine career has no demo desk to draw beneath the review; its background stays.
|
||||
return (engine_mode_ ? std::string() : render_desktop()) +
|
||||
"<div class=\"fill\" style=\"z-index:100;\"><div class=\"window "
|
||||
"postmatch-window\"><div class=\"titlebar\">" +
|
||||
btn("postmatch-desktop", "<span>×</span>", "close",
|
||||
"id=\"postmatch-close\" aria-label=\"Auswertung schließen\"") +
|
||||
"<h1>Nach dem Spiel</h1></div><div class=\"content\">" + body +
|
||||
"</div></div></div>";
|
||||
// the evaluation is a note laid on the match sheet; the sheet beneath is not operated meanwhile
|
||||
const std::string note = "<div class=\"mv-veil\"><div class=\"mv-note pm-note postmatch-window\" role=\"dialog\" aria-label=\"Auswertung\"><div class=\"mv-tape\"></div>" + body + "</div></div>" + dialog;
|
||||
const std::string sheet = live_sheet(note);
|
||||
return sheet.empty() ? "<section id=\"live-stage\" class=\"mv-stage\">" + note + "</section>" : sheet;
|
||||
}
|
||||
@@ -23,3 +23,4 @@ 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);
|
||||
std::string postmatch_art(const std::string &kind, double size);
|
||||
Reference in new issue
Block a user