From 5b9a9109f14b74279a8d576992c2b78e01522481 Mon Sep 17 00:00:00 2001 From: Weyoune Date: Sat, 14 Nov 2026 21:59:26 +0100 Subject: [PATCH] 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 --- assets/modern/live.rcss | 19 +++++++++++++++++++ src/modern/ui/live_screens.inc | 30 +++++++++++++++++++++--------- src/modern/ui/nation_flags.inc | 22 +++++++++++++++++++--- 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/assets/modern/live.rcss b/assets/modern/live.rcss index 50edae7..7146938 100644 --- a/assets/modern/live.rcss +++ b/assets/modern/live.rcss @@ -242,3 +242,22 @@ body.calm .live-moment.fresh {animation:none;} .live-dialog {width:1900dp;border-radius:12dp;} .live-event {border-left-width:0dp;} .live-table-row.own {border-left-width:0dp;} + +/* the goal banner lies above everything on its card and keeps its three parts in one row */ +.live-moment {z-index:6;padding:0 48dp;gap:40dp;overflow:hidden;top:112dp;height:230dp;} +.live-moment>.live-badge {flex-shrink:0;} +.live-moment>.live-moment-copy {flex:1;min-width:0;text-align:left;} +.live-moment strong {font-size:72dp;line-height:84dp;} +.live-moment-text {font-size:32dp;line-height:40dp;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.live-moment-score {flex-shrink:0;white-space:nowrap;font-family:Display;font-size:96dp;} +.live-game.solo .live-moment {top:120dp;height:260dp;padding:0 120dp;} +.live-game.solo .live-moment strong {font-size:96dp;line-height:108dp;} +.live-game.solo .live-moment-text {font-size:38dp;line-height:48dp;} +.live-game.solo .live-moment-score {font-size:132dp;} +.live-game.quad .live-moment {top:44dp;height:150dp;gap:24dp;padding:0 28dp;} +.live-game.quad .live-moment strong {font-size:48dp;line-height:56dp;} +.live-game.quad .live-moment-text {font-size:26dp;line-height:32dp;} +.live-game.quad .live-moment-score {font-size:64dp;} +.live-moment {height:284dp;} +.live-game.solo .live-moment {height:340dp;} +.live-game.quad .live-moment {height:150dp;} diff --git a/src/modern/ui/live_screens.inc b/src/modern/ui/live_screens.inc index 0af477d..8ee20ea 100644 --- a/src/modern/ui/live_screens.inc +++ b/src/modern/ui/live_screens.inc @@ -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() >= 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() < 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(); - live_moment_ = last.at("id").get(); - const size_t side = last.value("side", std::string("home")) == "away" ? 1 : 0; - out += "
" + live_badge(match.at(side ? "away" : "home"), quad ? 120 : 200) + - "
TOR!" + live_text(last.value("body", std::string()), "live-moment-text") + "
" + live_text(live_score_text(last.at("score")), "live-moment-score") + "
"; + const auto mark = "|" + goal->at("id").get() + "|"; + 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 += "
" + + live_badge(match.at(side ? "away" : "home"), layout == "solo" ? 200 : quad ? 96 : 150) + + "
TOR!" + live_text(goal->value("headline", std::string()), "live-moment-text") + "
" + + live_text(live_score_text(goal->at("score")), "live-moment-score") + "
"; } } return out + ""; diff --git a/src/modern/ui/nation_flags.inc b/src/modern/ui/nation_flags.inc index a7a8cc7..256a7be 100644 --- a/src/modern/ui/nation_flags.inc +++ b/src/modern/ui/nation_flags.inc @@ -5,7 +5,9 @@ namespace { std::string ui_nation_flag_svg(const std::string &value) { std::string code=value.starts_with("nation:")?value.substr(7):value; for(auto &c:code)if(c>='A'&&c<='Z')c=char(c-'A'+'a'); - const std::map aliases{{"x-eng","en"},{"eng","en"},{"ger","de"},{"deu","de"},{"fra","fr"},{"ita","it"},{"esp","es"},{"ned","nl"},{"nld","nl"},{"jpn","jp"},{"swe","se"},{"den","dk"},{"dnk","dk"},{"nga","ng"},{"bra","br"},{"mar","ma"},{"alg","dz"},{"dza","dz"}}; + const std::map aliases{{"x-eng","en"},{"eng","en"},{"ger","de"},{"deu","de"},{"fra","fr"},{"ita","it"},{"esp","es"},{"ned","nl"},{"nld","nl"},{"jpn","jp"},{"swe","se"},{"den","dk"},{"dnk","dk"},{"nga","ng"},{"bra","br"},{"mar","ma"},{"alg","dz"},{"dza","dz"}, + {"cro","hr"},{"hrv","hr"},{"sen","sn"},{"col","co"},{"can","ca"},{"kor","kr"},{"por","pt"},{"prt","pt"},{"arg","ar"},{"srb","rs"},{"bul","bg"},{"bgr","bg"}, + {"civ","ci"},{"cmr","cm"},{"mli","ml"},{"gha","gh"},{"mex","mx"},{"per","pe"},{"cze","cz"},{"tur","tr"},{"ecu","ec"},{"lux","lu"},{"gui","gn"},{"gin","gn"}}; if(auto it=aliases.find(code);it!=aliases.end())code=it->second; const auto rect=[](double x,double y,double w,double h,const char*fill){return "";}; std::string body; @@ -15,9 +17,17 @@ std::string ui_nation_flag_svg(const std::string &value) { {"nl",{"#bf5c56","#e6ebee","#5b83b1"}},{"be",{"#262b30","#e3c66b","#c7625b"}}, {"ie",{"#679b83","#e6ebee","#d69455"}},{"ro",{"#5685b6","#e3c66b","#c7625b"}}, {"ng",{"#38865d","#e6ebee","#38865d"}},{"at",{"#c7625b","#e6ebee","#c7625b"}}, - {"ru",{"#e6ebee","#5685b6","#c7625b"}},{"hu",{"#c7625b","#e6ebee","#679b83"}}}; + {"ru",{"#e6ebee","#5685b6","#c7625b"}},{"hu",{"#c7625b","#e6ebee","#679b83"}}, + {"hr",{"#c7625b","#e6ebee","#5685b6"}},{"rs",{"#c7625b","#5685b6","#e6ebee"}}, + {"bg",{"#e6ebee","#679b83","#c7625b"}},{"lu",{"#c7625b","#e6ebee","#7fb0d6"}}, + {"ar",{"#7fb0d6","#e6ebee","#7fb0d6"}},{"gh",{"#c7625b","#e3c66b","#38865d"}}, + {"sn",{"#38865d","#e3c66b","#c7625b"}},{"ml",{"#38865d","#e3c66b","#c7625b"}}, + {"cm",{"#38865d","#c7625b","#e3c66b"}},{"gn",{"#c7625b","#e3c66b","#38865d"}}, + {"ci",{"#d69455","#e6ebee","#38865d"}},{"mx",{"#38865d","#e6ebee","#c7625b"}}, + {"pe",{"#c7625b","#e6ebee","#c7625b"}}}; + static const std::set upright{"fr","it","be","ie","ro","ng","sn","ml","cm","gn","ci","mx","pe"}; if(auto it=bars.find(code);it!=bars.end()){ - const bool vertical=code=="fr"||code=="it"||code=="be"||code=="ie"||code=="ro"||code=="ng"; + const bool vertical=upright.contains(code); for(int i=0;i<3;++i)body+=rect(vertical?i*10.:0,vertical?0:i*20./3,vertical?10:30,vertical?20:20./3,it->second[size_t(i)]); }else if(code=="pl"||code=="ua")body=rect(0,0,30,10,code=="pl"?"#e6ebee":"#5685b6")+rect(0,10,30,10,code=="pl"?"#c7625b":"#e3c66b"); else if(code=="jp")body=rect(0,0,30,20,"#e6ebee")+""; @@ -29,6 +39,12 @@ std::string ui_nation_flag_svg(const std::string &value) { else if(code=="ma")body=rect(0,0,30,20,"#c7625b")+""; else if(code=="dz")body=rect(0,0,15,20,"#38865d")+rect(15,0,15,20,"#e6ebee")+""; else if(code=="br")body=rect(0,0,30,20,"#38865d")+""; + else if(code=="co"||code=="ec")body=rect(0,0,30,10,"#e3c66b")+rect(0,10,30,5,"#5685b6")+rect(0,15,30,5,"#c7625b"); + else if(code=="ca")body=rect(0,0,30,20,"#e6ebee")+rect(0,0,7.5,20,"#c7625b")+rect(22.5,0,7.5,20,"#c7625b")+""; + else if(code=="kr")body=rect(0,0,30,20,"#e6ebee")+""; + else if(code=="pt")body=rect(0,0,12,20,"#38865d")+rect(12,0,18,20,"#c7625b")+""; + else if(code=="cz")body=rect(0,0,30,10,"#e6ebee")+rect(0,10,30,10,"#c7625b")+""; + else if(code=="tr")body=rect(0,0,30,20,"#c7625b")+""; else return {}; return ""+body+""; }