chore: fix initial loading indicator mobile
This commit is contained in:
@@ -11,4 +11,6 @@ export interface SyncClientInterface {
|
|||||||
getLastSyncDate(): Date | undefined
|
getLastSyncDate(): Date | undefined
|
||||||
|
|
||||||
getSyncStatus(): SyncOpStatus
|
getSyncStatus(): SyncOpStatus
|
||||||
|
|
||||||
|
completedOnlineDownloadFirstSync: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,11 @@ const ContentListHeader = ({
|
|||||||
const isTablet = matchesMd && isTouchScreen
|
const isTablet = matchesMd && isTouchScreen
|
||||||
|
|
||||||
const [syncSubtitle, setSyncSubtitle] = useState('')
|
const [syncSubtitle, setSyncSubtitle] = useState('')
|
||||||
const [completedInitialSync, setCompletedInitialSync] = useState(false)
|
|
||||||
const showSyncSubtitle = isMobileScreen && !!syncSubtitle
|
const showSyncSubtitle = isMobileScreen && !!syncSubtitle
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return application.addEventObserver(async (event) => {
|
return application.addEventObserver(async (event) => {
|
||||||
if (event === ApplicationEvent.CompletedInitialSync) {
|
if (event === ApplicationEvent.CompletedInitialSync) {
|
||||||
setCompletedInitialSync(true)
|
|
||||||
setSyncSubtitle('')
|
setSyncSubtitle('')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -69,7 +67,9 @@ const ContentListHeader = ({
|
|||||||
const { localDataDone, localDataCurrent, localDataTotal } = syncStatus.getStats()
|
const { localDataDone, localDataCurrent, localDataTotal } = syncStatus.getStats()
|
||||||
|
|
||||||
if (event === ApplicationEvent.SyncStatusChanged) {
|
if (event === ApplicationEvent.SyncStatusChanged) {
|
||||||
setSyncSubtitle(syncStatus.syncInProgress && !completedInitialSync ? 'Syncing...' : '')
|
setSyncSubtitle(
|
||||||
|
syncStatus.syncInProgress && !application.sync.completedOnlineDownloadFirstSync ? 'Syncing...' : '',
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ const ContentListHeader = ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, [application, completedInitialSync])
|
}, [application])
|
||||||
|
|
||||||
const [showDisplayOptionsMenu, setShowDisplayOptionsMenu] = useState(false)
|
const [showDisplayOptionsMenu, setShowDisplayOptionsMenu] = useState(false)
|
||||||
|
|
||||||
@@ -163,8 +163,8 @@ const ContentListHeader = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="flex min-w-0 flex-grow flex-col break-words">
|
<div className="flex min-w-0 flex-grow flex-col break-words">
|
||||||
<div className=" text-2xl font-semibold text-text md:text-lg">{panelTitle}</div>
|
<div className="text-2xl font-semibold text-text md:text-lg">{panelTitle}</div>
|
||||||
{showSyncSubtitle && <div className="text-xs text-passive-0">{syncSubtitle}</div>}
|
{showSyncSubtitle && <div className="-mt-1 text-xs text-passive-0 md:mt-0">{syncSubtitle}</div>}
|
||||||
{optionsSubtitle && <div className="text-xs text-passive-0">{optionsSubtitle}</div>}
|
{optionsSubtitle && <div className="text-xs text-passive-0">{optionsSubtitle}</div>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user