feat: add flight mode indicator to offline-created highlights

- Add isOfflineCreated property to Highlight type
- Set flag when highlight is created in local-only mode
- Display small plane icon in highlight sidebar for offline-created highlights
- Lighter amber color (#fbbf24) to distinguish from Local badge
- Tooltip: 'Created while in flight mode'
- Visual indicator helps users track which highlights need syncing
This commit is contained in:
Gigi
2025-10-09 13:51:04 +01:00
parent 4224c989c6
commit 95162d4423
4 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react' import React, { useEffect, useRef } from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faQuoteLeft, faExternalLinkAlt, faHouseSignal } from '@fortawesome/free-solid-svg-icons' import { faQuoteLeft, faExternalLinkAlt, faHouseSignal, faPlane } from '@fortawesome/free-solid-svg-icons'
import { Highlight } from '../types/highlights' import { Highlight } from '../types/highlights'
import { formatDistanceToNow } from 'date-fns' import { formatDistanceToNow } from 'date-fns'
import { useEventModel } from 'applesauce-react/hooks' import { useEventModel } from 'applesauce-react/hooks'
@@ -101,6 +101,15 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({ highlight, onSelec
</> </>
)} )}
{highlight.isOfflineCreated && (
<>
<span className="highlight-meta-separator"></span>
<span className="highlight-offline-indicator" title="Created while in flight mode">
<FontAwesomeIcon icon={faPlane} />
</span>
</>
)}
{sourceLink && ( {sourceLink && (
<a <a
href={sourceLink} href={sourceLink}

View File

@@ -1623,6 +1623,14 @@ body {
border: 1px solid rgba(245, 158, 11, 0.3); border: 1px solid rgba(245, 158, 11, 0.3);
} }
.highlight-offline-indicator {
display: inline-flex;
align-items: center;
color: #fbbf24;
font-size: 0.8rem;
opacity: 0.8;
}
.highlight-local-text { .highlight-local-text {
font-size: 0.75rem; font-size: 0.75rem;
text-transform: uppercase; text-transform: uppercase;

View File

@@ -152,6 +152,7 @@ export async function createHighlight(
const highlight = eventToHighlight(signedEvent) const highlight = eventToHighlight(signedEvent)
highlight.publishedRelays = actualPublishedRelays highlight.publishedRelays = actualPublishedRelays
highlight.isLocalOnly = isLocalOnly highlight.isLocalOnly = isLocalOnly
highlight.isOfflineCreated = isLocalOnly // Mark as created offline if local-only
// Return the highlight for immediate UI updates // Return the highlight for immediate UI updates
return highlight return highlight

View File

@@ -18,5 +18,6 @@ export interface Highlight {
// Relay tracking for offline/local-only highlights // Relay tracking for offline/local-only highlights
publishedRelays?: string[] // URLs of relays that acknowledged this event publishedRelays?: string[] // URLs of relays that acknowledged this event
isLocalOnly?: boolean // true if only published to local relays isLocalOnly?: boolean // true if only published to local relays
isOfflineCreated?: boolean // true if created while in flight mode (offline)
} }