fix(highlights): improve relay indicator tooltip accuracy

Update tooltip text to be more accurate about relay information:
- Show 'Published to X relays' for user-created highlights with publishedRelays
- Show 'Seen on X relays' for highlights with seenOnRelays tracking
- Show 'Fetched from network' for highlights without relay metadata
- Add seenOnRelays field to Highlight type for future relay tracking
This commit is contained in:
Gigi
2025-10-09 16:16:50 +01:00
parent cc8b742731
commit 47e2204c3f
2 changed files with 15 additions and 3 deletions

View File

@@ -178,7 +178,7 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
}
}
// Always show server icon, even if we don't have relay info
// Show server icon with relay info if available
if (highlight.publishedRelays && highlight.publishedRelays.length > 0) {
const relayNames = highlight.publishedRelays.map(url =>
url.replace(/^wss?:\/\//, '').replace(/\/$/, '')
@@ -190,10 +190,21 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
}
}
if (highlight.seenOnRelays && highlight.seenOnRelays.length > 0) {
const relayNames = highlight.seenOnRelays.map(url =>
url.replace(/^wss?:\/\//, '').replace(/\/$/, '')
)
return {
icon: faServer,
tooltip: `Seen on ${relayNames.length} relay(s):\n${relayNames.join('\n')}\n\nClick to rebroadcast`,
spin: false
}
}
// Default server icon for highlights without relay info
return {
icon: faServer,
tooltip: 'Click to rebroadcast to all relays',
tooltip: 'Fetched from network\n\nClick to rebroadcast to all relays',
spin: false
}
}

View File

@@ -16,7 +16,8 @@ export interface Highlight {
// Level classification (computed based on user's context)
level?: HighlightLevel
// Relay tracking for offline/local-only highlights
publishedRelays?: string[] // URLs of relays that acknowledged this event
publishedRelays?: string[] // URLs of relays where this was published (for user-created highlights)
seenOnRelays?: string[] // URLs of relays where this event was fetched from
isLocalOnly?: boolean // true if only published to local relays
isOfflineCreated?: boolean // true if created while in flight mode (offline)
isSyncing?: boolean // true if currently being synced to remote relays