feat: HUD quick-capture (stack/buyin/cashout) + villain rename
Direct-capture inputs on the Stack card and a per-villain rename control (fixes mislabeled players); expose player id in the HUD villains bundle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G796GsLCvJQKVN7hwV2cDx
This commit is contained in:
@@ -114,6 +114,16 @@
|
||||
li.start .tl-body { color: var(--accent); font-weight: 600; }
|
||||
li.scar .tl-body, li.confidence .tl-body { font-style: italic; }
|
||||
.tl-body a.hand { color: var(--accent); text-decoration: none; white-space: nowrap; }
|
||||
/* quick-capture (no LLM) + inline correction controls */
|
||||
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
|
||||
.quick input { width: 100px; background: var(--bg-line); border: 1px solid var(--border);
|
||||
border-radius: 8px; padding: 8px 10px; color: var(--text); }
|
||||
.quick input:focus { outline: none; border-color: var(--accent); }
|
||||
.quick button { background: var(--accent); color: #0a0a0a; border: 1px solid var(--accent);
|
||||
border-radius: 8px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
|
||||
button.mini { background: none; border: none; color: var(--fade); cursor: pointer;
|
||||
font-size: .9rem; padding: 0 6px; }
|
||||
button.mini:active { color: var(--accent); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -217,6 +227,30 @@
|
||||
} catch(e){ alert('Delete failed: '+e.message); }
|
||||
}
|
||||
|
||||
// Quick-capture (no LLM): post a number to a direct endpoint, then refresh.
|
||||
function numVal(id){ const el = document.getElementById(id); return Number(((el && el.value) || '').replace(/[^0-9.]/g,'')); }
|
||||
async function postQuick(url, amount){
|
||||
const r = await fetch(url, { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({ amount }) });
|
||||
const d = await r.json();
|
||||
if(!d.ok){ alert(d.error || 'failed'); return false; }
|
||||
return true;
|
||||
}
|
||||
async function postStack(){ const v = numVal('qStack'); if(v && await postQuick('/session/stack', v)){ document.getElementById('qStack').value=''; refresh(); } }
|
||||
async function postBuyin(){ const v = numVal('qBuyin'); if(v && await postQuick('/session/buyin', v)){ document.getElementById('qBuyin').value=''; refresh(); } }
|
||||
async function postCashout(){
|
||||
if(!curSession) return;
|
||||
const v = numVal('qCashout'); if(!v) return;
|
||||
const r = await fetch('/session/'+curSession.id, { method:'PATCH', headers:{'Content-Type':'application/json'}, body: JSON.stringify({ cash_out: v }) });
|
||||
if(!(await r.json()).ok){ alert('failed'); return; }
|
||||
document.getElementById('qCashout').value=''; refresh();
|
||||
}
|
||||
async function renamePlayer(id, current){
|
||||
const name = prompt('Rename player', current || ''); if(!name) return;
|
||||
const r = await fetch('/player/'+id, { method:'PATCH', headers:{'Content-Type':'application/json'}, body: JSON.stringify({ name }) });
|
||||
if(!(await r.json()).ok){ alert('failed'); return; }
|
||||
refresh();
|
||||
}
|
||||
|
||||
function render(data){
|
||||
const s = data.session;
|
||||
if (!s) {
|
||||
@@ -285,7 +319,15 @@
|
||||
<span class="stack-meta">bought in ${money(stack.buy_in)}<br>${(stack.log||[]).length} update(s)</span>
|
||||
</div>
|
||||
${sparkline(stack.log || [])}
|
||||
${stack.current == null ? '<p class="empty" style="margin:12px 0 0">No stack logged yet — tell Lyra your stack ("I\'m at 350").</p>' : ''}
|
||||
${stack.current == null ? '<p class="empty" style="margin:12px 0 0">No stack logged yet — log it below or tell Lyra ("I\'m at 350").</p>' : ''}
|
||||
<div class="quick">
|
||||
<input id="qStack" type="number" inputmode="decimal" placeholder="Stack $" onkeydown="if(event.key==='Enter')postStack()">
|
||||
<button onclick="postStack()">Log stack</button>
|
||||
<input id="qBuyin" type="number" inputmode="decimal" placeholder="Buy-in $" onkeydown="if(event.key==='Enter')postBuyin()">
|
||||
<button onclick="postBuyin()">Add buy-in</button>
|
||||
<input id="qCashout" type="number" inputmode="decimal" placeholder="Cash out $" onkeydown="if(event.key==='Enter')postCashout()">
|
||||
<button onclick="postCashout()">Cash out</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
@@ -332,6 +374,7 @@
|
||||
${villains.length ? `<ul class="rows">${villains.map(v => `
|
||||
<li class="villain">
|
||||
<b>${esc(v.name)}</b> ${v.category ? `<span class="cat">[${esc(v.category)}]</span>` : ''}
|
||||
<button class="mini" title="Rename / fix" onclick="renamePlayer(${v.id}, '${esc(v.name||'').replace(/'/g,"\\'")}')">✎</button>
|
||||
${v.tendencies ? `<div>${esc(v.tendencies)}</div>` : ''}
|
||||
${v.last_note ? `<div class="note-meta">“${esc(v.last_note)}”</div>` : ''}
|
||||
</li>`).join('')}</ul>`
|
||||
|
||||
Reference in New Issue
Block a user