Add keyboard control for a dealer working on a laptop
The phone got gestures a few rounds back; the desktop still had a mouse and nothing else. On a bar that gets tapped thirty times a hand, moving a hand to the trackpad between every decision is the slow part. F folds, C checks or calls, R opens the raise pad, A shoves, Enter confirms a raise or moves the hand on, Esc backs out, U takes the last action back. Each button wears its key in the corner, hidden on touch devices where it would just be clutter on a button being tapped anyway. The shortcuts press the same buttons a dealer would tap rather than calling the betting engine themselves, so there's no second code path to drift out of step with what the bar is actually offering — if a button isn't on screen, its key does nothing. Nothing fires while a name, amount or note is being typed, or while an overlay owns the keyboard. Typing "Francesca" into a seat name must not fold the table. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015bnp7xKUPFFSpwkYNFaPgb
This commit is contained in:
@@ -194,6 +194,19 @@ const ActionBar = {
|
||||
);
|
||||
},
|
||||
|
||||
// Which key presses each button. Shown on the button itself and hidden on touch
|
||||
// devices — a shortcut nobody can discover may as well not exist, and a key badge
|
||||
// on a phone is just clutter.
|
||||
KEY_HINTS: {
|
||||
actionFold: "F",
|
||||
actionCheck: "C",
|
||||
actionCall: "C",
|
||||
actionRaise: "R",
|
||||
actionAdvance: "↵",
|
||||
raiseConfirm: "↵",
|
||||
raiseCancel: "esc",
|
||||
},
|
||||
|
||||
button(label, className, onClick, sublabel) {
|
||||
const btn = document.createElement("button");
|
||||
btn.type = "button";
|
||||
@@ -204,6 +217,14 @@ const ActionBar = {
|
||||
main.textContent = label;
|
||||
btn.appendChild(main);
|
||||
|
||||
const hint = this.KEY_HINTS[className];
|
||||
if (hint) {
|
||||
const kbd = document.createElement("kbd");
|
||||
kbd.className = "actionKey";
|
||||
kbd.textContent = hint;
|
||||
btn.appendChild(kbd);
|
||||
}
|
||||
|
||||
if (sublabel) {
|
||||
const sub = document.createElement("span");
|
||||
sub.className = "actionBtnSub";
|
||||
|
||||
Reference in New Issue
Block a user