From 313ff581c0508bafd7a569477f1667dc1f435d46 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Sat, 28 Feb 2026 20:41:54 -0500 Subject: [PATCH] Standardize menu entry announcements and fix effect escape --- client/public/version.js | 2 +- client/src/main.ts | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index fd7a65e..43d4745 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.03.01 R324"; +window.CHGRID_WEB_VERSION = "2026.03.01 R325"; // 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 0b95ed2..179ee7f 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -245,6 +245,14 @@ function buildHelpLines(help: HelpData): string[] { return lines; } +/** Announces standardized menu entry as `Title. First option.` */ +function announceMenuEntry(title: string, firstOption: string): void { + const trimmedTitle = title.trim(); + const trimmedOption = firstOption.trim(); + updateStatus(`${trimmedTitle}. ${trimmedOption}.`); + audio.sfxUiBlip(); +} + const APP_VERSION = String(window.CHGRID_WEB_VERSION ?? '').trim(); dom.appVersion.textContent = APP_VERSION ? `Another AI experiment with Jage. Version ${APP_VERSION}` @@ -1089,8 +1097,7 @@ function beginItemManagement(item: WorldItem): void { itemManagementOptions = options; itemManagementOptionIndex = 0; state.mode = 'itemManageOptions'; - updateStatus('Items.'); - audio.sfxUiBlip(); + announceMenuEntry('Items', itemManagementOptions[0].label); } /** Opens standardized yes/no confirmation prompt for a pending item-management action. */ @@ -2202,8 +2209,7 @@ function handleNormalModeInput(code: string, shiftKey: boolean): void { const currentIndex = EFFECT_SEQUENCE.findIndex((effect) => effect.id === currentEffect.id); state.effectSelectIndex = currentIndex >= 0 ? currentIndex : 0; state.mode = 'effectSelect'; - updateStatus(`Select effect: ${EFFECT_SEQUENCE[state.effectSelectIndex].label}`); - audio.sfxUiBlip(); + announceMenuEntry('Effects', EFFECT_SEQUENCE[state.effectSelectIndex].label); return; } case 'effectValueUp': @@ -2251,8 +2257,7 @@ function handleNormalModeInput(code: string, shiftKey: boolean): void { adminMenuActions.splice(0, adminMenuActions.length, ...actions); adminMenuIndex = 0; state.mode = 'adminMenu'; - updateStatus(`Admin: ${adminMenuActions[0].label}.`); - audio.sfxUiBlip(); + announceMenuEntry('Admin', adminMenuActions[0].label); return; } case 'useItem': { @@ -2667,8 +2672,8 @@ function handleEffectSelectModeInput(code: string, key: string): void { } if (control.type === 'cancel') { - state.mode = 'adminMenu'; - updateStatus('Admin menu.'); + state.mode = 'normal'; + updateStatus('Cancelled.'); audio.sfxUiCancel(); } }