Show line-ups before kickoff, bind form and table widgets, rewrite the press wording
- Live ticker: the paused live state carries both starting elevens; the ticker lists them until the first report. A single match no longer gets an empty strip above the score, repeated status lines are gone, whistles carry no club badge, dates are written out. - Desk: "Die letzten Spiele" and the table place curve are fed by the engine (desktop-widgets read: recent, rankCurve) and belong to the default layout; the own crest widget is bound. - News: the German press templates are rewritten to one plain sentence each (the catalogue accepts a single sentence now); the reference snapshots follow, and the catalogue test can rewrite them with --update. Mailbox texts show world spellings of clubs and players and the euro sign. - Small type raised in advertising, lineup, news, toto, transfer and others; the transfer market column no longer runs under its scrollbar. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd20960f90
commit
9708b720b2
33 files changed
+418
-373
No files matched your search
@@ -12,9 +12,39 @@ std::string App::engine_widget(const std::string &id, const Json &o) {
|
||||
return engine_news_value_.is_object() ? render_news_widget(o)
|
||||
: std::string();
|
||||
if (id != "warnings" && id != "competition" && id != "own-summary" &&
|
||||
id != "opponent-summary")
|
||||
id != "opponent-summary" && id != "results" && id != "own-curve")
|
||||
return {};
|
||||
const auto data = engine_widgets_projection(engine_data_);
|
||||
if (id == "results") {
|
||||
// the last recorded matches, newest on the right; nothing to show before the first one
|
||||
const auto &rows = data.at("recent");
|
||||
if (!rows.is_array() || rows.empty())
|
||||
return widget_heading("Letzte Spiele", false) + "<div class=\"desk-fixture center\"><span>Noch kein Spiel gespielt.</span></div>";
|
||||
const int w = o.at("w");
|
||||
const bool wide = o.at("h") == 224;
|
||||
int won = 0, drawn = 0, lost = 0;
|
||||
std::string out = widget_heading(rows.size() == 1 ? "Letztes Spiel" : "Die letzten " + std::to_string(rows.size()) + " Spiele", false) + "<div class=\"desk-form\">";
|
||||
for (const auto &row : rows) {
|
||||
const auto form = row.value("form", std::string("U"));
|
||||
++(form == "S" ? won : form == "N" ? lost : drawn);
|
||||
out += "<div><span class=\"form-" + esc(form) + "\" style=\"width:" + scalar(wide ? 50 : w * .08) + "dp;height:" + scalar(wide ? 50 : w * .08) +
|
||||
"dp;font-size:" + scalar(wide ? 28 : std::max(28., w * .04)) + "dp;\"><span>" + esc(form) + "</span></span><strong style=\"font-size:" +
|
||||
scalar(wide ? 29 : std::max(28., w * .035)) + "dp;\">" + esc(row.value("score", std::string())) + "</strong></div>";
|
||||
}
|
||||
const auto count = [](int n, const char *one, const char *many) { return std::to_string(n) + " " + (n == 1 ? one : many); };
|
||||
return out + "</div>" + (wide ? std::string() : "<p class=\"desk-card-note\">" + count(won, "Sieg", "Siege") + " · " + std::to_string(drawn) + " Unentschieden · " + count(lost, "Niederlage", "Niederlagen") + "</p>");
|
||||
}
|
||||
if (id == "own-curve") {
|
||||
const auto &places = data.at("rankCurve");
|
||||
if (!places.is_array() || places.size() < 2)
|
||||
return widget_heading("Tabellenplatz", false) + "<div class=\"desk-fixture center\"><span>Die Kurve beginnt nach dem zweiten Spieltag.</span></div>";
|
||||
// widget_curve draws from the widget values; lend it the engine's series
|
||||
const Json kept = widget_data_;
|
||||
widget_data_ = {{"own_curve", places}};
|
||||
const auto curve = widget_curve(id, o, o.at("w"), o.at("h"));
|
||||
widget_data_ = kept;
|
||||
return widget_heading("Tabellenplatz", false) + curve;
|
||||
}
|
||||
if (id == "warnings")
|
||||
return widget_warnings(data.at("warnings"), o);
|
||||
if (id == "own-summary" || id == "opponent-summary") {
|
||||
|
||||
Reference in new issue
Block a user