A number pad with soft keys and a column of function keys; no coloured left edges
The entry of a number shows its value in a display with the allowed range, proposals as chips, the digits as soft keys and backspace, clear and maximum as a coloured column. The first digit key replaces the offered value. Marked rows and the bank's readings no longer carry a coloured bar at their left edge. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
b3e5ef4b4d
commit
fe4b034181
7 files changed
+64
-57
No files matched your search
+36
-49
@@ -1,62 +1,49 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
.amount-layer {position:absolute;left:0;right:0;top:0;bottom:0;z-index:150;display:flex;align-items:center;justify-content:center;background-color:#0a131d66;}
|
||||
.amount-box {position:relative;flex-shrink:0;width:820dp;height:1154dp;padding:26dp;border:2dp var(--border);border-radius:30dp;background-color:var(--strong);color:var(--text);}
|
||||
.amount-button {display:flex;align-items:center;justify-content:center;padding:0;border:1dp var(--border);border-radius:14dp;background-color:#53616d;font-size:46dp;font-weight:normal;line-height:1.1;color:var(--text);}
|
||||
.amount-button:hover {filter:brightness(1.16);}
|
||||
.amount-button:active {filter:brightness(.88);}
|
||||
/* The entry of a number: a display, proposals, a pad of soft keys and a column of function keys. */
|
||||
body {--key-top:#5d6a76;--key-bottom:#49555f;--key-edge:#27313a;--pad-display:#141d26b8;--function-top:#f0a052;--function-bottom:#d8721e;--function-edge:#9c4d0d;}
|
||||
body.silver {--key-top:#ffffff;--key-bottom:#e6e3da;--key-edge:#b7b1a2;--pad-display:#e9e5da;}
|
||||
body.matchday {--key-top:#5a555e;--key-bottom:#454148;--key-edge:#242127;--pad-display:#17161ab8;}
|
||||
.amount-layer {position:absolute;left:0;right:0;top:0;bottom:0;z-index:150;display:flex;align-items:center;justify-content:center;background-color:#0a131d80;}
|
||||
.amount-box {position:relative;flex-shrink:0;width:900dp;height:1186dp;padding:26dp;border:2dp var(--paper-edge);border-radius:40dp;background-color:transparent;decorator:linear-gradient(175deg,var(--paper-top),var(--paper-bottom));color:var(--text);}
|
||||
.amount-button {display:flex;align-items:center;justify-content:center;padding:0;border:2dp var(--key-edge);border-bottom-width:6dp;border-radius:26dp;background-color:transparent;decorator:linear-gradient(180deg,var(--key-top),var(--key-bottom));font-size:50dp;font-weight:normal;line-height:1.1;color:var(--text);}
|
||||
.amount-button:hover {filter:brightness(1.08);}
|
||||
.amount-button:active {filter:brightness(.9);border-bottom-width:2dp;}
|
||||
.amount-button[disabled] {opacity:.4;}
|
||||
.amount-button:focus-visible {border-color:var(--accent);}
|
||||
.amount-header {position:absolute;left:26dp;top:26dp;width:764dp;height:58dp;}
|
||||
.amount-header h2 {position:absolute;left:62dp;top:10.8dp;width:640dp;height:36.4dp;line-height:36.4dp;margin:0;font-size:28dp;font-weight:normal;text-align:center;}
|
||||
.amount-header .amount-close {position:absolute;left:0;top:7dp;width:44dp;height:44dp;border-radius:22dp;background-color:#fa6a60;border-color:#ffb0a34d;color:#572c29;font-size:34dp;}
|
||||
.amount-label {position:absolute;left:26dp;top:104dp;width:764dp;height:28dp;line-height:28dp;text-align:right;font-size:28dp;color:var(--muted);}
|
||||
#calculator-value {position:absolute;left:26dp;top:132dp;width:764dp;height:112dp;padding:6dp 8dp;border:0dp;border-radius:10dp;background-color:transparent;color:var(--text);font-size:82dp;font-weight:normal;line-height:98.4dp;text-align:right;letter-spacing:-2dp;}
|
||||
.amount-context {position:absolute;left:26dp;top:256dp;width:764dp;height:58dp;}
|
||||
.amount-limit {position:absolute;left:0;top:0;width:595.984dp;height:58dp;display:flex;align-items:center;font-size:28dp;color:var(--muted);}
|
||||
.amount-limit span {display:block;line-height:28dp;}
|
||||
.amount-context .amount-button {position:absolute;top:5dp;height:48dp;font-size:28dp;border-radius:10dp;background-color:#384957;}
|
||||
.amount-clear {left:607.984dp;width:66dp;}
|
||||
.amount-max {left:685.984dp;width:78.016dp;}
|
||||
.amount-proposal,.amount-key {position:absolute;}
|
||||
.amount-proposal {font-size:31dp;background-color:#40596b;}
|
||||
.amount-proposal.selected {background-color:var(--selected);color:var(--accent);}
|
||||
.amount-feedback {position:absolute;left:26dp;top:964dp;width:764dp;height:70dp;display:flex;align-items:center;justify-content:center;margin:0;font-size:28dp;line-height:32.4dp;text-align:center;color:var(--muted);}
|
||||
.amount-header {position:absolute;left:26dp;top:26dp;width:848dp;height:58dp;}
|
||||
.amount-header h2 {position:absolute;left:62dp;top:6dp;width:724dp;height:46dp;line-height:46dp;margin:0;font-family:Display;font-size:38dp;font-weight:normal;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
||||
.amount-header .amount-close {position:absolute;left:0;top:7dp;width:44dp;height:44dp;border:1dp #ffb0a34d;border-radius:22dp;decorator:none;background-color:#fa6a60;color:#572c29;font-size:34dp;}
|
||||
.amount-display {position:absolute;left:26dp;top:100dp;width:848dp;height:200dp;border:2dp var(--rule);border-radius:24dp;background-color:var(--pad-display);}
|
||||
.amount-label {position:absolute;left:54dp;top:114dp;width:792dp;height:30dp;line-height:30dp;text-align:right;font-size:28dp;color:var(--muted);}
|
||||
#calculator-value {position:absolute;left:46dp;top:144dp;width:808dp;height:104dp;padding:0 8dp;border:0dp;border-radius:10dp;background-color:transparent;color:var(--text);font-family:Display;font-size:88dp;font-weight:normal;line-height:104dp;text-align:right;}
|
||||
.amount-context {position:absolute;left:54dp;top:252dp;width:792dp;height:36dp;}
|
||||
.amount-limit {position:absolute;left:0;top:0;width:792dp;height:36dp;display:flex;align-items:center;justify-content:flex-end;font-size:28dp;color:var(--muted);}
|
||||
.amount-limit span {display:block;line-height:30dp;}
|
||||
.amount-proposals-label {position:absolute;left:30dp;top:314dp;width:400dp;height:34dp;margin:0;line-height:34dp;font-size:26dp;letter-spacing:2dp;color:var(--muted);}
|
||||
.amount-proposal,.amount-key,.amount-function {position:absolute;}
|
||||
.amount-proposal {font-size:32dp;border-width:2dp;border-bottom-width:2dp;border-color:var(--rule);border-radius:32dp;decorator:none;background-color:transparent;}
|
||||
.amount-proposal:hover {background-color:var(--hover);}
|
||||
.amount-proposal.selected {background-color:var(--function-bottom);border-color:var(--function-edge);color:#ffffff;}
|
||||
.amount-function {border-color:var(--function-edge);decorator:linear-gradient(180deg,var(--function-top),var(--function-bottom));color:#ffffff;}
|
||||
.amount-function.amount-max {font-size:38dp;letter-spacing:2dp;}
|
||||
.amount-function.amount-erase {font-size:56dp;}
|
||||
.amount-feedback {position:absolute;left:26dp;top:1014dp;width:848dp;height:56dp;display:flex;align-items:center;justify-content:center;margin:0;font-size:28dp;line-height:32.4dp;text-align:center;color:var(--muted);}
|
||||
.amount-feedback span {display:block;width:100%;line-height:32.4dp;}
|
||||
.amount-feedback.invalid {color:#e7c7a7;}
|
||||
.amount-actions {position:absolute;left:26dp;top:1050dp;width:764dp;height:74dp;display:flex;gap:14dp;}
|
||||
.amount-actions .amount-button {height:74dp;width:326.078dp;font-size:28dp;background-color:#3b4b59;}
|
||||
.amount-actions .amount-button.amount-accept {width:423.922dp;background-color:var(--accent);color:var(--on-accent);}
|
||||
.amount-feedback.invalid {color:var(--loss);}
|
||||
.amount-actions {position:absolute;left:26dp;top:1080dp;width:848dp;height:80dp;display:flex;gap:16dp;}
|
||||
.amount-actions .amount-button {height:80dp;width:308dp;font-size:32dp;border-radius:22dp;}
|
||||
.amount-actions .amount-button.amount-accept {width:524dp;border-color:var(--function-edge);decorator:linear-gradient(180deg,var(--function-top),var(--function-bottom));color:#ffffff;}
|
||||
.amount-box.amount-review {height:auto;min-height:620dp;padding:70dp;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:42dp;text-align:center;}
|
||||
.amount-review h2 {display:block;width:100%;margin:0;line-height:50dp;font-size:44dp;font-weight:bold;}
|
||||
.amount-review h2 {display:block;width:100%;margin:0;line-height:56dp;font-family:Display;font-size:48dp;font-weight:bold;}
|
||||
.amount-review>p {display:block;width:100%;margin:0;line-height:51dp;font-size:34dp;color:var(--text);}
|
||||
.amount-review>strong {display:block;width:100%;font-size:74dp;line-height:85dp;font-weight:normal;color:var(--accent);}
|
||||
.amount-review-actions {display:flex;align-items:center;justify-content:center;flex-shrink:0;gap:24dp;width:697.188dp;height:87.188dp;margin-top:28dp;}
|
||||
.amount-review-actions .amount-button {height:87.188dp;width:234.781dp;padding:24dp 38dp;border:2dp var(--border);border-radius:16dp;background-color:var(--soft);font-size:32dp;line-height:35.2dp;flex-shrink:0;}
|
||||
.amount-review-actions #calculator-back {width:183.188dp;}
|
||||
.amount-review-actions #calculator-confirm {width:231.219dp;background-color:var(--selected);border-color:var(--accent);}
|
||||
.amount-review>strong {display:block;width:100%;font-family:Display;font-size:80dp;line-height:92dp;font-weight:normal;color:var(--accent);}
|
||||
.amount-review-actions {display:flex;align-items:center;justify-content:center;flex-shrink:0;gap:20dp;width:760dp;height:88dp;margin-top:28dp;}
|
||||
.amount-review-actions .amount-button {height:88dp;width:230dp;font-size:32dp;line-height:35.2dp;border-radius:22dp;flex-shrink:0;}
|
||||
.amount-review-actions #calculator-confirm {width:260dp;border-color:var(--function-edge);decorator:linear-gradient(180deg,var(--function-top),var(--function-bottom));color:#ffffff;}
|
||||
.amount-review .amount-review-error {color:var(--danger);font-size:28dp;line-height:35dp;}
|
||||
body.midnight .amount-box {background-color:#293846fa;border-color:#dce8f13d;color:#eef2f6;}
|
||||
body.midnight .amount-review>strong {color:#c4e9dd;}
|
||||
body.midnight .amount-review>p {color:#b5cad9;}
|
||||
body.silver .amount-button {background-color:#d8e2eb;}
|
||||
body.matchday .amount-button {background-color:#514b50;}
|
||||
body.silver .amount-context .amount-button,body.matchday .amount-context .amount-button {background-color:var(--soft);}
|
||||
body.silver .amount-proposal,body.matchday .amount-proposal {background-color:var(--panel);}
|
||||
body.midnight .amount-box {background-color:transparent;decorator:linear-gradient(155deg,#364350f5,#1f2b37fa);}
|
||||
body.silver .amount-box {background-color:#eaf1f7fc;}
|
||||
body.matchday .amount-box {background-color:#2c2c32fc;}
|
||||
body.silver .amount-proposal.selected,body.matchday .amount-proposal.selected {background-color:var(--selected);color:var(--accent);}
|
||||
#calculator-value selection {color:#ffffff;background-color:#144bc1;}
|
||||
#calculator-value:focus {box-shadow:0dp 0dp 0dp 2dp #b2d7f23b;}
|
||||
body.midnight .amount-actions .amount-accept {background-color:#719dab;color:#10252d;}
|
||||
body.midnight .amount-review-actions #calculator-confirm {background-color:#96cdb536;border-color:#a5dfca73;}
|
||||
body.silver .amount-button {background-color:transparent;decorator:linear-gradient(180deg,#ffffffb0,#bfd0e259);}
|
||||
body.matchday .amount-button {background-color:transparent;decorator:linear-gradient(180deg,#e8d6dc12,#a1a0aa0d);}
|
||||
body.silver .amount-button.selected,body.matchday .amount-button.selected,
|
||||
body.silver .amount-button.amount-accept,body.matchday .amount-button.amount-accept,
|
||||
body.silver .amount-review #calculator-confirm,body.matchday .amount-review #calculator-confirm {decorator:none;}
|
||||
body.silver .amount-header .amount-close,body.matchday .amount-header .amount-close {decorator:none;background-color:#fa6a60;border-color:#ffb0a34d;color:#572c29;}
|
||||
body.silver .amount-context .amount-button,body.matchday .amount-context .amount-button {background-color:transparent;}
|
||||
|
||||
/* Confirmation amounts carry money semantics, independent of the skin accent. */
|
||||
body.matchday .amount-review>strong {color:var(--money);}
|
||||
@@ -99,7 +99,7 @@ body.silver {--bank-gold:#9a7a3a;--bank-panel:#ffffff8c;}
|
||||
.bank-tabs .bank-tab {height:72dp;padding:0 34dp;border:2dp var(--rule);border-radius:36dp;background-color:transparent;decorator:none;font-size:32dp;color:var(--text);}
|
||||
.bank-tabs .bank-tab:hover {background-color:var(--hover);}
|
||||
.bank-tabs .bank-tab.selected {border-color:var(--bank-gold);background-color:var(--bank-gold);color:#1d232a;}
|
||||
.bank-insight {border-left:8dp var(--bank-gold);padding:14dp 30dp;background-color:var(--bank-panel);}
|
||||
.bank-insight {border:2dp var(--rule);border-radius:8dp;padding:16dp 30dp;background-color:var(--bank-panel);}
|
||||
.bank-insight h4 {display:block;margin:0 0 6dp 0;font-family:Display;font-size:34dp;line-height:44dp;font-weight:bold;color:var(--bank-gold);}
|
||||
.bank-insight p {margin:0;font-size:32dp;line-height:46dp;}
|
||||
.bank-part-track {height:14dp;border-radius:7dp;background-color:var(--rule);overflow:hidden;}
|
||||
|
||||
@@ -125,3 +125,4 @@ body.matchday .lineup-taker selectbox {background-color:#303037fc;}
|
||||
.lineup-engine-controls h2 {height:39dp;margin:0 0 12dp;font-size:34dp;font-weight:normal;}
|
||||
.lineup-engine-instruction {font-size:28dp;line-height:1.3;margin:0 0 10dp;}
|
||||
.lineup-engine-hint {font-size:28dp;line-height:1.4;margin:0 0 10dp;color:var(--muted);}
|
||||
.lineup-row {border-left-width:0dp;}
|
||||
@@ -240,3 +240,5 @@ body.calm .live-moment.fresh {animation:none;}
|
||||
.live-bottom-note {text-align:right;}
|
||||
.live-dialog-layer {border-radius:10dp;}
|
||||
.live-dialog {width:1900dp;border-radius:12dp;}
|
||||
.live-event {border-left-width:0dp;}
|
||||
.live-table-row.own {border-left-width:0dp;}
|
||||
@@ -100,3 +100,4 @@ body.matchday .report-reset,body.matchday .report-round {decorator:linear-gradie
|
||||
/* Cup legs share one fixed score column; scores retain the displayed sides. */
|
||||
.report-score-lines {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4dp;font-size:30dp;}
|
||||
.report-score-note {display:block;font-size:28dp;white-space:nowrap;}
|
||||
.report-row {border-left-width:0dp;}
|
||||
@@ -27,6 +27,7 @@ void App::open_amount(AmountRequest request) {
|
||||
request.return_focus = context_->GetFocusElement()->GetId();
|
||||
amount_ = AmountDraft{std::move(request), {}, {}, menu_, false, input_revision(), world_};
|
||||
amount_->raw = std::to_string(amount_->request.value);
|
||||
amount_untouched_ = true;
|
||||
amount_select_all_ = true;
|
||||
amount_caret_end_ = false;
|
||||
focus_after_render_ = "calculator-value";
|
||||
@@ -95,12 +96,16 @@ std::string App::render_amount() {
|
||||
}
|
||||
out += "<section class=\"amount-box\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"calculator-title\">"
|
||||
"<header class=\"amount-header\">" + button("calc-cancel", "×", "amount-close", "id=\"calculator-close\" aria-label=\"Zahleneingabe schließen\"") +
|
||||
"<h2 id=\"calculator-title\">" + esc(r.title) + "</h2></header><label class=\"amount-label\">" +
|
||||
"<h2 id=\"calculator-title\">" + esc(r.title) + "</h2></header><div class=\"amount-display\"></div><label class=\"amount-label\">" +
|
||||
esc(r.unit == "Stück" ? "Stückzahl" : r.unit.empty() ? "Wert" : r.unit == "€" ? "Betrag in Euro" : "Betrag in " + r.unit) +
|
||||
"</label><input type=\"text\" id=\"calculator-value\" maxlength=\"8\" value=\"" + esc(amount_->raw) +
|
||||
"\" aria-label=\"" + esc(r.title) + "\"/><div class=\"amount-context\"><span class=\"amount-limit\"><span>" +
|
||||
esc(number(r.min) + " – " + number(r.max) + (r.unit.empty() ? "" : " " + r.unit)) + "</span></span>" +
|
||||
button("calc-clear", "C", "amount-clear", "id=\"calculator-clear\"") + button("calc-max", "MAX", "amount-max", "id=\"calculator-max\"") + "</div>";
|
||||
esc("Möglich: " + number(r.min) + " – " + number(r.max) + (r.unit.empty() ? "" : " " + r.unit)) + "</span></span></div>"
|
||||
"<p class=\"amount-proposals-label\">Vorschläge</p>";
|
||||
// a pad of digits; beside it the three keys that act on the whole number
|
||||
const double pad_top = 518, key_width = 200, key_height = 110, key_gap = 16;
|
||||
out += button("calc-clear", "C", "amount-function amount-clear", "id=\"calculator-clear\" aria-label=\"Eingabe löschen\" style=\"" + rect(26 + 3 * (key_width + key_gap), pad_top + 162, key_width, 152) + "\"") +
|
||||
button("calc-max", "MAX", "amount-function amount-max", "id=\"calculator-max\" aria-label=\"Höchstwert einsetzen\" style=\"" + rect(26 + 3 * (key_width + key_gap), pad_top + 324, key_width, 164) + "\"");
|
||||
const int64_t first = std::max<int64_t>(1, (r.min + r.suggestion_step - 1) / r.suggestion_step);
|
||||
const auto value = amount_value();
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
@@ -108,12 +113,18 @@ std::string App::render_amount() {
|
||||
const bool enabled = proposal >= r.min && proposal <= r.max && (proposal - r.min) % r.step == 0;
|
||||
out += button("calc-preset", number(proposal), "amount-proposal" + std::string(value && *value == proposal ? " selected" : ""),
|
||||
"id=\"calculator-preset-" + std::to_string(i) + "\" data-value=\"" + std::to_string(proposal) + "\" style=\"" +
|
||||
rect(26 + (i % 2) * 388, 334 + (i / 2) * 74, 376, 64) + "\" " + (enabled ? "" : "disabled"));
|
||||
rect(26 + (i % 3) * 288, 356 + (i / 3) * 76, 272, 64) + "\" " + (enabled ? "" : "disabled"));
|
||||
}
|
||||
const std::array<const char *, 12> keys = {"7","8","9","4","5","6","1","2","3","0","00","←"};
|
||||
for (int i = 0; i < 12; ++i)
|
||||
out += button("calc-digit", keys[size_t(i)], "amount-key", "id=\"calculator-key-" + std::to_string(i) + "\" data-id=\"" +
|
||||
keys[size_t(i)] + "\" style=\"" + rect(26 + (i % 3) * 258, 566 + (i / 3) * 98, 248, 88) + "\"");
|
||||
for (int i = 0; i < 12; ++i) {
|
||||
// 0 is two keys wide; the backspace heads the column of function keys
|
||||
const auto place = i == 11 ? rect(26 + 3 * (key_width + key_gap), pad_top, key_width, 152)
|
||||
: i == 9 ? rect(26, pad_top + 3 * (key_height + key_gap), 2 * key_width + key_gap, key_height)
|
||||
: i == 10 ? rect(26 + 2 * (key_width + key_gap), pad_top + 3 * (key_height + key_gap), key_width, key_height)
|
||||
: rect(26 + (i % 3) * (key_width + key_gap), pad_top + (i / 3) * (key_height + key_gap), key_width, key_height);
|
||||
out += button("calc-digit", keys[size_t(i)], i == 11 ? "amount-function amount-erase" : "amount-key",
|
||||
"id=\"calculator-key-" + std::to_string(i) + "\" data-id=\"" + keys[size_t(i)] + "\" " + (i == 11 ? "aria-label=\"Letzte Ziffer löschen\" " : "") + "style=\"" + place + "\"");
|
||||
}
|
||||
const auto error = amount_error();
|
||||
out += "<p id=\"calculator-feedback\" class=\"amount-feedback " + std::string(error.empty() ? "" : "invalid") + "\"><span>" +
|
||||
esc(error.empty() ? r.review ? "Nach „Übernehmen“ wird der Betrag noch einmal bestätigt." : "Erst „Übernehmen“ bestätigt den Wert." : error) +
|
||||
@@ -163,6 +174,7 @@ bool App::amount_action(const std::string &action, Rml::Element *target) {
|
||||
if (auto *input = dynamic_cast<Rml::ElementFormControlInput *>(element("calculator-value"))) input->GetSelection(&start, &end, nullptr);
|
||||
start = std::clamp(start, 0, int(amount_->raw.size()));
|
||||
end = std::clamp(end, start, int(amount_->raw.size()));
|
||||
if (amount_untouched_) { start = 0; end = int(amount_->raw.size()); }
|
||||
if (digit == "←") {
|
||||
if (start == end && start) --start;
|
||||
amount_->raw.erase(size_t(start), size_t(end - start));
|
||||
@@ -173,6 +185,7 @@ bool App::amount_action(const std::string &action, Rml::Element *target) {
|
||||
if (next.size() <= 8) amount_->raw = std::move(next);
|
||||
}
|
||||
} else return false;
|
||||
amount_untouched_ = false;
|
||||
update_amount(true);
|
||||
return true;
|
||||
}
|
||||
@@ -205,6 +218,7 @@ bool App::amount_event(Rml::Event &event) {
|
||||
if ((type == "input" || type == "change") && target->GetId() == "calculator-value") {
|
||||
if (!amount_->review) {
|
||||
amount_->raw = dynamic_cast<Rml::ElementFormControlInput *>(target)->GetValue();
|
||||
amount_untouched_ = false;
|
||||
update_amount();
|
||||
}
|
||||
event.StopImmediatePropagation(); return true;
|
||||
|
||||
@@ -452,6 +452,8 @@ class App final : public Rml::EventListener {
|
||||
std::string almanac_day_, almanac_match_, almanac_tab_ = "lineups";
|
||||
std::optional<AmountDraft> amount_;
|
||||
bool amount_select_all_ = false, amount_caret_end_ = false;
|
||||
// the offered value is still as it was opened: the first digit key replaces it
|
||||
bool amount_untouched_ = false;
|
||||
std::string bank_view_ = "entrance", bank_hint_;
|
||||
int bank_property_ = 0, bank_owned_ = 0, bank_stock_ = 11;
|
||||
bool balance_future_ = false;
|
||||
|
||||
Reference in new issue
Block a user