From 5914df23d3defa676a00c0dcae85e542e0e35019 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 30 Oct 2025 20:30:04 +0100 Subject: [PATCH] fix: show airplane icon for flight mode highlights - Simplify logic to check highlight.isOfflineCreated || highlight.isLocalOnly - Show airplane icon with 'Created offline - will sync when online' tooltip - Remove complex showOfflineIndicator state management - Fixes issue where flight mode highlights showed highlighter icon instead of plane icon --- src/components/HighlightItem.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/components/HighlightItem.tsx b/src/components/HighlightItem.tsx index 0c2a7598..9c822520 100644 --- a/src/components/HighlightItem.tsx +++ b/src/components/HighlightItem.tsx @@ -114,7 +114,6 @@ export const HighlightItem: React.FC = ({ const itemRef = useRef(null) const menuRef = useRef(null) const [isSyncing, setIsSyncing] = useState(() => isEventSyncing(highlight.id)) - const [showOfflineIndicator, setShowOfflineIndicator] = useState(() => highlight.isOfflineCreated && !isSyncing) const [isRebroadcasting, setIsRebroadcasting] = useState(false) const [showDeleteConfirm, setShowDeleteConfirm] = useState(false) const [isDeleting, setIsDeleting] = useState(false) @@ -133,12 +132,6 @@ export const HighlightItem: React.FC = ({ return `${highlight.pubkey.slice(0, 8)}...` // fallback to short pubkey } - // Update offline indicator when highlight prop changes - useEffect(() => { - if (highlight.isOfflineCreated && !isSyncing) { - setShowOfflineIndicator(true) - } - }, [highlight.isOfflineCreated, isSyncing]) // Listen to sync state changes useEffect(() => { @@ -313,8 +306,8 @@ export const HighlightItem: React.FC = ({ } } - // Always show relay list, use plane icon for local-only - const isLocalOrOffline = highlight.isLocalOnly || showOfflineIndicator + // Check if this highlight was created offline (flight mode) + const isOfflineCreated = highlight.isOfflineCreated || highlight.isLocalOnly // Show highlighter icon with relay info if available if (highlight.publishedRelays && highlight.publishedRelays.length > 0) { @@ -322,8 +315,8 @@ export const HighlightItem: React.FC = ({ url.replace(/^wss?:\/\//, '').replace(/\/$/, '') ) return { - icon: isLocalOrOffline ? faPlane : faHighlighter, - tooltip: relayNames.join('\n'), + icon: isOfflineCreated ? faPlane : faHighlighter, + tooltip: isOfflineCreated ? 'Created offline - will sync when online' : relayNames.join('\n'), spin: false } }