diff --git a/src/components/Note/Superchat.tsx b/src/components/Note/Superchat.tsx
index ea2f0c9e..253a5079 100644
--- a/src/components/Note/Superchat.tsx
+++ b/src/components/Note/Superchat.tsx
@@ -90,6 +90,12 @@ export default function Superchat({
showAt
className="min-w-0 font-medium text-foreground/85 hover:text-foreground"
/>
+
{t('Preview')}
diff --git a/src/hooks/useProfileWall.tsx b/src/hooks/useProfileWall.tsx index ba6e81c6..749549d1 100644 --- a/src/hooks/useProfileWall.tsx +++ b/src/hooks/useProfileWall.tsx @@ -127,6 +127,130 @@ async function hydrateProfileWallSuperchatTargets( return [...byId.values()] } +function normalizeProfileEventId(profileEventId: string | undefined): string | undefined { + const id = profileEventId?.trim().toLowerCase() + return id && /^[0-9a-f]{64}$/.test(id) ? id : undefined +} + +function buildProfileWallSuperchatFilters(pkNorm: string, profileId: string | undefined): Filter[] { + const filters: Filter[] = [ + { kinds: [ExtendedKind.PAYMENT_NOTIFICATION], '#p': [pkNorm], limit: 200 }, + { kinds: [kinds.Zap], '#p': [pkNorm], limit: 200 }, + { kinds: [ExtendedKind.PAYMENT_ATTESTATION], authors: [pkNorm], limit: 500 } + ] + if (profileId) { + const profileCoord = getReplaceableCoordinate(kinds.Metadata, pkNorm, '') + filters.unshift( + { kinds: [ExtendedKind.COMMENT], '#e': [profileId], limit: 200 }, + { kinds: [ExtendedKind.COMMENT], '#a': [profileCoord], limit: 200 } + ) + filters.push( + { kinds: [ExtendedKind.PAYMENT_NOTIFICATION], '#e': [profileId], limit: 200 }, + { kinds: [ExtendedKind.PAYMENT_NOTIFICATION], '#a': [profileCoord], limit: 200 }, + { kinds: [kinds.Zap], '#e': [profileId], limit: 200 } + ) + } + return filters +} + +/** IndexedDB + session only — no relay REQ (profile wall must paint immediately when cached). */ +async function hydrateProfileWallSuperchatsFromLocalCache( + pkNorm: string, + profileEventId: string | undefined, + isEventDeleted: (event: Event) => boolean +): Promise