diff --git a/assets/modern/modern.rml b/assets/modern/modern.rml index 2989e74..3f6ac7d 100644 --- a/assets/modern/modern.rml +++ b/assets/modern/modern.rml @@ -1,6 +1,6 @@ Dreierpack Manager - +
diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss new file mode 100644 index 0000000..78a859e --- /dev/null +++ b/assets/modern/pages.rcss @@ -0,0 +1,197 @@ +/* SPDX-License-Identifier: GPL-3.0-only */ +/* The pages of the notebook: one sheet of 1244 x 720 design units (1 unit = 2.25 dp), that is + 2799 x 1620 dp, under the page's heading. Building blocks shared by all pages: panels, tables, + buttons, tabs, pickers, meters, dialogs. The inks are the notebook's (cream, terracotta, sage); + the dark skins replace the ramps and nothing else. */ +body {--p-bg:#23262d;--p-surf:#343842;--p-text:#f0ece2;--p-div:#f0ece233;--p-shade:#00000059; + --p-n1:#2a2d34;--p-n2:#30343c;--p-n3:#3d424c;--p-n4:#525966;--p-n5:#6f7684;--p-n6:#8f95a1;--p-n7:#b1b6bf;--p-n8:#d2d6dc;--p-n9:#f0ece2; + --p-a1:#3b2f27;--p-a2:#4d3826;--p-a3:#6e4827;--p-a4:#b9773c;--p-a5:#d08d4c;--p-a6:#e0a25f;--p-a7:#ebb87f;--p-a8:#f3d0a8;--p-a9:#fbead4; + --p-s1:#2b3526;--p-s2:#35412c;--p-s3:#455437;--p-s4:#5d7048;--p-s5:#7c9062;--p-s6:#9db382;--p-s7:#b9cba0;--p-s8:#d3e0bf;--p-s9:#e9f1dc; + --p-accent:#e0a25f;--p-on-accent:#23262d;--p-row:#f0ece20a;--p-rule:#f0ece21c;} +body.silver {--p-bg:#f5ead8;--p-surf:#ebddc5;--p-text:#201e1d;--p-div:#201e1d29;--p-shade:#2e2b2557; + --p-n1:#f9f4ed;--p-n2:#eee7db;--p-n3:#dcd3c4;--p-n4:#c0b6a5;--p-n5:#a19786;--p-n6:#82796a;--p-n7:#645c50;--p-n8:#474238;--p-n9:#2e2b25; + --p-a1:#fff2eb;--p-a2:#ffe1d0;--p-a3:#ffc6a5;--p-a4:#f6a06b;--p-a5:#d67f48;--p-a6:#b2622d;--p-a7:#8c491a;--p-a8:#643312;--p-a9:#402310; + --p-s1:#f0fae1;--p-s2:#e1eecc;--p-s3:#ccdbb2;--p-s4:#aebf92;--p-s5:#8fa073;--p-s6:#728157;--p-s7:#56633f;--p-s8:#3d472b;--p-s9:#272e1b; + --p-accent:#c67139;--p-on-accent:#f9f4ed;--p-row:#201e1d0a;--p-rule:#201e1d17;} +body.matchday {--p-bg:#e4eed6;--p-surf:#cfe0b8;--p-text:#1d2a16;--p-div:#1d2a162e;--p-shade:#232d1c57; + --p-n1:#f1f6e8;--p-n2:#e2ecd4;--p-n3:#cddbbb;--p-n4:#afc09a;--p-n5:#8c9e78;--p-n6:#6d7f5b;--p-n7:#526345;--p-n8:#3a4830;--p-n9:#232d1c; + --p-a1:#e6f3df;--p-a2:#cfe8c4;--p-a3:#a9d39a;--p-a4:#7dba6c;--p-a5:#58a049;--p-a6:#3f7a3a;--p-a7:#2f602c;--p-a8:#214720;--p-a9:#152f15; + --p-s1:#fff2e6;--p-s2:#ffe0c4;--p-s3:#f9c596;--p-s4:#eda565;--p-s5:#d6853f;--p-s6:#b2682a;--p-s7:#8c4f1c;--p-s8:#643712;--p-s9:#40230d; + --p-accent:#3f7a3a;--p-on-accent:#f1f6e8;--p-row:#1d2a160a;--p-rule:#1d2a1617;} + +/* --- the sheet --- */ +.window.nb-sheet.pg-root {left:558dp;top:400.5dp;width:2799dp;height:1620dp;transform:none;overflow:visible;font-size:30dp;line-height:42dp;color:var(--p-text); + --text:var(--p-text);--muted:var(--p-n7);--border:var(--p-div);--accent:var(--p-a7);} +.pg-root>.content {position:absolute;left:0;top:0;right:auto;bottom:auto;width:2799dp;height:1620dp;overflow:visible;} +.pg-page {position:absolute;left:0;top:0;width:2799dp;height:1620dp;display:flex;flex-direction:column;gap:27dp;} +.pg-body {display:flex;flex:1;gap:36dp;min-height:0;} +.pg-col {display:flex;flex-direction:column;gap:27dp;min-width:0;min-height:0;} +.pg-row {display:flex;align-items:center;gap:27dp;min-width:0;} +.pg-grow {flex:1;min-width:0;min-height:0;} +.pg-foot {display:flex;flex:none;align-items:center;gap:18dp;height:81dp;padding-right:130dp;} +.pg-sp {display:block;flex:1;} +.pg-status {display:block;max-width:1500dp;height:60dp;line-height:60dp;padding:0 27dp;border-radius:30dp;background-color:var(--p-n1);font-size:28dp;color:var(--p-n8);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.pg-panel {display:block;background-color:var(--p-n1);border:2dp var(--p-div);border-radius:45dp;padding:32dp 36dp;} +.pg-panel.pg-col,.pg-surf.pg-col {display:flex;} +.pg-panel.pg-row,.pg-surf.pg-row {display:flex;} +.pg-surf {display:block;background-color:var(--p-surf);border-radius:45dp;padding:32dp 36dp;} +.pg-k {display:block;font-size:25dp;line-height:34dp;letter-spacing:2.5dp;font-weight:bold;color:var(--p-a7);white-space:nowrap;} +.pg-h {display:block;margin:0;font-family:Display;font-weight:normal;font-size:43dp;line-height:50dp;} +.pg-h.large {font-size:58dp;line-height:66dp;} +.pg-big {display:block;font-family:Display;font-weight:normal;font-size:68dp;line-height:72dp;} +.pg-mut {color:var(--p-n7);} +.pg-r {text-align:right;} .pg-c {text-align:center;} +.pg-nowrap {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.pg-empty {display:flex;flex:1;align-items:center;justify-content:center;padding:54dp;text-align:center;font-size:34dp;color:var(--p-n7);} +.pg-heading {display:flex;flex:none;align-items:flex-end;gap:27dp;height:66dp;} +.pg-heading .pg-mut {display:block;line-height:50dp;white-space:nowrap;} + +/* --- buttons --- */ +.pg-root button {font-family:Modern;font-size:30dp;color:var(--p-text);} +.pg-btn,.pg-btn:disabled {display:flex;flex:none;align-items:center;justify-content:center;height:68dp;padding:0 32dp;border:2dp var(--p-div);border-radius:36dp;background-color:var(--p-n1);decorator:none;font-family:Display;font-size:31dp;line-height:40dp;color:var(--p-text);white-space:nowrap;} +.pg-btn:hover {background-color:var(--p-n2);decorator:none;border-color:var(--p-div);} +.pg-btn.primary,.pg-btn.primary:disabled {background-color:var(--p-accent);border-color:var(--p-accent);color:var(--p-on-accent);} +.pg-btn.primary:hover {background-color:var(--p-a6);border-color:var(--p-a6);} +.pg-btn.on,.pg-btn.on:hover {background-color:var(--p-a2);border-color:var(--p-a6);color:var(--p-a9);} +.pg-btn.round {width:68dp;padding:0;font-size:44dp;} +.pg-btn.block {flex:1;} +.pg-btn:disabled {opacity:.45;} +.pg-btn .control-label,.pg-btn span {display:block;white-space:nowrap;} +.pg-link,.pg-link:hover,.pg-link:disabled {display:flex;flex:none;align-items:center;gap:16dp;max-width:100%;height:auto;padding:0;border:0dp;border-radius:18dp;background-color:transparent;decorator:none;font-family:Modern;font-size:30dp;font-weight:bold;color:var(--p-text);text-align:left;} +.pg-link:hover {color:var(--p-a7);} +.pg-link span {display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.pg-link.reverse {flex-direction:row-reverse;text-align:right;} +.pg-link.plain {font-weight:normal;} +/* a row of choices in one pill */ +.pg-seg {display:flex;flex:none;height:64dp;border:2dp var(--p-div);border-radius:34dp;overflow:hidden;background-color:var(--p-n1);} +.pg-seg button,.pg-seg button:disabled {display:block;height:60dp;line-height:60dp;padding:0 29dp;border:0dp;border-left:2dp var(--p-div);border-radius:0dp;background-color:transparent;decorator:none;font-size:29dp;font-weight:bold;white-space:nowrap;color:var(--p-text);} +.pg-seg button.first {border-left-width:0dp;} +.pg-seg button:hover {background-color:var(--p-n2);} +.pg-seg button.on,.pg-seg button.on:hover {background-color:var(--p-a2);color:var(--p-a9);} +.pg-seg button:disabled {opacity:.45;} +.pg-seg button span {display:block;} +/* tabs inside a page */ +.pg-tabs {display:flex;flex:none;gap:14dp;} +.pg-tabs button,.pg-tabs button:disabled {display:block;height:62dp;line-height:62dp;padding:0 36dp;border:0dp;border-radius:32dp 32dp 9dp 9dp;background-color:var(--p-n2);decorator:none;font-family:Display;font-size:34dp;color:var(--p-n8);white-space:nowrap;} +.pg-tabs button:hover {background-color:var(--p-n3);} +.pg-tabs button.on,.pg-tabs button.on:hover {background-color:var(--p-a2);color:var(--p-a9);} +.pg-tabs button:disabled {opacity:.45;} +.pg-tabs button span {display:block;} +/* a tag */ +.pg-tag {display:block;flex:none;height:44dp;line-height:44dp;padding:0 22dp;border-radius:27dp;background-color:var(--p-n2);font-size:25dp;white-space:nowrap;color:var(--p-n9);} +.pg-tag.accent {background-color:var(--p-a2);color:var(--p-a8);} +.pg-tag.sage {background-color:var(--p-s2);color:var(--p-s8);} + +/* --- pickers in the foot of a page (the list opens upwards) --- */ +.pg-root .report-picker-wrapper.pg-dd {position:relative;left:auto;bottom:auto;flex:none;height:68dp;overflow:visible;} +.pg-root .pg-dd .report-picker-trigger,.pg-root .pg-dd .report-picker-trigger:disabled {display:flex;align-items:center;justify-content:flex-start;gap:14dp;width:auto;height:68dp;padding:0 30dp;border:2dp var(--p-div);border-radius:36dp;background-color:var(--p-n1);decorator:none;font-family:Display;font-size:31dp;color:var(--p-text);} +.pg-root .pg-dd .report-picker-trigger:hover {background-color:var(--p-n2);decorator:none;} +.pg-dd-l {display:block;flex:none;font-family:Modern;font-size:25dp;letter-spacing:1.5dp;color:var(--p-n7);} +.pg-root .pg-dd .report-picker-label {flex:none;max-width:900dp;} +.pg-root .pg-dd .report-picker-arrow {width:24dp;height:24dp;} +.pg-root .pg-dd .report-picker-arrow span {left:5dp;top:2dp;width:11dp;height:11dp;border-color:var(--p-n8);} +.pg-root .pg-dd .report-picker-popup {left:0;right:auto;bottom:82dp;min-width:100%;width:auto;max-height:742dp;padding:14dp;border:2dp var(--p-div);border-radius:36dp;background-color:var(--p-n1);z-index:60;} +.pg-root .pg-dd .report-picker-popup .report-picker-option {height:60dp;min-height:60dp;padding:0 27dp 0 14dp;border-radius:22dp;font-family:Modern;font-size:30dp;color:var(--p-text);white-space:nowrap;} +.pg-root .pg-dd .report-picker-popup .report-picker-option:hover,.pg-root .pg-dd .report-picker-popup .report-picker-option:focus {background-color:var(--p-a1);} +.pg-root .pg-dd .report-picker-popup .report-picker-option[aria-checked=true] {font-weight:bold;} +.pg-root .pg-dd .report-picker-check {border-color:var(--p-a7);} +.pg-root .pg-dd .report-picker-option-label {overflow:visible;} + +/* --- tables: rows of cells; the head stays, the body scrolls --- */ +.pg-t {display:flex;flex-direction:column;flex:1;min-height:0;font-size:30dp;} +.pg-thead {display:flex;flex:none;align-items:center;height:70dp;border-bottom:3dp var(--p-n4);} +.pg-th,.pg-th:hover {display:block;flex:none;height:auto;padding:0 18dp;border:0dp;border-radius:0dp;background-color:transparent;decorator:none;font-family:Modern;font-size:24dp;line-height:34dp;letter-spacing:1.7dp;font-weight:bold;color:var(--p-n7);text-align:left;white-space:nowrap;} +button.pg-th:hover {color:var(--p-a7);} +.pg-th.flex,.pg-td.flex {flex:1;min-width:0;} +.pg-th.r,.pg-td.r {text-align:right;} .pg-th.c,.pg-td.c {text-align:center;} +.pg-th span {display:block;} +.pg-tbody {display:block;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;} +.pg-tbody.even {display:flex;flex-direction:column;justify-content:space-around;} +.pg-tr {display:flex;flex:none;align-items:center;height:70dp;border-bottom:2dp var(--p-rule);} +.pg-tr:hover {background-color:var(--p-row);} +.pg-tr.me {background-color:var(--p-a1);font-weight:bold;} +.pg-tr.sel {background-color:var(--p-a2);} +.pg-tr.grp {height:58dp;background-color:var(--p-surf);} +.pg-tr.grp .pg-td {font-size:24dp;letter-spacing:2.4dp;font-weight:bold;color:var(--p-a8);} +.pg-tr.z-eu {background-color:var(--p-s1);} .pg-tr.z-auf {background-color:var(--p-s2);} .pg-tr.z-ab {background-color:var(--p-a2);} +.pg-tr.me.z-eu,.pg-tr.me.z-auf {background-color:var(--p-s3);} .pg-tr.me.z-ab {background-color:var(--p-a3);} +.pg-td {display:block;flex:none;padding:0 18dp;white-space:nowrap;overflow:hidden;} +.pg-td.cell {display:flex;align-items:center;gap:18dp;} +.pg-td.cell.r {justify-content:flex-end;} .pg-td.cell.c {justify-content:center;} +.pg-td b,.pg-td strong {font-weight:bold;} +.pg-num {display:block;font-family:Display;font-weight:normal;font-size:38dp;line-height:44dp;} +.pg-zone {display:block;flex:none;width:14dp;height:45dp;border-radius:7dp;} +.pg-zone.eu {background-color:var(--p-s6);} .pg-zone.auf {background-color:var(--p-s8);} .pg-zone.ab {background-color:var(--p-a7);} +.pg-rank {display:block;flex:none;width:50dp;text-align:right;font-weight:bold;} +/* the position of a player */ +.pg-pos {display:block;flex:none;width:86dp;height:38dp;line-height:38dp;border-radius:20dp;font-size:24dp;font-weight:bold;text-align:center;background-color:var(--p-n2);color:var(--p-n9);} +.pg-pos.TW {background-color:var(--p-n3);} .pg-pos.ABW {background-color:var(--p-s2);color:var(--p-s9);} .pg-pos.MIT {background-color:var(--p-a2);color:var(--p-a9);} .pg-pos.STU {background-color:var(--p-a7);color:var(--p-n1);} +/* the last matches as marks */ +.pg-form {display:flex;flex:none;gap:7dp;} +.pg-form span {display:block;width:38dp;height:38dp;line-height:38dp;border-radius:19dp;font-size:21dp;font-weight:bold;text-align:center;} +.pg-form .S {background-color:var(--p-s7);color:var(--p-n1);} .pg-form .U {background-color:var(--p-n3);color:var(--p-n9);} .pg-form .N {background-color:var(--p-a8);color:var(--p-n1);} .pg-form .X {background-color:transparent;border:2dp var(--p-n3);width:34dp;height:34dp;} +/* meters, marks, figures */ +.pg-bar {display:block;flex:1;height:20dp;border-radius:10dp;background-color:var(--p-n3);overflow:hidden;} +.pg-bar div {height:20dp;border-radius:10dp;background-color:var(--p-accent);} +.pg-bar div.sage {background-color:var(--p-s6);} .pg-bar div.soft {background-color:var(--p-a5);} +.pg-dots {display:flex;flex:none;gap:7dp;} +.pg-dots span {display:block;width:20dp;height:20dp;border-radius:10dp;background-color:var(--p-n3);} +.pg-dots span.on {background-color:var(--p-a6);} +.pg-stat {display:flex;flex-direction:column;flex:1;min-width:0;padding:22dp 32dp;border:2dp var(--p-div);border-radius:40dp;background-color:var(--p-n1);} +.pg-stat strong {display:block;margin-top:4dp;font-family:Display;font-weight:normal;font-size:54dp;line-height:60dp;white-space:nowrap;} +.pg-stat small {display:block;margin-top:4dp;font-size:26dp;line-height:34dp;color:var(--p-n7);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.pg-kv {display:flex;justify-content:space-between;gap:32dp;font-size:29dp;line-height:44dp;} +.pg-kv span {display:block;color:var(--p-n7);white-space:nowrap;} +.pg-kv strong {display:block;font-weight:bold;text-align:right;white-space:nowrap;} +.pg-legend {display:flex;flex:none;gap:32dp;font-size:27dp;color:var(--p-n8);} +.pg-legend-item {display:flex;align-items:center;gap:14dp;} +.pg-legend-item span {display:block;white-space:nowrap;} +.pg-legend-mark {display:block;width:27dp;height:27dp;border-radius:9dp;} +.pg-card,.pg-card:disabled {display:flex;flex-direction:column;gap:14dp;padding:27dp 32dp;border:2dp var(--p-div);border-radius:45dp;background-color:var(--p-n1);decorator:none;text-align:left;font-family:Modern;font-size:30dp;color:var(--p-text);} +.pg-card:hover {border-color:var(--p-a6);background-color:var(--p-n1);decorator:none;} +.pg-card.sel,.pg-card.sel:hover {background-color:var(--p-a1);border-color:var(--p-a6);} +.pg-card:disabled {opacity:.5;} +.pg-score {display:block;font-family:Display;font-size:36dp;line-height:42dp;white-space:nowrap;} +.pg-match {display:flex;flex:none;align-items:center;gap:22dp;height:112dp;padding:0 27dp;border-bottom:2dp var(--p-rule);} +.pg-match.me {background-color:var(--p-a1);border-radius:22dp;font-weight:bold;} +.pg-match-side {display:flex;flex:1;min-width:0;} +.pg-match-side.home {justify-content:flex-end;} +.pg-match-mid {display:block;flex:none;width:270dp;text-align:center;} +.pg-match-mid small {display:block;font-size:26dp;line-height:32dp;color:var(--p-n7);white-space:nowrap;} +.pg-match-head {display:flex;flex:none;gap:22dp;padding:0 27dp 14dp 27dp;border-bottom:3dp var(--p-n4);} +.pg-match-head .pg-k {flex:1;} + +/* --- dialogs: a note laid on the dimmed book --- */ +.pg-ov {position:absolute;left:0;top:0;width:3840dp;height:2160dp;z-index:400;display:flex;align-items:center;justify-content:center;background-color:var(--p-shade);font-size:30dp;line-height:42dp;color:var(--p-text);} +.pg-dlg {display:flex;flex-direction:column;gap:27dp;max-height:1980dp;padding:45dp 50dp;border:2dp var(--p-n4);border-radius:63dp;background-color:var(--p-bg);color:var(--p-text);} +.pg-dlg h2 {display:block;margin:0;font-family:Display;font-weight:normal;font-size:54dp;line-height:62dp;} +.pg-dlg-sub {display:block;margin-top:4dp;color:var(--p-n7);} +.pg-dlg p {display:block;margin:0;font-size:34dp;line-height:46dp;} +.pg-dlg-act {display:flex;justify-content:flex-end;align-items:center;gap:18dp;margin-top:9dp;} +.pg-ov button {font-family:Modern;font-size:30dp;color:var(--p-text);} +.pg-th-text {display:flex;align-items:center;gap:10dp;} +.pg-th.r .pg-th-text {justify-content:flex-end;} .pg-th.c .pg-th-text {justify-content:center;} +.pg-sort {display:block;width:0;height:0;border-left:8dp transparent;border-right:8dp transparent;} +.pg-sort.up {border-bottom:10dp var(--p-a7);} .pg-sort.down {border-top:10dp var(--p-a7);} + +/* --- player statistics, fair play --- */ +.pg-photo {display:block;flex:none;overflow:hidden;background-color:var(--p-n2);} +.pg-link.large {font-family:Modern;font-size:36dp;gap:27dp;} +.pg-lead.first {background-color:var(--p-a1);border-color:var(--p-a6);} +.pg-lead-place {flex:none;width:112dp;color:var(--p-a7);} +.pg-lead-person {display:flex;flex-direction:column;gap:9dp;align-items:flex-start;} +.pg-lead-of {display:block;flex:none;max-width:420dp;} +.pg-lead-figure {flex:none;min-width:90dp;text-align:right;} +.pg-card-mark.yellow {width:20dp;height:27dp;border-radius:4dp;background-color:#e9b949;} +.pg-card-mark.red {width:20dp;height:27dp;border-radius:4dp;background-color:#b3402f;} + +/* --- the older dialogs in the same hand: cream note, round corners, pill buttons --- */ +body .report-detail-layer,body .amount-layer,body .stadium-modal {background-color:var(--p-shade);} +body .report-detail-card,body .toto-dialog,body .planning-dialog,body .transfer-dialog,body .contracts-dialog,body .amount-box,body .career-history-dialog {border:2dp var(--p-n4);border-radius:63dp;background-color:var(--p-bg);decorator:none;box-shadow:none;color:var(--p-text); + --text:var(--p-text);--muted:var(--p-n7);--border:var(--p-div);--accent:var(--p-a7);--panel:var(--p-n1);--soft:var(--p-n1);--hover:var(--p-n2);--selected:var(--p-a2);--strong:var(--p-n1);--input:var(--p-n1);} +body .report-detail-card h2,body .toto-dialog h2,body .planning-dialog h2,body .transfer-dialog>h2,body .contracts-dialog h2,body .amount-box h2 {font-family:Display;font-weight:normal;letter-spacing:0dp;color:var(--p-text);} +body .report-detail-actions .report-detail-action,body .toto-dialog-actions button,body .planning-dialog-actions button,body .transfer-dialog-actions button,body .contract-dialog-actions button,body .stadium-dialog-action,body .amount-review-actions button {border:2dp var(--p-div);border-radius:40dp;background-color:var(--p-n1);decorator:none;font-family:Display;color:var(--p-text);} +body .report-detail-actions .report-detail-action:hover,body .toto-dialog-actions button:hover,body .planning-dialog-actions button:hover,body .transfer-dialog-actions button:hover,body .contract-dialog-actions button:hover,body .stadium-dialog-action:hover,body .amount-review-actions button:hover {background-color:var(--p-n2);decorator:none;} +body .toto-dialog-actions button.primary,body .planning-dialog-actions button.primary,body .transfer-dialog-actions button.primary,body .contract-dialog-actions button.primary,body .stadium-dialog-action.primary,body .amount-review-actions button.primary,body .amount-actions .amount-button.amount-accept {background-color:var(--p-accent);border-color:var(--p-accent);decorator:none;color:var(--p-on-accent);} +body .amount-button {border:2dp var(--p-div);border-radius:32dp;background-color:var(--p-n1);decorator:none;font-family:Display;color:var(--p-text);} +body .amount-button:hover {background-color:var(--p-a1);filter:none;} diff --git a/assets/modern/rankings.rcss b/assets/modern/rankings.rcss index a0581ad..4743acb 100644 --- a/assets/modern/rankings.rcss +++ b/assets/modern/rankings.rcss @@ -1,134 +1,2 @@ /* SPDX-License-Identifier: GPL-3.0-only */ -.rankings-scorers,.rankings-fairplay {position:absolute;left:0;right:0;top:0;bottom:0;} -.rankings-heading {height:92dp;display:flex;align-items:center;justify-content:space-between;gap:30dp;} -.rankings-heading>div {display:flex;align-items:baseline;gap:24dp;min-width:0;flex:1;} -.rankings-heading h2 {font-size:38dp;font-weight:normal;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} -.rankings-heading span {font-size:28dp;white-space:nowrap;flex-shrink:0;} -.rankings-heading p {font-size:28dp;color:var(--muted);white-space:nowrap;flex-shrink:0;} -.rankings-tabs {position:absolute;left:0;right:0;top:104dp;height:106dp;display:flex;gap:8dp;border-bottom:2dp var(--border);} -.rankings-tab {position:relative;display:flex;align-items:center;justify-content:center;gap:20dp;flex:1;min-width:0;padding:0;border:0dp;border-radius:12dp 12dp 0dp 0dp;background-color:transparent;font-size:34dp;font-weight:normal;} -.rankings-tab:hover {background-color:var(--hover);} -.rankings-tab[aria-selected=true] {background-color:#8dbfaf0e;color:#c7eadf;} -.rankings-tab-underline {display:none;position:absolute;left:28dp;right:28dp;bottom:-2dp;height:5dp;border-radius:5dp 5dp 0dp 0dp;background-color:#a9dccb;} -.rankings-tab[aria-selected=true] .rankings-tab-underline {display:block;} -.rankings-tab-icon {display:flex;align-items:center;justify-content:center;width:34dp;height:34dp;flex-shrink:0;} -.rankings-card-icon {display:block;width:24dp;height:34dp;border-radius:4dp;transform:rotate(-7deg);} -.rankings-card-icon.yellow {background-color:#e0c56e;} -.rankings-card-icon.red {background-color:#dc8078;} -.rankings-panel {position:absolute;left:0;right:0;top:244dp;bottom:148dp;} -.rankings-leaders {display:flex;gap:24dp;height:320dp;} -.rankings-leader {position:relative;display:flex;align-items:center;gap:20dp;width:854.666667dp;flex-shrink:0;min-width:0;height:320dp;padding:58dp 28dp 26dp;border:2dp var(--border);border-radius:18dp;decorator:linear-gradient(145deg,#b7d4e90a,#12233242);} -.rankings-leader.first {border-color:#a9dccb5e;decorator:linear-gradient(145deg,#a9dccb12,#12233242);} -.rankings-leader-rank {position:absolute;left:28dp;top:22dp;font-size:28dp;color:var(--muted);} -.rankings-leader-person {display:flex;flex-direction:column;gap:24dp;flex:1;min-width:0;} -.rankings-player-button {display:flex;align-items:center;gap:26dp;width:100%;min-width:0;padding:0;border:0dp;border-radius:10dp;background-color:transparent;text-align:left;font-size:34dp;} -.rankings-player-button:hover {background-color:transparent;} -.rankings-player-button:focus-visible {background-color:var(--hover);} -.rankings-player-name {display:block;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} -.rankings-photo {display:block;flex-shrink:0;border:2dp var(--border);border-radius:44dp;overflow:hidden;background-color:var(--panel);} -.rankings-leader .rankings-photo {border-radius:63dp;} -.rankings-photo .image-frame {max-width:100%;max-height:100%;} -.rankings-leader .rankings-player-button {gap:22dp;font-size:36dp;line-height:41.4dp;} -.rankings-leader .rankings-player-name {white-space:normal;max-height:124.2dp;overflow:hidden;} -.rankings-club-button {display:flex;align-items:center;width:100%;min-width:0;max-width:100%;padding:0;border:0dp;background-color:transparent;color:var(--muted);text-align:left;font-size:36dp;} -.rankings-club-button.current {color:var(--accent);} -.rankings-club-button:hover {background-color:transparent;} -.rankings-club-button:focus-visible {background-color:var(--hover);} -.rankings-club-button .club-label {width:100%;min-width:0;max-width:100%;gap:12dp;} -.rankings-club-button .image-frame {flex-shrink:0;} -.rankings-club-button .club-label>span {display:block;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} -.rankings-leader .rankings-club-button {font-size:28dp;} -.rankings-leader-value {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14dp;width:146dp;flex-shrink:0;} -.rankings-leader-value strong {font-size:88dp;font-weight:normal;line-height:88dp;} -.rankings-leader-value>span {font-size:28dp;line-height:28.8dp;color:var(--muted);text-align:center;} -.kind-2 .rankings-leader-value strong {color:#e0c98b;} -.kind-3 .rankings-leader-value strong {color:#e3aaa2;} -.rankings-scorer-list {position:absolute;left:0;right:0;top:352dp;bottom:0;border:2dp var(--border);border-radius:18dp;background-color:#13263526;overflow-x:hidden;overflow-y:auto;} -.rankings-table {width:100%;} -.rankings-row {display:flex;align-items:stretch;height:118dp;font-size:36dp;} -.rankings-row>div {display:flex;align-items:center;flex:1;min-width:0;padding:12dp 28dp;overflow:hidden;} -.rankings-row>div:first-child {width:47%;flex:none;} -.rankings-row>div:last-child {width:290dp;flex:none;justify-content:center;} -.rankings-cell-value {display:block;width:100%;min-width:0;white-space:nowrap;} -.rankings-row>div:last-child .rankings-cell-value,.rankings-fair-row>div:not(:first-child) .rankings-cell-value {text-align:center;} -.rankings-row.rankings-head {height:74dp;font-size:28dp;} -.rankings-head {color:var(--muted);border-bottom:2dp var(--border);} -.rankings-row.striped,.rankings-fair-row.striped {background-color:var(--soft);} -.rankings-row:hover,.rankings-fair-row:hover {background-color:var(--hover);} -.rankings-rest-player {gap:24dp;} -.rankings-rest-player .rankings-player-button {flex:1;} -.rankings-scorer-list .rankings-player-button,.rankings-scorer-list .rankings-club-button {padding:2dp 6dp;color:var(--text);} -.rankings-scorer-list .rankings-club-button.current {color:var(--accent);} -.rankings-rank {display:block;width:64dp;flex-shrink:0;font-size:30dp;color:var(--muted);text-align:right;} -.rankings-footer .report-picker-trigger {font-size:30dp;} -.rankings-own-club {display:flex;align-items:center;width:1725.333333dp;height:94dp;max-width:1725.333333dp;padding-right:28dp;font-size:32dp;} -.rankings-own-club .club-label {min-width:0;max-width:1100dp;gap:14dp;} -.rankings-own-club .club-label>span {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} -.rankings-empty {padding:28dp;font-size:30dp;color:var(--muted);} -.rankings-fair-heading {height:100dp;display:flex;align-items:center;justify-content:space-between;gap:24dp;font-size:30dp;color:var(--muted);} -.rankings-fair-heading>div {display:flex;gap:20dp;} -.rankings-fair-heading span {padding:12dp 20dp;border:2dp var(--border);border-radius:12dp;background-color:var(--panel);white-space:nowrap;} -.rankings-yellow {color:#e0cc92;} -.rankings-red {color:#dfa69d;} -.rankings-fair-list {position:absolute;left:0;right:0;top:130dp;bottom:0;border:2dp var(--border);border-radius:18dp;background-color:#12243140;overflow-x:hidden;overflow-y:auto;} -.rankings-fair-row {display:flex;align-items:stretch;height:66dp;font-size:36dp;} -.rankings-fair-row>div {display:flex;align-items:center;justify-content:center;width:15%;flex-shrink:0;min-width:0;padding:7dp 14dp;overflow:hidden;} -.rankings-fair-row>div:first-child {width:55%;justify-content:flex-start;gap:14dp;} -.rankings-fair-row>div:nth-child(2) {color:#e0cc92;} -.rankings-fair-row>div:nth-child(3) {color:#dfa69d;} -.rankings-fair-row:not(.rankings-head)>div:last-child {color:var(--accent);} -.rankings-fair-rank {display:block;width:64dp;flex-shrink:0;text-align:right;} -.rankings-fair-row .report-club-button {min-width:0;max-width:100%;} -.rankings-fair-row.rankings-head {font-size:30dp;} -body.midnight .rankings-row.striped,body.midnight .rankings-fair-row.striped {background-color:#e3edf605;} -body.midnight .rankings-row,body.midnight .rankings-fair-row {color:#d8e0e8;} -body.midnight .rankings-head {color:#a0aebc;} -.rankings-fair-row .report-club-button {color:var(--text);} -.rankings-fair-row .report-club-button.current {color:var(--accent);} -body.midnight .rankings-row:hover,body.midnight .rankings-fair-row:hover {background-color:#bad5f20d;} -body.silver .rankings-tab[aria-selected=true] {background-color:#e3d3a878;color:#193b52;} -body.silver .rankings-tab-underline {background-color:#e3d3a878;} -body.silver .rankings-leader {background-color:#fcf9f190;decorator:none;} -body.silver .rankings-leader.first {border-color:#8a7a5570;decorator:linear-gradient(145deg,#a9dccb12,#12233242);} -body.silver .rankings-scorer-list,body.silver .rankings-fair-list {background-color:#6b552a0c;} -body.silver .kind-2 .rankings-leader-value strong,body.silver .kind-3 .rankings-leader-value strong {color:#193b52;} -body.silver .rankings-yellow,body.silver .rankings-fair-row>div:nth-child(2) {color:#805b18;} -body.silver .rankings-red,body.silver .rankings-fair-row>div:nth-child(3) {color:#a23f45;} -body.matchday .rankings-tab[aria-selected=true] {background-color:#d48c7b26;color:#ffe5de;} -body.matchday .rankings-tab-underline {background-color:#d48c7b26;} -body.matchday .rankings-leader {background-color:#1d1e2466;decorator:none;} -body.matchday .rankings-leader.first {border-color:#e5a19770;decorator:linear-gradient(145deg,#a9dccb12,#12233242);} -body.matchday .rankings-scorer-list,body.matchday .rankings-fair-list {background-color:#f8e7e00a;} -body.matchday .kind-2 .rankings-leader-value strong,body.matchday .kind-3 .rankings-leader-value strong {color:#ffe5de;} -body.matchday .rankings-yellow,body.matchday .rankings-fair-row>div:nth-child(2) {color:#e1c68b;} -body.matchday .rankings-red,body.matchday .rankings-fair-row>div:nth-child(3) {color:#f0a6a7;} - -/* Midnight component fallbacks from the current HTML reference. */ -body.midnight .rankings-heading h2 {color:#e3ecf3;} -body.midnight .rankings-heading span {color:#a7becf;} -body.midnight .rankings-heading p {color:#8fa8ba;} -body.midnight .rankings-tab {color:#aebfcd;} -body.midnight .rankings-tab[aria-selected=true] {color:#c7eadf;} -body.midnight .rankings-leader {border-color:#c6dce82b;} -body.midnight .rankings-leader.first {border-color:#a9dccb5e;} -body.midnight .rankings-leader-rank {color:#9eb5c5;} -body.midnight .rankings-leader .rankings-player-button {color:#e0ebf3;} -body.midnight .rankings-leader .rankings-club-button {color:#a6bdce;} -body.midnight .rankings-leader-value strong {color:#e0ecf5;} -body.midnight .kind-2 .rankings-leader-value strong {color:#e0c98b;} -body.midnight .kind-3 .rankings-leader-value strong {color:#e3aaa2;} -body.midnight .rankings-leader-value>span {color:#9fb8c9;} -body.midnight .rankings-scorer-list,body.midnight .rankings-fair-list {border-color:#c5d9e726;} -body.midnight .rankings-fair-row:not(.rankings-head)>div:last-child {color:#b8dbd0;} -.rankings-leader .rankings-club-button.current {color:var(--muted);} -body.midnight .rankings-leader .rankings-club-button.current {color:#a6bdce;} - -body.midnight .rankings-scorer-list .rankings-player-button,body.midnight .rankings-scorer-list .rankings-club-button,body.midnight .rankings-fair-row .report-club-button {color:#d8e0e8;} -body.midnight .rankings-scorer-list .rankings-club-button.current,body.midnight .rankings-fair-row .report-club-button.current {color:#a9dccb;} - -.rankings-scorer-list .rankings-club-button .club-label {gap:14dp;} -body.silver .rankings-fair-list,body.matchday .rankings-fair-list {background-color:var(--panel);} -body.silver .rankings-row.striped,body.silver .rankings-fair-row.striped {background-color:#6b552a0c;} -body.matchday .rankings-row.striped,body.matchday .rankings-fair-row.striped {background-color:#f8e7e00a;} -/* Match the selected footer caption in the open menu, at every UI density. */ -.rankings-footer .report-picker-popup .report-picker-option {font-size:30dp;} +/* Player statistics and fair play are pages of the notebook; their styles are in pages.rcss. */ diff --git a/src/modern/ui/CMakeLists.txt b/src/modern/ui/CMakeLists.txt index cabe645..287bc75 100644 --- a/src/modern/ui/CMakeLists.txt +++ b/src/modern/ui/CMakeLists.txt @@ -45,7 +45,7 @@ endif() set(modern_assets "${CMAKE_BINARY_DIR}/assets/modern") FetchContent_GetProperties(rmlui) file(MAKE_DIRECTORY "${modern_assets}") -foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss indoor.rcss planning.rcss almanac.rcss finance.rcss bank.rcss contracts.rcss amount.rcss environment.rcss advertising.rcss toto.rcss lineup.rcss live.rcss transfer.rcss career_reports.rcss rankings.rcss stadium.rcss statistics.rcss news.rcss news-catalog.json settings.rcss widgets.rcss files.rcss front.rcss entry.rcss opening.rcss select_menu.rcss career.rcss national.rcss postmatch.rcss notebook.rcss) +foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss indoor.rcss planning.rcss almanac.rcss finance.rcss bank.rcss contracts.rcss amount.rcss environment.rcss advertising.rcss toto.rcss lineup.rcss live.rcss transfer.rcss career_reports.rcss rankings.rcss stadium.rcss statistics.rcss news.rcss news-catalog.json settings.rcss widgets.rcss files.rcss front.rcss entry.rcss opening.rcss select_menu.rcss career.rcss national.rcss postmatch.rcss notebook.rcss pages.rcss) configure_file("${CMAKE_SOURCE_DIR}/assets/modern/${asset}" "${modern_assets}/${asset}" COPYONLY) endforeach() diff --git a/src/modern/ui/engine_screens.inc b/src/modern/ui/engine_screens.inc index ae9493c..7215795 100644 --- a/src/modern/ui/engine_screens.inc +++ b/src/modern/ui/engine_screens.inc @@ -229,6 +229,7 @@ void App::engine_render() { if(menu_=="statistics")out+=render_statistics_trophy(); element("canvas")->SetProperty("overflow",statistics_trophy_.contains("asset")?"visible":"hidden"); setting_menu_markup_ = true; + notebook_finish(out); element("canvas")->SetInnerRML(out); ++document_generation_; setting_menu_markup_ = false; sync_window_zoom(); diff --git a/src/modern/ui/indoor_screen.inc b/src/modern/ui/indoor_screen.inc index 7e1c041..32ed88d 100644 --- a/src/modern/ui/indoor_screen.inc +++ b/src/modern/ui/indoor_screen.inc @@ -8,46 +8,27 @@ std::string App::render_indoor() { for (const auto &row : engine_indoor_value_.at("rows")) values.push_back(row); rows = sort_report_rows(std::move(values), sort); } else rows = report_indoor_rows(*world_, state); - std::string body = "
" - "
" - "
" - "
"; - for (const auto &[key, label] : - std::array, 2>{ - {{"rank", "Pl. / Verein"}, {"points", "Punkte"}}}) { - const bool current = sort.at("key") == key; - const bool descending = sort.at("desc").get(); - std::string indicator = ""; - if (!current || !descending) - indicator += ""; - if (!current || descending) - indicator += ""; - indicator += ""; - body += "
" + - btn("report-sort", "" + esc(label) + "" + indicator, - "report-sort", "id=\"report-sort-" + key + "\" data-id=\"" + key + - "\" aria-label=\"Nach " + esc(label) + " sortieren\"") + "
"; + const auto own_id = engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId").get() + : snap().state.at("career").value("role", "club") == "club" ? manager(snap()).value("club", "") : std::string(); + std::string body = "
" + "
"; + for (const auto &[key, label] : std::array, 2>{{{"rank", "Pl. / Verein"}, {"points", "Punkte"}}}) { + const bool current = sort.at("key") == key, descending = sort.at("desc").get(); + body += pg_th(label, key == "rank" ? 0 : 120, key == "rank" ? "" : "r", "report-sort", + "id=\"report-sort-" + key + "\" data-id=\"" + key + "\" aria-label=\"Nach " + esc(label) + " sortieren\"", current ? (descending ? -1 : 1) : 0); } - body += "
"; - for (size_t i = 0; i < rows.size(); ++i) { - const auto &row = rows[i]; - body += "
()) + - "\">
" - "" + - std::to_string(row.at("rank").get()) + "." + - report_club_button(row.at("club").get()) + - "
" - "" + std::to_string(row.at("points").get()) + - "
"; + body += "
"; + for (const auto &row : rows) { + const auto club = row.at("club").get(); + body += "
" + + pg_td("" + std::to_string(row.at("rank").get()) + "" + pg_club(club, 58), 0, "", true) + + pg_td("" + std::to_string(row.at("points").get()) + "", 120, "r") + "
"; } - if (rows.empty()) body += "

Noch kein Hallenturnier gewertet.

"; + if (rows.empty()) body += "
Noch kein Hallenturnier gewertet.
"; const auto footer = engine_mode_ ? engine_indoor_value_.at("footer").get() : "Nach dem 5. Turnier"; - body += "
"; + body += "
"; return body + render_report_detail(); } diff --git a/src/modern/ui/notebook.inc b/src/modern/ui/notebook.inc index 93aa0f0..dd8cdb1 100644 --- a/src/modern/ui/notebook.inc +++ b/src/modern/ui/notebook.inc @@ -144,7 +144,7 @@ std::string App::notebook_shell(const std::function & // the skin's inks (the light skin carries the design's terracotta and sage) const std::string stitch = light ? "#f6a06b" : theme_ == "matchday" ? "#c9584f" : "#7fa3bd", rule = light ? "#e1eecc" : "#ffffff", margin = light ? "#ffc6a5" : theme_ == "matchday" ? "#c9584f" : "#7fa3bd", ring = light ? "#8c491a" : "#ffffff", ribbon_a = light ? "#b2622d" : stitch, ribbon_b = light ? "#d67f48" : stitch; - std::string out = "
" + picture(wood, 3840, stage, true) + "
"; + std::string out = "
" + picture(wood, 3840, stage, true) + "
"; // the leather cover with its seam, the ribbon, the stack of sheets out += "
" + picture(leather, 3281, 2070, true) + "
" + svg("nb-seam", 1440, 902, "", 2400) + "
"; @@ -223,7 +223,8 @@ std::string App::notebook_shell(const std::function & svg("nb-corner", 62, 62, "", 200) + "
"; - out += "
" + esc(notebook_upper(kicker)) + "" + esc(heading) + "
" + head + "
"; + page_title_ = heading; page_hint_.clear(); + out += "
" + esc(notebook_upper(kicker)) + "\x02H\x02\x02T\x02
" + head + "
"; // a paper clip at the top edge, a pencil in its loop at the right edge out += "
" + svg("nb-clip", 30, 72, "", 240) + "
"; out += "
" + svg("nb-pencil", 16, 430, diff --git a/src/modern/ui/pages.inc b/src/modern/ui/pages.inc new file mode 100644 index 0000000..4219287 --- /dev/null +++ b/src/modern/ui/pages.inc @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-3.0-only +// The pages of the notebook: what all of them are built from. A page is 1244 x 720 design +// units (1 unit = 2.25 dp) under the heading of the sheet; its blocks are styled in pages.rcss. + +// The menus that are laid out as a page of the notebook. Every other career menu is still a +// sheet of the old format, shown scaled inside the book. +bool App::page_native() const { + static const std::set native{"tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; + return notebook_page() && native.contains(menu_); +} + +// A length of the page design in dp. +std::string App::pg(double units) { return scalar(units * 2.25) + "dp"; } + +// Inline styles written in design units: every "px" becomes dp. +std::string App::pg_css(std::string_view css) { + std::string out; + for (size_t i = 0; i < css.size();) { + const bool starts = (std::isdigit(static_cast(css[i])) || (css[i] == '.' && i + 1 < css.size() && std::isdigit(static_cast(css[i + 1])))) && + (i == 0 || !(std::isalnum(static_cast(css[i - 1])) || css[i - 1] == '#' || css[i - 1] == '.')); + if (!starts) { out += css[i++]; continue; } + size_t end = i; + while (end < css.size() && (std::isdigit(static_cast(css[end])) || css[end] == '.')) ++end; + if (css.substr(end, 2) == "px") { out += pg(std::stod(std::string(css.substr(i, end - i)))); i = end + 2; } + else { out.append(css.substr(i, end - i)); i = end; } + } + return out; +} + +std::string App::pg_upper(const std::string &text) { return notebook_upper(text); } +std::string App::pg_kicker(const std::string &text, const std::string &css) { + return "" + esc(pg_upper(text)) + ""; +} +std::string App::pg_stat(const std::string &label, const std::string &value, const std::string &sub) { + return "
" + pg_kicker(label) + "" + value + "" + (sub.empty() ? std::string() : "" + sub + "") + "
"; +} +std::string App::pg_bar(double percent, const std::string &kind) { + return "
"; +} +std::string App::pg_dots(int on, int of) { + std::string out = ""; + for (int i = 0; i < of; ++i) out += i < on ? "" : ""; + return out + ""; +} +// The four lines of a team as the page writes them. +std::string App::pg_pos(const std::string &code) { + const std::string key = code == "TW" || code == "T" ? "TW" : code == "ABW" || code == "A" || code == "AB" ? "ABW" : code == "MIT" || code == "M" || code == "MF" ? "MIT" : code == "STU" || code == "S" || code == "ST" ? "STU" : ""; + return "" + esc(key.empty() ? code : key) + ""; +} +// The last matches as marks: S won, U drawn, N lost, anything else not played. +std::string App::pg_form(const std::string &marks) { + std::string out = ""; + for (const char c : marks) out += c == 'S' || c == 'U' || c == 'N' ? std::string("" + c + "" : std::string(""); + return out + ""; +} +std::string App::pg_status(const std::string &text) { return text.empty() ? std::string() : "" + esc(text) + ""; } +std::string App::pg_button(const std::string &action, const std::string &label, const std::string &css, const std::string &attrs) { + return btn(action, label, "pg-btn " + css, attrs); +} +// A cell of a table head (a button when the column sorts) and of a row; a width of 0 takes +// the room that is left. `align` is "", "r" or "c". +std::string App::pg_th(const std::string &label, double width, const std::string &align, const std::string &sort_action, const std::string &attrs, int sorted) { + const std::string css = "pg-th " + align + (width > 0 ? "" : " flex"), style = width > 0 ? " style=\"width:" + pg(width) + ";\"" : ""; + const std::string text = "" + esc(pg_upper(label)) + "" + (sorted ? std::string(" 0 ? "up" : "down") + "\">" : std::string()); + if (sort_action.empty()) return "" + text + ""; + return btn(sort_action, "" + text + "", css, attrs + style); +} +std::string App::pg_td(const std::string &html, double width, const std::string &align, bool cell) { + return "
0 ? "" : " flex") + "\"" + (width > 0 ? " style=\"width:" + pg(width) + ";\"" : "") + ">" + html + "
"; +} +// A dialog: a note on the dimmed book. `actions` are its buttons, right-aligned. +std::string App::pg_dialog(const std::string &title, const std::string &sub, const std::string &body, const std::string &actions, double width, const std::string &attrs) { + return "
" + + (title.empty() ? std::string() : "

" + esc(title) + "

" + (sub.empty() ? std::string() : "" + sub + "") + "
") + body + + (actions.empty() ? std::string() : "
" + actions + "
") + "
"; +} +// A club as a link to its card: crest and name (the name first when `reverse`). +std::string App::pg_club(const std::string &id, double size, bool reverse) { + const auto *c = world_->find("clubs", id); + const auto live = engine_mode_ ? engine_report_team(id) : Json(); + if ((engine_mode_ && live.is_null()) || (!engine_mode_ && !c)) return "—"; + const auto name = esc(engine_mode_ ? live.at("name").get() : world_->name(*c)); + return btn("club-detail", crest(c, size) + "" + name + "", std::string("pg-link") + (reverse ? " reverse" : ""), + "id=\"report-club-" + esc(id) + "\" data-id=\"" + esc(id) + "\""); +} +// The heading of the sheet is written by the book before the page is; the page may have +// changed its title or added a hint since. +void App::notebook_finish(std::string &markup) { + for (const auto &[token, value] : {std::pair{"\x02T\x02", esc(page_title_)}, {"\x02H\x02", page_hint_.empty() ? std::string() : " · " + esc(pg_upper(page_hint_))}}) + for (size_t at = markup.find(token); at != std::string::npos; at = markup.find(token, at)) markup.replace(at, token.size(), value); +} diff --git a/src/modern/ui/rankings_screens.inc b/src/modern/ui/rankings_screens.inc index c05d0a6..9954d5c 100644 --- a/src/modern/ui/rankings_screens.inc +++ b/src/modern/ui/rankings_screens.inc @@ -69,45 +69,52 @@ std::string App::render_scorers() { : (league ? league->value("nation", "") : ""); const auto rows = engine_mode_?engine_rankings_value_.at("categories").at(size_t(kind)):demo_scorer_rows(*world_, league_id, club, scope, kind); const auto key = "scorers:" + league_id + ":" + std::to_string(scope) + ":" + std::to_string(kind); - const auto player_button = [&](const Json &r, bool leader) { + const auto photo = [&](const Json &r, double size) { + return "" + + img(r.at("photo").get(), size, size, true, true, 256) + ""; + }; + const auto player_button = [&](const Json &r, double size) { const auto id = r.at("player").get(); - const double size = leader ? 126 : 88; - const auto image = "" + img(r.at("photo").get(), size, size, true, true, 256) + ""; - return btn("player-detail", image + "" + esc(r.at("name").get()) + "", - "rankings-player-button", "id=\"rankings-player-" + esc(id) + "\" data-id=\"" + esc(id) + + const auto image = size > 100 ? std::string() :"" + + img(r.at("photo").get(), size, size, true, true, 256) + ""; + return btn("player-detail", image + "" + esc(r.at("name").get()) + "", + "pg-link " + std::string(size > 100 ? "large" : "plain"), "id=\"rankings-player-" + esc(id) + "\" data-id=\"" + esc(id) + "\" data-club=\"" + esc(r.at("club").get()) + "\" title=\"" + esc(r.at("name").get()) + "\""); }; - const auto club_button = [&](const Json &r, bool leader) { + const auto club_button = [&](const Json &r, double size) { const auto id = r.at("club").get(); - return btn("club-detail", engine_mode_?""+crest(world_->find("clubs",id),leader?34:42)+""+esc(r.at("club_name").get())+"":label(world_->find("clubs", id), leader ? 34 : 42), "rankings-club-button " + std::string(id == club ? "current" : ""), + const auto name = engine_mode_ ? r.at("club_name").get() : (world_->find("clubs", id) ? world_->name(*world_->find("clubs", id)) : std::string("—")); + return btn("club-detail", crest(world_->find("clubs", id), size) + "" + esc(name) + "", "pg-link plain", "id=\"rankings-club-" + esc(r.at("player").get()) + "\" data-id=\"" + esc(id) + "\""); }; - std::string out = "

" + esc(title) + - "

" + esc(world_->nation_name(nation)) + " · Saison " + esc(engine_mode_?engine_rankings_value_.at("season").get():rankings_season(snapshot.state, *world_)) + - "
"+(engine_mode_?"":"

Spielwerte fiktiv

")+"
" + pg_kicker("Spitzenreiter"); for (size_t i = 0; i < std::min(size_t(3), rows.size()); ++i) { const auto &r = rows[i]; - out += "
" + r.at("rank").dump() + ".
" + player_button(r, true) + club_button(r, true) + "
" + r.at("value").dump() + "" + rankings_categories[size_t(kind)] + "
"; + out += "
" + r.at("rank").dump() + "." + photo(r, i == 0 ? 162 : 135) + "
" + + player_button(r, 200) + club_button(r, 40) + "
" + r.at("value").dump() + "
"; } - out += "
" + rankings_cell_text("Spieler") + "
" + rankings_cell_text("Verein") + "
" + rankings_cell_text(rankings_categories[size_t(kind)]) + "
"; + out += "
" + + pg_th("Spieler", 0) + pg_th("Verein", 250) + pg_th(category, 110, "r") + "
"; for (size_t i = 3; i < rows.size(); ++i) { const auto &r = rows[i]; - out += "
" + r.at("rank").dump() + "." + player_button(r, false) + "
" + club_button(r, false) + "
" + rankings_cell_text(r.at("value").dump()) + "
"; + out += "
() == club ? "me" : "") + "\" role=\"row\" data-rank=\"" + r.at("rank").dump() + "\" data-value=\"" + r.at("value").dump() + "\">" + + pg_td("" + r.at("rank").dump() + "." + player_button(r, 54), 0, "", true) + pg_td(club_button(r, 44), 250, "", true) + + pg_td("" + r.at("value").dump() + "", 110, "r") + "
"; } - if (rows.empty()) out += "
"+rankings_cell_text("Keine Einträge in dieser Kategorie.")+"
"; - out += "
" + render_report_detail(); } @@ -115,12 +122,22 @@ std::string App::render_scorers() { std::string App::render_fairplay() { rankings_remember_scroll(); const auto rows = engine_mode_?engine_fairplay_value_.at("rows"):demo_fairplay_rows(*world_); - std::string out = "

Strafpunkte · weniger ist besser

Gelb · 1 PunktRot · 4 Punkte
" + rankings_cell_text("Pl. / Verein") + "
" + rankings_cell_text("Gelb") + "
" + rankings_cell_text("Rot") + "
" + rankings_cell_text("Punkte") + "
"; - for (size_t i = 0; i < rows.size(); ++i) { - const auto &r = rows[i]; - out += "
" + r.at("rank").dump() + "." + report_club_button(r.at("club").get()) + "
" + rankings_cell_text(r.at("yellow").dump()) + "
" + rankings_cell_text(r.at("red").dump()) + "
" + rankings_cell_text(r.at("points").dump()) + "
"; + const auto own_id = engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId").get() + : snap().state.at("career").value("role", "club") == "club" ? manager(snap()).value("club", "") : std::string(); + int most = 1; + for (const auto &r : rows) most = std::max(most, r.at("points").get()); + std::string out = "

Strafpunkte · weniger ist besser

" + "Gelb · 1 PunktRot · 4 Punkte
" + "
" + + pg_th("Pl. / Verein", 0) + pg_th("", 360) + pg_th("Gelb", 80, "r") + pg_th("Rot", 80, "r") + pg_th("Punkte", 90, "r") + "
"; + const double row_height = rows.size() > 19 ? 1340.0 / rows.size() : 70; + for (const auto &r : rows) { + const auto club = r.at("club").get(); + out += "
" + + pg_td("" + r.at("rank").dump() + "" + pg_club(club), 0, "", true) + pg_td(pg_bar(r.at("points").get() * 100.0 / most, "soft"), 360, "", true) + + pg_td(r.at("yellow").dump(), 80, "r") + pg_td(r.at("red").dump(), 80, "r") + pg_td("" + r.at("points").dump() + "", 90, "r") + "
"; } - if (rows.empty()) out += "

" + rankings_cell_text("Keine Vereine in der deutschen Ligavorschau.") + "

"; + if (rows.empty()) out += "
Keine Vereine in dieser Wertung.
"; rankings_view_["restore_scroll"] = true; - return out + "
" + render_report_detail(); + return out + "
" + render_report_detail(); } diff --git a/src/modern/ui/report_pickers.inc b/src/modern/ui/report_pickers.inc index 1e06227..c884803 100644 --- a/src/modern/ui/report_pickers.inc +++ b/src/modern/ui/report_pickers.inc @@ -134,10 +134,13 @@ std::string App::report_picker(const std::string &kind, double left, : kind == "stat-category" ? "Wettbewerbsgruppe" : kind == "winner-country" ? "Land" : kind == "stat-country" ? "Statistikbereich" : "Wettbewerb"; + // on a notebook page (left < 0) the picker is an item of the page's foot with its name in front + const bool flow = left < 0; std::string out = - "
" + - btn("report-picker", "" + esc(caption) + + "
" + + btn("report-picker", (flow ? "" + esc(pg_upper(kind == "year" ? "Jahr" : menu_label)) + "" : std::string()) + + "" + esc(flow && kind == "year" ? std::to_string(almanac_year_) : caption) + "" "", "report-picker-trigger", diff --git a/src/modern/ui/reports_screens.inc b/src/modern/ui/reports_screens.inc index 28d0e1a..a672321 100644 --- a/src/modern/ui/reports_screens.inc +++ b/src/modern/ui/reports_screens.inc @@ -56,21 +56,14 @@ std::string App::render_reports(const std::string &mode) { {"points", "Punkte"}, {"gf", "Tore"}, {"diff", "Diff."}}; const bool real_other=engine_mode_&&mode=="other"; const auto &fixture=real_other?engine_other_value_:engine_fixtures_value_; - std::vector widths; - if (matches) - widths = real_other?std::vector{1184,240,1184}:std::vector{1224,160,1224}; // Match card has two 2dp borders. - else if (strengths) { - widths.push_back(2612 * .38); - for (int i = 0; i < 5; ++i) widths.push_back(2612 * .62 / 5); - } else { - for (int i = 0; i < 9; ++i) - widths.push_back(i == 0 ? 2612 * .32 : i == 5 ? 2612 * .14 : 2612 * .54 / 7); - } - const double heading_height = matches ? 80 : strengths ? (rows.size() >= 20 ? 64 : 66) - : rows.size() >= 20 ? 64 : 80; - const double row_height = matches ? 118 : strengths ? (rows.size() >= 20 ? 64 : 66) - : rows.size() >= 16 ? (1682 - heading_height) / rows.size() : 80; - std::string body = "
"; + const auto own_id = engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId").get() + : snap().state.at("career").value("role", "club") == "club" ? manager(snap()).value("club", "") : std::string(); + // a place the season decides tints its row: Europe, promotion, relegation + const auto zone_of = [&](const Json &row) -> std::string { + const auto zone = engine_mode_ ? row.value("zone", std::string()) : report_zone(row.value("rank", 0), int(rows.size()), tier); + return zone == "europe" || zone == "champions" || zone == "europa" || zone == "conference" ? "eu" : zone == "promotion" || zone == "playoff" ? "auf" : zone == "relegation" ? "ab" : ""; + }; + std::string body = "
"; if (matches) { const int round = engine_mode_?fixture.at("round").get()-1:std::clamp(state.value("round", 0), 0, report_round_count(*world_, state, mode == "other") - 1); @@ -84,142 +77,96 @@ std::string App::render_reports(const std::string &mode) { const auto choices = report_picker_items("competition"); subtitle = choices.at(size_t(state.value("competition", 0))).second; } - body += "

" + + const double mid = real_other ? 190 : 120; + body += "

" + (real_other?fixture.at("heading").get():opening ? std::string("1. Runde") : std::to_string(round + 1) + ". Spieltag") + - "

" + esc(subtitle) + "

"; - } - body += "
"; - for (size_t column = 0; column < headings.size(); ++column) { - const auto &[key, label] = headings[column]; - const auto sorting = matches ? Json::object() : state.at("sorts").at(mode); - const bool current = !matches && sorting.value("key", "") == key; - const bool descending = sorting.value("desc", false); - body += "
"; - if (matches) - body += "" + esc(label) + ""; - else { - std::string indicator = ""; - if (!current || !descending) - indicator += ""; - if (!current || descending) - indicator += ""; - indicator += ""; - body += btn("report-sort", "" + esc(label) + "" + indicator, - "report-sort", "id=\"report-sort-" + key + "\" data-id=\"" + key + - "\" aria-label=\"Nach " + esc(label) + " sortieren\""); + "

" + esc(subtitle) + "
" + "
" + pg_kicker("Heim", "text-align:right;") + "ERGEBNIS" + pg_kicker("Auswärts") + "
" + "
"; + for (const auto &row : rows) { + const auto home = row.at("home").get(), away = row.at("away").get(); + std::string value = row.at("home_goals").is_null() || row.at("away_goals").is_null() + ? std::string() : report_number(row["home_goals"]) + " : " + report_number(row["away_goals"]); + std::string middle, detail; + if (real_other) { + const auto phase = [](const Json &v) { return v == 1 ? std::string(" n.V.") : v == 2 ? std::string(" n.E.") : std::string(); }; + if (!value.empty()) value += phase(row.at("phase")); + if (row.at("secondLegVisible").get()) { + detail = "Hin: " + (row.at("secondLeg").is_null() ? std::string("–") : report_number(row.at("secondLeg")[0]) + ":" + report_number(row.at("secondLeg")[1]) + phase(row.at("secondLegPhase"))); + if (!value.empty()) value = "Rück: " + value; + } else if (row.at("status") == "scheduled" && row.at("date").is_string()) detail = row.at("date").get(); + } + const bool moved = engine_mode_ && (row.value("status", "") == "rescheduled" || row.value("status", "") == "postponed"); + if (!value.empty()) middle = "" + esc(value) + "" + (detail.empty() ? "" : "" + esc(detail) + ""); + else if (moved) middle = "verlegt"; + else if (!detail.empty()) middle = "" + esc(detail) + ""; + else middle = "–"; + body += "
" + pg_club(home, 50, true) + + "
" + middle + "
" + pg_club(away) + "
"; } - body += "
"; - } - body += "
"; - for (size_t i = 0; i < rows.size(); ++i) { - const auto &row = rows[i]; - // the manager's own club stands out: a bar in its colour down the left edge - const std::string row_club = row.value("club", ""); - const bool own_row = !matches && !row_club.empty() && - (engine_mode_ ? engine_data_.at("desktop").at("meta").at("scope").at("teamId") == row_club - : snap().state.at("career").value("role", "club") == "club" && manager(snap()).value("club", "") == row_club); - std::string own_colour; - if (own_row) - if (const auto *club = world_->find("clubs", row_club); club && !club->value("crest", "").empty()) own_colour = renderer_.crest_colour(club->value("crest", "")); - // a place the season decides tints its whole row - const std::string row_zone = matches || strengths ? std::string() - : engine_mode_ ? row.value("zone", std::string()) : report_zone(row.value("rank", 0), int(rows.size()), tier); - body += "
"; + if (real_other && rows.empty()) + body += "
" + std::string(!fixture.at("available").get() ? "Diese Runde ist noch nicht ausgelost oder die vorherige Phase ist noch nicht abgeschlossen." : "Keine Paarungen vorhanden.") + "
"; + body += "
"; + } else { + // the widths of the columns in design units; the first takes the room that is left + const std::vector widths = strengths ? std::vector{0, 150, 150, 150, 150, 110} : std::vector{0, 52, 52, 52, 52, 190, 80, 80, 70}; + const auto sorting = state.at("sorts").at(mode); + const double row_height = rows.size() > 20 ? 1420.0 / rows.size() : 70; + body += "
"; for (size_t column = 0; column < headings.size(); ++column) { - body += "
"; - if (matches && column != 1) - body += report_club_button(row.at(column == 0 ? "home" : "away").get(), column == 0); - else if (!matches && column == 0) { - if (!strengths) { - const auto zone = engine_mode_?row.value("zone", std::string()):report_zone(row.value("rank", 0), int(rows.size()), tier); - body += "" + - std::to_string(row.value("rank", 0)) + "."; - } - body += report_club_button(row.at("club").get()); - } else { - std::string value; - if (matches) - value = row.at("home_goals").is_null() || row.at("away_goals").is_null() - ? (engine_mode_&&(row.value("status","")=="rescheduled"||row.value("status","")=="postponed")?"verlegt":"–") : report_number(row["home_goals"]) + " : " + report_number(row["away_goals"]); - else if (!strengths && column == 5) - value = row.value("form_text", ""); - else if (!strengths && column == 7) - value = report_number(row["gf"]) + ":" + report_number(row["ga"]); - else - value = report_number(row.at(headings[column].first)); - if(real_other&&matches) { - const auto phase=[](const Json &v){return v==1?std::string(" n.V."):v==2?std::string(" n.E."):std::string();}; - value+=phase(row.at("phase")); - std::string detail; - if(row.at("secondLegVisible").get()) { - detail="Hin: "+(row.at("secondLeg").is_null()?std::string("–"):report_number(row.at("secondLeg")[0])+":"+report_number(row.at("secondLeg")[1])+phase(row.at("secondLegPhase"))); - value="Rück: "+value; - } else if(row.at("status")=="scheduled"&&row.at("date").is_string())detail=row.at("date").get(); - body+="
"+esc(value)+""+(detail.empty()?"":""+esc(detail)+"")+"
"; - } else if (!matches && !strengths && column == 5) { - // the last matches as marks: won, drawn, lost, not played - body += ""; - for (const char c : value) - body += std::string(""; - body += ""; - } else body += "" + esc(value) + ""; + const auto &[key, label] = headings[column]; + const bool current = sorting.value("key", "") == key, descending = sorting.value("desc", false); + body += pg_th(label, widths[column], column == 0 ? "" : !strengths && column == 5 ? "" : "r", "report-sort", + "id=\"report-sort-" + key + "\" data-id=\"" + key + "\" aria-label=\"Nach " + esc(label) + " sortieren\"", current ? (descending ? -1 : 1) : 0); + } + body += "
"; + for (const auto &row : rows) { + const auto club = row.value("club", std::string()); + const auto zone = strengths ? std::string() : zone_of(row); + body += "
"; + for (size_t column = 0; column < headings.size(); ++column) { + const auto &key = headings[column].first; + if (column == 0) + body += pg_td((strengths ? std::string() : "" + std::to_string(row.value("rank", 0)) + "") + pg_club(club), 0, "", true); + else if (strengths && column < 5) { + const auto value = row.at(key).is_number_integer() ? row.at(key).get() : 0; + body += pg_td("" + pg_bar((value - 50) / 40.0 * 100) + "" + report_number(row.at(key)) + "", widths[column], "r", true); + } else if (strengths) + body += pg_td("" + report_number(row.at(key)) + "", widths[column], "r"); + else if (column == 5) + body += pg_td(pg_form(row.value("form_text", "")), widths[column], "", true); + else if (column == 6) + body += pg_td("" + report_number(row.at(key)) + "", widths[column], "r"); + else if (column == 7) + body += pg_td(report_number(row["gf"]) + ":" + report_number(row["ga"]), widths[column], "r"); + else if (column == 8) { + const auto diff = row.at(key).is_number_integer() ? row.at(key).get() : 0; + body += pg_td((diff > 0 ? "+" : "") + report_number(row.at(key)), widths[column], "r"); + } else + body += pg_td(report_number(row.at(key)), widths[column], "r"); } body += "
"; } - body += "
"; + body += "
"; } - body += "
"; - if(real_other&&rows.empty())body+="

"+std::string(!fixture.at("available").get()?"Diese Runde ist noch nicht ausgelost oder die vorherige Phase ist noch nicht abgeschlossen.":"Keine Paarungen vorhanden.")+"

"; - body+="
"; - if (!matches && !strengths && engine_mode_) { - // only the zones this league has - std::string items; - for (const auto &[kind, label] : std::array, 3>{{{"europe", "Europapokal"}, {"promotion", "Aufstieg"}, {"relegation", "Abstieg"}}}) - if (std::any_of(rows.begin(), rows.end(), [&](const Json &row) { return row.value("zone", "") == kind; })) - items += "" + label + ""; - if (!items.empty()) body += "
" + items + "
"; - } - if (!matches && !strengths && !engine_mode_) { - const auto legend = tier == 1 - ? std::vector>{ - {"champions", "Champions League"}, {"europa", "Europa League"}, - {"conference", "Conference League"}, {"relegation", "Abstieg"}} - : tier == 4 ? std::vector>{ - {"promotion", "Aufstieg"}, {"relegation", "Abstieg"}} - : std::vector>{ - {"promotion", "Aufstieg"}, {"playoff", "Relegation"}, {"relegation", "Abstieg"}}; - body += "
"; - for (const auto &[kind, label] : legend) - body += "" + esc(label) + ""; - body += "
"; - } - body += "
" + render_report_detail(); } diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 4ae2632..4e8d43b 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -685,7 +685,7 @@ class App final : public Rml::EventListener { // on a page of the notebook the sheet has no frame of its own and lies where the book lies const bool page = notebook_page(); if (page) club_mark.clear(); - return (page ? "
" + return (page ? "
" : "
") + (close ? btn("close", "×", "close", "id=\"window-close\" aria-label=\"" + std::string(menu_ == "bank" && bank_view_ != "entrance" ? "Zurück zur Bankhalle" : "Fenster schließen") + "\"") : "") + @@ -874,6 +874,26 @@ class App final : public Rml::EventListener { std::string notebook_home(const Json &model); Json notebook_news(); static Json notebook_lamps(Json lamps); + // the building blocks of a notebook page (pages.inc) + bool page_native() const; + static std::string pg(double units); + static std::string pg_css(std::string_view css); + static std::string pg_upper(const std::string &text); + static std::string pg_kicker(const std::string &text, const std::string &css = {}); + static std::string pg_stat(const std::string &label, const std::string &value, const std::string &sub = {}); + static std::string pg_bar(double percent, const std::string &kind = {}); + static std::string pg_dots(int on, int of); + static std::string pg_pos(const std::string &code); + static std::string pg_form(const std::string &marks); + static std::string pg_status(const std::string &text); + static std::string pg_button(const std::string &action, const std::string &label, const std::string &css = {}, const std::string &attrs = {}); + static std::string pg_th(const std::string &label, double width, const std::string &align = {}, const std::string &sort_action = {}, const std::string &attrs = {}, int sorted = 0); + static std::string pg_td(const std::string &html, double width, const std::string &align = {}, bool cell = false); + static std::string pg_dialog(const std::string &title, const std::string &sub, const std::string &body, const std::string &actions, double width, const std::string &attrs = {}); + std::string pg_club(const std::string &id, double size = 50, bool reverse = false); + void notebook_finish(std::string &markup); + // what the page says in the heading of the sheet instead of its plain name, and after it + std::string page_title_, page_hint_; // a career menu is a page of the notebook, not a window of its own bool notebook_page() const { return (scene_ == "desktop" || scene_ == "engine") && !menu_.empty(); } bool calendar_month_action(const std::string &, Rml::Element *); @@ -1171,6 +1191,7 @@ class App final : public Rml::EventListener { if (!menu_.empty()) markup += render_menu(menu_); setting_menu_markup_ = true; + notebook_finish(markup); element("canvas")->SetInnerRML(markup); ++document_generation_; sync_window_zoom(); @@ -1752,6 +1773,7 @@ public: #include "modern/ui/calendar_year.inc" #include "modern/ui/notebook.inc" #include "modern/ui/notebook_home.inc" +#include "modern/ui/pages.inc" #include "modern/ui/finance_simulation.inc" #include "modern/ui/statistics_analysis.inc" #include "modern/ui/engine_rankings.inc"