mirror of
https://github.com/dergigi/boris.git
synced 2026-01-08 09:24:42 +01:00
feat: improve relay status responsiveness for flight mode
- Reduce relay connection window from 20 minutes to 10 seconds - Change 'Recently Seen' section to 'Offline' with red styling - Use red circle icon for offline relays instead of gray - Poll relay status every 2 seconds in settings (faster feedback) - Poll relay status every 2 seconds in status indicator - Now when entering flight mode: - Local relay stays connected (green checkmark with plane icon) - All remote relays move to red 'Offline' section within 10 seconds - Status is highly responsive and clear
This commit is contained in:
@@ -10,7 +10,8 @@ interface RelayStatusIndicatorProps {
|
||||
}
|
||||
|
||||
export const RelayStatusIndicator: React.FC<RelayStatusIndicatorProps> = ({ relayPool }) => {
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 3000 })
|
||||
// Poll frequently for responsive local-only detection
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 2000 })
|
||||
|
||||
if (!relayPool) return null
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ const Settings: React.FC<SettingsProps> = ({ settings, onSave, onClose, relayPoo
|
||||
const saveTimeoutRef = useRef<number | null>(null)
|
||||
const isLocallyUpdating = useRef(false)
|
||||
|
||||
const relayStatuses = useRelayStatus({ relayPool })
|
||||
// Poll more frequently in settings for responsive status updates
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 2000 })
|
||||
|
||||
useEffect(() => {
|
||||
// Don't update from external settings if we're currently making local changes
|
||||
|
||||
@@ -103,12 +103,12 @@ const RelaySettings: React.FC<RelaySettingsProps> = ({ relayStatuses, onClose })
|
||||
<h4 style={{
|
||||
fontSize: '0.85rem',
|
||||
fontWeight: 600,
|
||||
color: 'var(--text-secondary)',
|
||||
color: '#ef4444',
|
||||
marginBottom: '0.75rem',
|
||||
textTransform: 'uppercase',
|
||||
letterSpacing: '0.05em'
|
||||
}}>
|
||||
Recently Seen
|
||||
Offline
|
||||
</h4>
|
||||
<div className="relay-list">
|
||||
{recentRelays.map((relay) => (
|
||||
@@ -129,7 +129,7 @@ const RelaySettings: React.FC<RelaySettingsProps> = ({ relayStatuses, onClose })
|
||||
<FontAwesomeIcon
|
||||
icon={faCircle}
|
||||
style={{
|
||||
color: 'var(--text-tertiary, #6b7280)',
|
||||
color: '#ef4444',
|
||||
fontSize: '0.7rem'
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -6,7 +6,8 @@ export interface RelayStatus {
|
||||
lastSeen: number // timestamp
|
||||
}
|
||||
|
||||
const RECENT_CONNECTION_WINDOW = 20 * 60 * 1000 // 20 minutes
|
||||
// How long to show disconnected relays as "recently seen" before hiding them
|
||||
const RECENT_CONNECTION_WINDOW = 10 * 1000 // 10 seconds
|
||||
|
||||
// In-memory tracking of relay last seen times
|
||||
const relayLastSeen = new Map<string, number>()
|
||||
|
||||
Reference in New Issue
Block a user