From 10e7a01e73fc378ea470da59f725f4d6f9dba212 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Fri, 27 Feb 2026 04:23:30 -0500 Subject: [PATCH] Fix help duplicates and role selection focus timing --- client/public/version.js | 2 +- client/src/main.ts | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index 2e3b927..7ab90e5 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.27 R291"; +window.CHGRID_WEB_VERSION = "2026.02.27 R292"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/main.ts b/client/src/main.ts index 2c58a77..4d9a06c 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -414,7 +414,6 @@ function renderHelp(help: HelpData): void { const sectionHeading = document.createElement('h3'); sectionHeading.textContent = section.title; dom.instructions.appendChild(sectionHeading); - lines.push(section.title); for (const item of section.items) { const line = document.createElement('p'); const keys = document.createElement('b'); @@ -1593,10 +1592,13 @@ function handleAdminRolesList(message: Extract entry.username === adminSelectedUsername); + const currentRoleIndex = + selectedUser ? adminRoles.findIndex((entry) => entry.name === selectedUser.role) : -1; + adminRoleIndex = currentRoleIndex >= 0 ? currentRoleIndex : 0; const first = adminRoles[0]; - if (first) { - updateStatus(first.name); + if (first && adminRoles[adminRoleIndex]) { + updateStatus(adminRoles[adminRoleIndex].name); audio.sfxUiBlip(); } else { updateStatus('No roles available.'); @@ -1657,6 +1659,16 @@ function handleAdminActionResult(message: Extract entry.username === adminPendingUserMutation.username); + if (userIndex >= 0) { + adminUserIndex = userIndex; + const selected = adminUsers[adminUserIndex]; + updateStatus(`${selected.username}, ${selected.role}, ${selected.status}.`); + } + } } else if (adminPendingUserMutation.action === 'ban') { adminUsers = adminUsers.filter((entry) => entry.username !== adminPendingUserMutation.username); if (state.mode === 'adminUserList' && adminPendingUserAction === 'ban') { @@ -2921,14 +2933,6 @@ function handleAdminUserRoleSelectModeInput(code: string, key: string): void { const selectedRole = adminRoles[adminRoleIndex]; adminPendingUserMutation = { action: 'set_role', username: adminSelectedUsername, role: selectedRole.name }; signaling.send({ type: 'admin_user_set_role', username: adminSelectedUsername, role: selectedRole.name }); - state.mode = 'adminUserList'; - adminPendingUserAction = 'set_role'; - const selectedUser = adminUsers.find((user) => user.username === adminSelectedUsername); - if (selectedUser) { - updateStatus(`${selectedUser.username}, ${selectedUser.role}, ${selectedUser.status}.`); - } else { - updateStatus('Select user.'); - } return; } if (control.type === 'cancel') {