refactor: use isLocalOnly instead of isOfflineCreated

- isLocalOnly is more accurate - covers both offline and online-but-local-only scenarios
- Update tooltip to 'Local relays only - will sync when remote relays available'
- Better semantic meaning: highlights only published to local relays
- Covers cases where user is online but only connected to local relays
This commit is contained in:
Gigi
2025-10-30 20:32:43 +01:00
parent e3d924f3fc
commit b6f151c711
3 changed files with 7 additions and 7 deletions

View File

@@ -306,8 +306,8 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
}
}
// Check if this highlight was created offline (flight mode)
const isOfflineCreated = highlight.isOfflineCreated
// Check if this highlight was only published to local relays
const isLocalOnly = highlight.isLocalOnly
// Show highlighter icon with relay info if available
if (highlight.publishedRelays && highlight.publishedRelays.length > 0) {
@@ -315,8 +315,8 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
url.replace(/^wss?:\/\//, '').replace(/\/$/, '')
)
return {
icon: isOfflineCreated ? faPlane : faHighlighter,
tooltip: isOfflineCreated ? 'Created offline - will sync when online' : relayNames.join('\n'),
icon: isLocalOnly ? faPlane : faHighlighter,
tooltip: isLocalOnly ? 'Local relays only - will sync when remote relays available' : relayNames.join('\n'),
spin: false
}
}

View File

@@ -135,7 +135,7 @@ export async function createHighlight(
// Convert to Highlight with relay tracking info and return IMMEDIATELY
const highlight = eventToHighlight(signedEvent)
highlight.publishedRelays = expectedSuccessRelays
highlight.isOfflineCreated = isLocalOnly
highlight.isLocalOnly = isLocalOnly
return highlight
}

View File

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