fix admin panel and credits package

This commit is contained in:
jwinterm
2026-02-17 20:02:22 -05:00
parent f8ae69304a
commit 320d1a3b1f
5 changed files with 226 additions and 134 deletions
+10 -10
View File
@@ -653,20 +653,20 @@
return Math.floor(sec / 3600) + 'h ' + Math.floor((sec % 3600) / 60) + 'm';
};
return \`
<tr style="\${rowStyle}">
<td>\${entry.position}</td>
<td title="\${entry.serverId}">\${entry.serverId.substring(0, 12)}...</td>
<td style="\${isStuck ? 'color:#f80; font-weight:bold;' : ''}">\${formatWait(entry.waitingSeconds)}</td>
<td>\${entry.paymentId || '-'}</td>
<td>\${statusText}</td>
return `
<tr style="${rowStyle}">
<td>${entry.position}</td>
<td title="${entry.serverId}">${entry.serverId.substring(0, 12)}...</td>
<td style="${isStuck ? 'color:#f80; font-weight:bold;' : ''}">${formatWait(entry.waitingSeconds)}</td>
<td>${entry.paymentId || '-'}</td>
<td>${statusText}</td>
<td>
<button class="btn btn-danger" onclick="removeQueueEntry('\${entry.serverId}')" style="background:#500; color:#f88; border:1px solid #f55; padding:3px 8px; cursor:pointer;">
<button class="btn btn-danger" onclick="removeQueueEntry('${entry.serverId}')" style="background:#500; color:#f88; border:1px solid #f55; padding:3px 8px; cursor:pointer;">
Remove
</button>
</td>
</tr>
\`;
`;
}).join('');
} catch (e) {
console.error('Failed to load queue:', e);
@@ -679,7 +679,7 @@
}
async function removeQueueEntry(serverId) {
if (!confirm(\`Remove queue entry for \${serverId.substring(0, 12)}...? This will cancel their queue position.\`)) return;
if (!confirm(`Remove queue entry for ${serverId.substring(0, 12)}...? This will cancel their queue position.`)) return;
const reason = prompt('Reason for removal (optional):') || 'Admin removal';
+22 -5
View File
@@ -1331,7 +1331,7 @@ const SocketHandlers = {
animation: earlyEntryPulse 2s infinite;
">⚡ ENTER NOW (RISKY!) ⚡</button>
`);
// Add CSS animation
if (!$('#earlyEntryStyles').length) {
$('head').append(`
@@ -1365,22 +1365,39 @@ const SocketHandlers = {
// Show/hide based on whether we're queued and early entry is allowed
if (this._isQueued && this.isEarlyEntryAllowed()) {
// Update button text to show credit cost when in paid mode
var mode = this._gameMode;
if (mode === 'PAID_CREDITS' || mode === 'MIXED') {
var cost = this._creditsPerGame || 1;
$btn.text('⚡ ENTER NOW (' + cost + ' credit, RISKY!) ⚡');
} else {
$btn.text('⚡ ENTER NOW (RISKY!) ⚡');
}
$btn.show();
} else {
$btn.hide();
}
},
/**
* Request early entry from the server
*/
requestEarlyEntry: function() {
if (!window.socket) return;
// Confirm before spending credits
var mode = this._gameMode;
var msg = 'Enter the dungeon NOW?\n\nYou will die when the next block is found!';
if (mode === 'PAID_CREDITS' || mode === 'MIXED') {
var cost = this._creditsPerGame || 1;
msg = 'Use ' + cost + ' credit to enter the dungeon NOW?\n\nYou will die when the next block is found!';
}
if (!confirm(msg)) return;
// Disable button to prevent double-clicks
const $btn = $('#earlyEntryButton');
var $btn = $('#earlyEntryButton');
$btn.prop('disabled', true).text('⏳ Entering...');
socket.emit('early_entry');
},