diff --git a/components/SyncProgressBar.tsx b/components/SyncProgressBar.tsx index 8131f5f..9f95ee3 100644 --- a/components/SyncProgressBar.tsx +++ b/components/SyncProgressBar.tsx @@ -11,10 +11,6 @@ export function SyncProgressBar(): React.ReactElement | null { const [lastSyncDate, setLastSyncDate] = useState(null) const [totalDays, setTotalDays] = useState(0) - useEffect(() => { - void loadSyncStatus() - }, []) - async function loadSyncStatus(): Promise { try { const state = nostrAuthService.getState() @@ -28,12 +24,6 @@ export function SyncProgressBar(): React.ReactElement | null { setLastSyncDate(storedLastSyncDate) setTotalDays(days) - - // If everything is synced (no days to sync), don't show the progress bar - if (days === 0 && storedLastSyncDate >= currentTimestamp) { - setSyncProgress(null) - - } } catch (error) { console.error('Error loading sync status:', error) } @@ -66,21 +56,14 @@ export function SyncProgressBar(): React.ReactElement | null { } } - // Don't show if not connected or if everything is synced + // Don't show if not connected const state = nostrAuthService.getState() if (!state.connected || !state.pubkey) { return null } - // If everything is synced, don't show the progress bar - if (totalDays === 0 && lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp()) { - return null - } - - // If sync is completed and no days to sync, don't show - if (syncProgress?.completed && totalDays === 0) { - return null - } + // Check if sync is recently completed (within last hour) + const isRecentlySynced = lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp() - 3600 const progressPercentage = syncProgress && syncProgress.totalSteps > 0 ? Math.min(100, (syncProgress.currentStep / syncProgress.totalSteps) * 100) @@ -108,7 +91,7 @@ export function SyncProgressBar(): React.ReactElement | null {

{t('settings.sync.title')}

- {!isSyncing && totalDays > 0 && ( + {!isSyncing && (