From 036f3d120911d8f92b239361cfe84b4659d9365d Mon Sep 17 00:00:00 2001 From: egeoztass Date: Fri, 14 Aug 2026 18:14:21 +0300 Subject: [PATCH 1/2] fix: make truncated KeyValueGrid values readable and copyable Long values in the event details popup are truncated with no way to read or copy the rest. Two gaps: - The title tooltip was only set for string values, so objects (rendered as JSON) and numbers got no tooltip at all. - The popup's two grids never passed `copyable`, so no copy button rendered. Adds a shared toStringValue() used for both the tooltip and the clipboard, replacing the inline stringify in the copy handler. Booleans and 0 now stringify rather than being dropped, and circular objects degrade to no tooltip instead of throwing. Closes #381 --- .../src/components/ui/key-value-grid.tsx | 44 +++++++++++++------ apps/start/src/modals/event-details.tsx | 2 + 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/apps/start/src/components/ui/key-value-grid.tsx b/apps/start/src/components/ui/key-value-grid.tsx index 213ac9736..da3df7850 100644 --- a/apps/start/src/components/ui/key-value-grid.tsx +++ b/apps/start/src/components/ui/key-value-grid.tsx @@ -28,6 +28,35 @@ interface KeyValueGridProps { copyable?: boolean; } +/** + * The value cell truncates, so the full value is only reachable through the native + * tooltip and the copy button. Both need a string, and objects render as JSON here, + * so stringify them rather than leaving the value unreadable. + */ +export function toStringValue(value: unknown): string | undefined { + if (value === null || value === undefined) { + return undefined; + } + + if (typeof value === 'string') { + return value; + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (typeof value === 'object') { + try { + return JSON.stringify(value); + } catch { + return undefined; + } + } + + return String(value); +} + export function KeyValueGrid({ data, columns = 1, @@ -102,18 +131,7 @@ export function KeyValueGrid({