Standardize menu entry announcements and fix effect escape

This commit is contained in:
Jage9
2026-02-28 20:41:54 -05:00
parent 0bbef06d5c
commit 313ff581c0
2 changed files with 14 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version. // Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) // 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. // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit"; window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -245,6 +245,14 @@ function buildHelpLines(help: HelpData): string[] {
return lines; 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(); const APP_VERSION = String(window.CHGRID_WEB_VERSION ?? '').trim();
dom.appVersion.textContent = APP_VERSION dom.appVersion.textContent = APP_VERSION
? `Another AI experiment with Jage. Version ${APP_VERSION}` ? `Another AI experiment with Jage. Version ${APP_VERSION}`
@@ -1089,8 +1097,7 @@ function beginItemManagement(item: WorldItem): void {
itemManagementOptions = options; itemManagementOptions = options;
itemManagementOptionIndex = 0; itemManagementOptionIndex = 0;
state.mode = 'itemManageOptions'; state.mode = 'itemManageOptions';
updateStatus('Items.'); announceMenuEntry('Items', itemManagementOptions[0].label);
audio.sfxUiBlip();
} }
/** Opens standardized yes/no confirmation prompt for a pending item-management action. */ /** 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); const currentIndex = EFFECT_SEQUENCE.findIndex((effect) => effect.id === currentEffect.id);
state.effectSelectIndex = currentIndex >= 0 ? currentIndex : 0; state.effectSelectIndex = currentIndex >= 0 ? currentIndex : 0;
state.mode = 'effectSelect'; state.mode = 'effectSelect';
updateStatus(`Select effect: ${EFFECT_SEQUENCE[state.effectSelectIndex].label}`); announceMenuEntry('Effects', EFFECT_SEQUENCE[state.effectSelectIndex].label);
audio.sfxUiBlip();
return; return;
} }
case 'effectValueUp': case 'effectValueUp':
@@ -2251,8 +2257,7 @@ function handleNormalModeInput(code: string, shiftKey: boolean): void {
adminMenuActions.splice(0, adminMenuActions.length, ...actions); adminMenuActions.splice(0, adminMenuActions.length, ...actions);
adminMenuIndex = 0; adminMenuIndex = 0;
state.mode = 'adminMenu'; state.mode = 'adminMenu';
updateStatus(`Admin: ${adminMenuActions[0].label}.`); announceMenuEntry('Admin', adminMenuActions[0].label);
audio.sfxUiBlip();
return; return;
} }
case 'useItem': { case 'useItem': {
@@ -2667,8 +2672,8 @@ function handleEffectSelectModeInput(code: string, key: string): void {
} }
if (control.type === 'cancel') { if (control.type === 'cancel') {
state.mode = 'adminMenu'; state.mode = 'normal';
updateStatus('Admin menu.'); updateStatus('Cancelled.');
audio.sfxUiCancel(); audio.sfxUiCancel();
} }
} }