From 0fbd4f3615365bc7ff7364f8b6dee0f38d6b464c Mon Sep 17 00:00:00 2001 From: Jage9 Date: Fri, 27 Feb 2026 01:34:32 -0500 Subject: [PATCH] Remove client fallback for readonly item property display --- client/public/version.js | 2 +- client/src/items/itemPropertyPresentation.ts | 17 +------- client/src/main.ts | 42 +------------------- 3 files changed, 3 insertions(+), 58 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index 5d2a1a2..002f19c 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.25 R276"; +window.CHGRID_WEB_VERSION = "2026.02.25 R277"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/items/itemPropertyPresentation.ts b/client/src/items/itemPropertyPresentation.ts index f22aea8..f8d329c 100644 --- a/client/src/items/itemPropertyPresentation.ts +++ b/client/src/items/itemPropertyPresentation.ts @@ -7,12 +7,8 @@ import { itemPropertyLabel, } from './itemRegistry'; -type PresentationDeps = { - formatTimestampMs: (value: unknown) => string; -}; - /** Builds shared item-property presentation/validation helpers used by item menus and message echoes. */ -export function createItemPropertyPresentation(deps: PresentationDeps): { +export function createItemPropertyPresentation(): { getItemPropertyValue: (item: WorldItem, key: string) => string; isItemPropertyEditable: (item: WorldItem, key: string) => boolean; describeItemPropertyHelp: (item: WorldItem, key: string) => string; @@ -59,17 +55,6 @@ export function createItemPropertyPresentation(deps: PresentationDeps): { if (metadata?.valueType === 'list' || metadata?.valueType === 'text') { return rawValue === undefined || rawValue === null ? '' : String(rawValue); } - if (key === 'type') return item.type; - if (key === 'x') return String(item.x); - if (key === 'y') return String(item.y); - if (key === 'carrierId') return item.carrierId ?? 'none'; - if (key === 'version') return String(item.version); - if (key === 'createdBy') return item.createdBy; - if (key === 'createdAt') return deps.formatTimestampMs(item.createdAt); - if (key === 'updatedAt') return deps.formatTimestampMs(item.updatedAt); - if (key === 'capabilities') return item.capabilities.join(', ') || 'none'; - if (key === 'useSound') return toSoundDisplayName(item.params.useSound ?? item.useSound); - if (key === 'emitSound') return toSoundDisplayName(item.params.emitSound ?? item.emitSound); if (paramValue !== undefined) return String(paramValue); if (globalValue !== undefined) return String(globalValue); return ''; diff --git a/client/src/main.ts b/client/src/main.ts index 29a8977..ce655d6 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -64,7 +64,6 @@ import { type AudioLayerState } from './types/audio'; import { setupUiHandlers as setupDomUiHandlers } from './ui/domBindings'; import { PeerManager } from './webrtc/peerManager'; -const DEFAULT_DISPLAY_TIME_ZONE = 'America/Detroit'; const NICKNAME_MAX_LENGTH = 32; const MIC_CALIBRATION_DURATION_MS = 5000; const MIC_CALIBRATION_SAMPLE_INTERVAL_MS = 50; @@ -84,7 +83,6 @@ const AUTH_POLICY_STORAGE_KEY = 'chgridAuthPolicy'; declare global { interface Window { CHGRID_WEB_VERSION?: string; - CHGRID_TIME_ZONE?: string; } } @@ -201,7 +199,6 @@ function buildHelpLines(help: HelpData): string[] { } const APP_VERSION = String(window.CHGRID_WEB_VERSION ?? '').trim(); -const DISPLAY_TIME_ZONE = resolveDisplayTimeZone(); dom.appVersion.textContent = APP_VERSION ? `Another AI experiment with Jage. Version ${APP_VERSION}` : 'Another AI experiment with Jage. Version unknown'; @@ -349,44 +346,7 @@ function requiredById(id: string): T { return found as T; } -/** Returns the configured display timezone when valid, otherwise the default fallback. */ -function resolveDisplayTimeZone(): string { - const configured = String(window.CHGRID_TIME_ZONE ?? '').trim(); - if (configured) { - try { - new Intl.DateTimeFormat('en-US', { timeZone: configured }).format(new Date()); - return configured; - } catch { - // Fall back when configured timezone is invalid. - } - } - return DEFAULT_DISPLAY_TIME_ZONE; -} - -/** Formats epoch milliseconds as `YYYY-MM-DD HH:mm` in the configured display timezone. */ -function formatTimestampMs(value: unknown): string { - const raw = Number(value); - if (!Number.isFinite(raw)) { - return String(value ?? ''); - } - const date = new Date(raw); - if (Number.isNaN(date.getTime())) { - return String(value ?? ''); - } - const parts = new Intl.DateTimeFormat('en-CA', { - timeZone: DISPLAY_TIME_ZONE, - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - hour12: false, - }).formatToParts(date); - const pick = (type: Intl.DateTimeFormatPartTypes): string => parts.find((part) => part.type === type)?.value ?? '00'; - return `${pick('year')}-${pick('month')}-${pick('day')} ${pick('hour')}:${pick('minute')}`; -} - -const itemPropertyPresentation = createItemPropertyPresentation({ formatTimestampMs }); +const itemPropertyPresentation = createItemPropertyPresentation(); const getItemPropertyValue = itemPropertyPresentation.getItemPropertyValue; const isItemPropertyEditable = itemPropertyPresentation.isItemPropertyEditable; const describeItemPropertyHelp = itemPropertyPresentation.describeItemPropertyHelp;