From 42f69cf1c6964d4885681f0a39be393e60cc10b1 Mon Sep 17 00:00:00 2001 From: cartel9072-design Date: Mon, 28 Sep 2026 23:44:50 +0100 Subject: [PATCH] fix: render unknown event types with a fallback Adds isKnownEventType + circular-safe payload formatting and wires the fallback presentation into the event feed components. Closes #612 --- dashboard/src/components/EventCard.tsx | 56 ++++----- .../src/components/EventCard.unknown.test.tsx | 52 +++++++++ .../src/components/EventExplorerCard.tsx | 48 ++++---- .../components/NotificationDetailsDrawer.tsx | 76 +++++++++--- dashboard/src/utils/eventTypeMapping.test.ts | 72 ++++++++++++ dashboard/src/utils/eventTypeMapping.ts | 45 +++++-- dashboard/src/utils/payloadViewer.test.ts | 110 ++++++++++++++++++ dashboard/src/utils/payloadViewer.ts | 100 ++++++++++++---- 8 files changed, 465 insertions(+), 94 deletions(-) create mode 100644 dashboard/src/components/EventCard.unknown.test.tsx create mode 100644 dashboard/src/utils/eventTypeMapping.test.ts create mode 100644 dashboard/src/utils/payloadViewer.test.ts diff --git a/dashboard/src/components/EventCard.tsx b/dashboard/src/components/EventCard.tsx index a290782b..154ba135 100644 --- a/dashboard/src/components/EventCard.tsx +++ b/dashboard/src/components/EventCard.tsx @@ -1,6 +1,8 @@ import { memo, type KeyboardEvent } from 'react'; import type { BlockchainEvent } from '../types/event'; import { formatRelativeTimestamp, formatTimestamp } from '../utils/formatTime'; +import { getEventBadgeClass, isKnownEventType } from '../utils/eventTypeMapping'; +import { formatPayloadPreview } from '../utils/payloadViewer'; import { CopyButton } from './CopyButton'; export type EventCardVariant = 'compact' | 'expanded'; @@ -17,8 +19,6 @@ function shortenAddress(address: string): string { return `${address.slice(0, 6)}...${address.slice(-4)}`; } -import { getEventBadgeClass } from '../utils/eventTypeMapping'; - function SkeletonLine({ width = '100%', height = '14px' }: { width?: string; height?: string }) { return