The goal banner above its card, for every match that scores; more flags
The banner lay beneath the score board and clock and wrapped its score; it now lies above them with crest, headline and score in one row, and each match that scores in the running minute shows its own. Flags for Croatia, Senegal, Colombia, Canada, Korea, Portugal, Argentina and further nations. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe4b034181
commit
5b9a9109f1
3 files changed
+59
-12
No files matched your search
@@ -327,16 +327,28 @@ std::string App::live_card(const Json &match, const Json &frame, const std::stri
|
||||
}
|
||||
|
||||
// a goal that has just fallen: a banner across this card, once
|
||||
if (!frame.at("events").empty()) {
|
||||
const auto &last = frame.at("events").back();
|
||||
if (last.at("match_id") == match.at("id") && last.value("kind", std::string()) == "goal" && !live_.finished() &&
|
||||
last.at("minute").get<int>() >= minute - 1) {
|
||||
if (minute == 0) live_moment_.clear(); // a new match day: its banners are new again
|
||||
if (!frame.at("events").empty() && !live_.finished()) {
|
||||
// this match's latest report of the running minute; several matches may score at once
|
||||
const Json *goal = nullptr;
|
||||
const auto &events = frame.at("events");
|
||||
for (size_t at = events.size(); at-- > 0;) {
|
||||
const auto &event = events[at];
|
||||
if (event.at("minute").get<int>() < minute - 1) break;
|
||||
if (event.at("match_id") != match.at("id")) continue;
|
||||
if (event.value("kind", std::string()) == "goal") goal = &event;
|
||||
break;
|
||||
}
|
||||
if (goal) {
|
||||
// it stays while the minute lasts and slides in only the first time it is drawn
|
||||
const bool fresh = live_moment_ != last.at("id").get<std::string>();
|
||||
live_moment_ = last.at("id").get<std::string>();
|
||||
const size_t side = last.value("side", std::string("home")) == "away" ? 1 : 0;
|
||||
out += "<div class=\"live-moment" + std::string(fresh ? " fresh" : "") + "\" style=\"background-color:" + colours[side] + ";\">" + live_badge(match.at(side ? "away" : "home"), quad ? 120 : 200) +
|
||||
"<div><strong>TOR!</strong>" + live_text(last.value("body", std::string()), "live-moment-text") + "</div>" + live_text(live_score_text(last.at("score")), "live-moment-score") + "</div>";
|
||||
const auto mark = "|" + goal->at("id").get<std::string>() + "|";
|
||||
const bool fresh = live_moment_.find(mark) == std::string::npos;
|
||||
if (fresh) live_moment_ += mark;
|
||||
const size_t side = goal->value("side", std::string("home")) == "away" ? 1 : 0;
|
||||
out += "<div class=\"live-moment" + std::string(fresh ? " fresh" : "") + "\" style=\"background-color:" + colours[side] + ";\">" +
|
||||
live_badge(match.at(side ? "away" : "home"), layout == "solo" ? 200 : quad ? 96 : 150) +
|
||||
"<div class=\"live-moment-copy\"><strong>TOR!</strong>" + live_text(goal->value("headline", std::string()), "live-moment-text") + "</div>" +
|
||||
live_text(live_score_text(goal->at("score")), "live-moment-score") + "</div>";
|
||||
}
|
||||
}
|
||||
return out + "</button>";
|
||||
|
||||
Reference in new issue
Block a user