Replace native confirm() with an in-site confirmation dialog
Add App.confirm() in common.js: a promise-based dialog styled like the site's modals, with a title, multi-line message and custom button labels. Destructive actions use a red OK button and focus Cancel by default; Escape and backdrop clicks cancel, and Tab stays inside the dialog. Use it for folding when a check is possible, leaving the table, confirming showdown winners and deleting tables from the lobby. After the dialog closes, re-check that the action is still valid (turn not passed, pot not already awarded, table still listed) before sending it. Also add a "poker-test" launch config that runs on port 4672 with the example keys from .env.example, for local browser testing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d89ce1dd30
commit
680aa20d30
5 files changed
+122
-11
No files matched your search
@@ -47,12 +47,18 @@
|
||||
if (btn && requireName()) location.href = '/table/' + encodeURIComponent(btn.dataset.join);
|
||||
});
|
||||
|
||||
function deleteTable(id, btn) {
|
||||
async function deleteTable(id, btn) {
|
||||
const t = tables && tables.find((x) => x.id === id);
|
||||
if (!t) return;
|
||||
const players = t.playerCount ? `
|
||||
着席中の ${t.playerCount} 人はテーブルから退出させられます。` : '';
|
||||
if (!confirm(`「${t.name}」を削除しますか?${players}`)) return;
|
||||
const ok = await App.confirm({
|
||||
title: 'テーブルを削除',
|
||||
message: `「${t.name}」を削除しますか?${players}`,
|
||||
ok: '削除する',
|
||||
danger: true,
|
||||
});
|
||||
if (!ok || !document.contains(btn)) return;
|
||||
btn.disabled = true;
|
||||
App.api('DELETE', '/api/tables/' + encodeURIComponent(id))
|
||||
.then(() => App.toast('テーブルを削除しました'))
|
||||
|
||||
Reference in new issue
Block a user