fix: player info 3-col grid layout + add Kick/Ban actions
- Wrapped col-sm-4 fields in proper row/col hierarchy (removed conflicting col+row on same element, now col-lg-12 > row > col-sm-4) - Replaced d-grid Steam Profile button with btn-group containing Steam Profile, Kick (confirm dialog), and Ban (prompt for reason) - Removed redundant 'Info' heading Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+19
-3
@@ -12,17 +12,20 @@ function PlayerInfoPage(params, container) {
|
||||
'Player: <span id="pi-username">' + userid + '</span>' +
|
||||
'<button id="pi-refresh" class="btn btn-secondary float-end" type="button"><i class="bi bi-arrow-clockwise"></i></button>' +
|
||||
'</h2>' +
|
||||
'<div class="d-grid mb-3">' +
|
||||
'<div class="btn-group d-flex mb-3">' +
|
||||
'<a href="http://www.steamcommunity.com/profiles/' + userid + '" target="_blank" class="btn btn-secondary">' +
|
||||
'<i class="bi bi-info-circle-fill"></i> Steam Profile' +
|
||||
'</a>' +
|
||||
'<button id="pi-kick" class="btn btn-warning"><i class="bi bi-trash-fill"></i> Kick</button>' +
|
||||
'<button id="pi-ban" class="btn btn-danger"><i class="bi bi-ban-fill"></i> Ban</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-lg-12">' +
|
||||
'<h2 class="text-center">Info</h2>' +
|
||||
'<div id="pi-notfound" class="alert alert-warning" style="display:none">This Player is currently not connected to this server!</div>' +
|
||||
'</div>' +
|
||||
'<div id="pi-fields" class="col-sm-12"><span class="text-white-50">Loading…</span></div>' +
|
||||
'<div class="col-lg-12">' +
|
||||
'<div id="pi-fields" class="row"><span class="text-white-50">Loading…</span></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
container.innerHTML = html;
|
||||
@@ -65,6 +68,19 @@ function PlayerInfoPage(params, container) {
|
||||
|
||||
document.getElementById('pi-refresh').addEventListener('click', refresh);
|
||||
|
||||
document.getElementById('pi-kick').addEventListener('click', function () {
|
||||
if (confirm('Kick player ' + (document.getElementById('pi-username').textContent) + '?')) {
|
||||
Rcon.command('kick ' + userid);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('pi-ban').addEventListener('click', function () {
|
||||
var reason = prompt('Ban reason:', '');
|
||||
if (reason !== null) {
|
||||
Rcon.command('ban ' + userid + ' ' + (reason || 'No reason'));
|
||||
}
|
||||
});
|
||||
|
||||
if (Rcon.isConnected()) refresh();
|
||||
else { var _c = function () { refresh(); Rcon.off('connected', _c); }; Rcon.on('connected', _c); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user