import React, { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { faTrash } from '@fortawesome/free-solid-svg-icons' import { UserSettings } from '../../services/settingsService' import { getImageCacheStatsAsync, clearImageCache } from '../../services/imageCacheService' import IconButton from '../IconButton' interface OfflineModeSettingsProps { settings: UserSettings onUpdate: (updates: Partial) => void onClose?: () => void } const OfflineModeSettings: React.FC = ({ settings, onUpdate, onClose }) => { const navigate = useNavigate() const [cacheStats, setCacheStats] = useState<{ totalSizeMB: number itemCount: number items: Array<{ url: string, sizeMB: number }> }>({ totalSizeMB: 0, itemCount: 0, items: [] }) const handleLinkClick = (url: string) => { if (onClose) onClose() navigate(`/r/${encodeURIComponent(url)}`) } const handleClearCache = async () => { if (confirm('Are you sure you want to clear all cached images?')) { await clearImageCache() const stats = await getImageCacheStatsAsync() setCacheStats(stats) } } // Update cache stats periodically useEffect(() => { const updateStats = async () => { const stats = await getImageCacheStatsAsync() setCacheStats(stats) } updateStats() // Initial load const interval = setInterval(updateStats, 3000) // Update every 3 seconds return () => clearInterval(interval) }, []) return (

Flight Mode

{(settings.enableImageCache ?? true) && (
( {cacheStats.totalSizeMB.toFixed(1)} MB / onUpdate({ imageCacheSizeMB: parseInt(e.target.value) || 210 })} style={{ width: '50px', padding: '0.15rem 0.35rem', background: 'var(--surface-secondary)', border: '1px solid var(--border-color, #333)', borderRadius: '4px', color: 'inherit', fontSize: 'inherit', fontFamily: 'inherit', textAlign: 'center' }} /> MB used )
)}

Boris works best with a local relay. Consider running{' '} Citrine {' or '} nostr-relay-tray . Don't know what relays are? Learn more{' '} { e.preventDefault() handleLinkClick('https://nostr.how/en/relays') }} style={{ color: 'var(--accent, #8b5cf6)', cursor: 'pointer' }} > here {' and '} { e.preventDefault() handleLinkClick('https://davidebtc186.substack.com/p/the-importance-of-hosting-your-own') }} style={{ color: 'var(--accent, #8b5cf6)', cursor: 'pointer' }} > here .

) } export default OfflineModeSettings