Populate native desktop status, fixture and news widgets from the session (by Codex)
This commit is contained in:
1 parent
fd5c2b5330
commit
dc911f3281
21 files changed
+419
-91
No files matched your search
@@ -58,8 +58,7 @@ void App::engine_render() {
|
||||
} else {
|
||||
const auto &desk = engine_data_.at("desktop").at("data"), &meta = engine_data_.at("desktop").at("meta");
|
||||
const auto &team = desk.at("team"), &person = desk.at("manager");
|
||||
const auto *club = world_->find("clubs", team.at("id").get<std::string>());
|
||||
out = "<div class=\"desktop-layer\"><div class=\"info-bar\"><div class=\"identity\">" + crest(club, 82) +
|
||||
out = "<div class=\"desktop-layer\"><div class=\"info-bar\"><div class=\"identity\">" + engine_widget_crest(team, 82) +
|
||||
"<span><strong>" + esc(engine_text(team.at("name"))) + "</strong><small>" + esc(engine_text(person.at("name"))) +
|
||||
"</small></span></div><div class=\"info-date\">" + esc(meta.at("date").get<std::string>()) + "<small>" +
|
||||
esc(meta.at("season").at("label").get<std::string>()) + "</small></div><div class=\"info-cash\"><small>Guthaben</small><strong id=\"engine-cash\" class=\"" + money_classes(engine_money_minor(desk.at("accounts").at("cash"))) + "\">" +
|
||||
@@ -90,9 +89,12 @@ void App::engine_render() {
|
||||
init_desktop();
|
||||
for (const auto &[id, o] : desktop_.at("objects").items()) {
|
||||
if (!o.value("visible", false)) continue;
|
||||
if (meta.at("scope").at("role") == "national" &&
|
||||
(id == "account" || id == "warnings" || id == "fans" || id == "results" ||
|
||||
id == "own-curve" || id == "opponent-curve" || id == "comparison-curve")) continue;
|
||||
const auto style = rect(o.at("x"), o.at("y"), o.at("w"), o.at("h"));
|
||||
if (o.value("widget", false)) {
|
||||
std::string body;
|
||||
std::string body = engine_widget(id, o);
|
||||
if (id == "portrait") {
|
||||
auto portrait = person.value("portraitGuiKey", "");
|
||||
if (portrait.starts_with("gui:manager/photo/"))
|
||||
@@ -113,9 +115,18 @@ void App::engine_render() {
|
||||
} else if (id == "opponent-crest" && desk.at("nextFixture").is_object()) {
|
||||
const auto &next = desk.at("nextFixture");
|
||||
const auto &other = next.at(next.at("home").at("id") == team.at("id") ? "away" : "home");
|
||||
body = widget_heading("Nächster Gegner", false) + "<div class=\"center\" style=\"padding:30dp;\">" + crest(world_->find("clubs", other.at("id").get<std::string>()), 220) + "<p>" + esc(engine_text(other.at("name"))) + "</p></div>";
|
||||
body = widget_heading("Nächster Gegner", false) + "<div class=\"center\" style=\"padding:30dp;\">" + engine_widget_crest(other, 220) + "<p>" + esc(engine_text(other.at("name"))) + "</p></div>";
|
||||
}
|
||||
if (!body.empty()) {
|
||||
std::string size = "s";
|
||||
for (const auto &definition : widget_catalogue()) if (definition.at("id") == id)
|
||||
for (const auto &[key, span] : definition.at("spans").items())
|
||||
if (o.at("w") == span[0].get<int>() * 248 - 24 && o.at("h") == span[1].get<int>() * 248 - 24) size = key;
|
||||
const auto route = id == "calendar" || id == "competition" ? std::string("calendar") : std::string();
|
||||
out += "<div id=\"object-" + esc(id) + "\" class=\"desktop-card desk-card\" data-widget=\"" + esc(id) + "\" data-size=\"" + size + "\" " +
|
||||
(route.empty() ? "" : "data-engine-route=\"" + route + "\" data-action=\"engine-open\" data-id=\"" + route + "\" tabindex=\"0\" role=\"button\" ") +
|
||||
"style=\"" + style + "\">" + body + "</div>";
|
||||
}
|
||||
if (!body.empty()) out += "<div class=\"desktop-card desk-card\" style=\"" + style + "\">" + body + "</div>";
|
||||
} else {
|
||||
const auto route = id.substr(4);
|
||||
const bool camp_allowed = desk.at("menuAvailability").at("camps").value("status", "") == "available";
|
||||
|
||||
Reference in new issue
Block a user