Liven up the match day: varied ticker wording, whistles, results of the day, eleven of the day
The ticker picks its sentence from several variants by the event's facts and names equalisers, leads and late goals; kickoff, half time and the final whistle are reported, with the same wording while the kickoff runs live. The ticker's third tab lists the other results of the day. Modern chooses an eleven of the day per league from the recorded match facts and the review shows it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
333bc57526
commit
1732a2477b
11 files changed
+288
-24
No files matched your search
@@ -128,6 +128,27 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
|
||||
btn("live-intervene-tactics", "Taktik als Demo bearbeiten", "", "id=\"live-tactics-edit\" " + std::string(live_.finished() ? "disabled" : "")) +
|
||||
"<p>" + live_text("Die Vorschau verändert weder diese feste Ereignisfolge noch Spiel- oder Saisonwerte.") + "</p></div>";
|
||||
}
|
||||
if (live_tab_ == "opponent" && recorded) {
|
||||
// the other matches of the day, own competition first; known once the day is played
|
||||
if (!live_.finished() || !fixture.contains("conference") || !fixture.at("conference").is_array() || fixture.at("conference").empty())
|
||||
return "<p class=\"live-note\">" + live_text(live_.finished() ? "An diesem Tag gab es keine weiteren Spiele." : "Die Ergebnisse der anderen Spiele stehen nach dem Abpfiff hier.") + "</p>";
|
||||
const std::string own = match.value("competition", std::string());
|
||||
std::vector<std::string> order;
|
||||
std::map<std::string, std::string> groups;
|
||||
for (const auto &other : fixture.at("conference")) {
|
||||
const std::string name = other.at("competition").value("name", std::string("Weitere Spiele"));
|
||||
if (!groups.contains(name)) order.push_back(name);
|
||||
const auto &result = other.at("result").at("final");
|
||||
groups[name] += "<div class=\"live-roster-row\">" +
|
||||
live_text(other.at("home").value("name", std::string()) + " – " + other.at("away").value("name", std::string()), "live-roster-name") +
|
||||
live_text(std::to_string(result[0].get<int>()) + ":" + std::to_string(result[1].get<int>()), "live-roster-stat") + "</div>";
|
||||
}
|
||||
std::stable_sort(order.begin(), order.end(), [&](const std::string &a, const std::string &b) { return (a == own) > (b == own); });
|
||||
std::string list = "<div class=\"live-roster\">";
|
||||
for (const auto &name : order)
|
||||
list += "<div class=\"live-roster-row heading\">" + live_text(name, "live-roster-name") + live_text("", "live-roster-stat") + "</div>" + groups.at(name);
|
||||
return list + "</div>";
|
||||
}
|
||||
std::string out;
|
||||
if (live_tab_ == "opponent") {
|
||||
const auto &opponent = match.at(owner.at("team").at("id") == match.at("home").at("id") ? "away" : "home");
|
||||
@@ -170,11 +191,11 @@ std::string App::live_ticker_events(const Json &frame, size_t &shown) {
|
||||
const auto &event = *i; const auto kind = event.value("kind", "");
|
||||
if (live_coverage_ == "single" && event.at("match_id") != live_selected_match_) continue;
|
||||
if (live_filter_ == "goal" && kind != "goal") continue;
|
||||
if (live_filter_ == "yellow" && kind != "yellow" && kind != "red") continue;
|
||||
if (live_filter_ == "highlights" && kind != "goal" && kind != "chance" && kind != "red") continue;
|
||||
if (live_filter_ == "yellow" && kind != "yellow" && kind != "red" && kind != "second_yellow") continue;
|
||||
if (live_filter_ == "highlights" && kind != "goal" && kind != "chance" && kind != "miss" && kind != "red" && kind != "second_yellow") continue;
|
||||
const auto &match = live_match_by_id(fixture.at("matches"), event.at("match_id"));
|
||||
out += "<article class=\"live-event " + std::string(kind == "goal" ? "is-goal" : "") + "\" data-live-event=\"" + esc(event.at("id").get<std::string>()) + "\">" + live_text(std::to_string(event.at("minute").get<int>()) + "′", "live-event-time") + live_badge(match.at(event.at("side").get<std::string>()), 54) +
|
||||
"<div class=\"live-event-copy\">" + live_text(match.at("home").at("name").get<std::string>() + " · " + match.at("away").at("name").get<std::string>(), "live-event-owners") + "<h3>" + live_text(event.at("headline")) + "</h3><p>" + live_text(event.at("body")) + "</p></div>" + live_text(live_score_text(event.at("score")), "live-event-score") + "</article>";
|
||||
"<div class=\"live-event-copy\">" + (fixture.at("source") == "engine-recording" && fixture.at("matches").size() == 1 ? std::string() : live_text(match.at("home").at("name").get<std::string>() + " · " + match.at("away").at("name").get<std::string>(), "live-event-owners")) + "<h3>" + live_text(event.at("headline")) + "</h3><p>" + live_text(event.at("body")) + "</p></div>" + live_text(live_score_text(event.at("score")), "live-event-score") + "</article>";
|
||||
++shown;
|
||||
}
|
||||
if (!shown) out += "<p class=\"live-note\">" + live_text(fixture.at("source") == "engine-recording" ? "Noch keine Meldungen." : "Für diesen Filter liegt noch keine Demomeldung vor.") + "</p>";
|
||||
@@ -217,7 +238,7 @@ std::string App::render_live() {
|
||||
out += live_ticker_events(frame, shown);
|
||||
out += "</div><footer class=\"live-ticker-footer\">" "<span id=\"live-event-count\" class=\"live-small\">" + esc(std::to_string(shown) + (live_.fixture().at("source") == "engine-recording" ? (shown == 1 ? " Meldung" : " Meldungen") : " Meldungen · feste Aufzeichnung")) + "</span>" + "<span id=\"live-phase-status\" class=\"live-small\">" + esc(phase_text) + "</span></footer></section></div><aside id=\"live-detail\" class=\"live-detail live-panel\"><header class=\"live-panel-heading\"><div class=\"live-detail-heading\"><h2>" + "<span id=\"live-owner-team\">" + esc(owner.at("team").at("name").get<std::string>()) + "</span></h2><p><span id=\"live-owner-name\">" + esc(owner.at("name").get<std::string>()) + "</span>" + "</p></div><nav class=\"live-team-switch\" aria-label=\"Managerdetails wechseln\">" +
|
||||
btn("live-owner-prev", arrow(false), "", "id=\"live-owner-prev\" aria-label=\"Vorheriger Manager\" " + std::string(fixture.at("owners").size() == 1 ? "disabled" : "")) + btn("live-owner-next", arrow(true), "", "id=\"live-owner-next\" aria-label=\"Nächster Manager\" " + std::string(fixture.at("owners").size() == 1 ? "disabled" : "")) + "</nav></header><nav class=\"live-tabs\">";
|
||||
for (const auto &[id, label] : std::array<std::pair<const char *, const char *>, 5>{{{"team", "Team"}, {"tactics", "Taktik"}, {"opponent", "Gegner"}, {"table", "Live-Tabelle"}, {"stats", "Statistik"}}}) out += btn("live-tab", label, live_tab_ == id ? "selected" : "", "id=\"live-tab-" + std::string(id) + "\" data-id=\"" + id + "\" aria-pressed=\"" + (live_tab_ == id ? "true" : "false") + "\"");
|
||||
for (const auto &[id, label] : std::array<std::pair<const char *, const char *>, 5>{{{"team", "Team"}, {"tactics", "Taktik"}, {"opponent", recorded ? "Ergebnisse" : "Gegner"}, {"table", "Live-Tabelle"}, {"stats", "Statistik"}}}) out += btn("live-tab", label, live_tab_ == id ? "selected" : "", "id=\"live-tab-" + std::string(id) + "\" data-id=\"" + id + "\" aria-pressed=\"" + (live_tab_ == id ? "true" : "false") + "\"");
|
||||
out += "</nav><div id=\"live-detail-body\" class=\"live-detail-body\" tabindex=\"0\">" + live_detail(owner, frame) + "</div><footer class=\"live-detail-footer\">" + btn("live-intervene-lineup", "Aufstellung & Wechsel", "", "id=\"live-lineup-edit\" " + std::string(live_.finished() || (recorded && !live_.running()) ? "disabled" : "")) + "</footer></aside></div>";
|
||||
out += "<div class=\"live-speed\">" + live_text("+") + "<input id=\"live-speed\" type=\"range\" orientation=\"vertical\" min=\"0\" max=\"4\" step=\"1\" value=\"" + std::to_string(4 - live_.speed()) + "\" aria-label=\"Wiedergabegeschwindigkeit; unten Pause\" aria-valuenow=\"" + std::to_string(live_.speed()) + "\" " + (live_.finished() ? "disabled" : "") + "/><span id=\"live-speed-value\" class=\"live-speed-value\">" + esc(live_.finished() ? "Ende" : live_.speed() ? std::to_string(live_.speed()) + "×" : "Pause") + "</span></div>";
|
||||
out += "<footer class=\"live-bottom\"><div class=\"live-bottom-actions\">" + btn("live-back", live_.running() ? "Zu Ende spielen" : recorded ? "Zum Schreibtisch" : "Zum Desktop", "", "id=\"live-back\"") + btn("live-pause", live_.speed() ? "Pause" : "Abspielen", "", "id=\"live-pause\" " + std::string(live_.finished() ? "disabled" : "")) + "</div><span id=\"live-playback-status\" class=\"live-bottom-note\">" + esc(live_feedback_.empty() ? std::string(phase_text) + " · " + std::to_string(minute) + (recorded ? "′" : "′ · keine Spielwertänderung") : live_feedback_) + "</span>" +
|
||||
|
||||
Reference in new issue
Block a user