From ab1937226f88c18f82456bcd0eff0a7a87ffda29 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Fri, 30 Jun 2023 23:22:01 +0530 Subject: [PATCH] chore: make "potentially out of sync" warning more visible on mobile --- .../Header/ContentListHeader.tsx | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx b/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx index 3c819ae12..5287aa611 100644 --- a/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx @@ -55,7 +55,8 @@ const ContentListHeader = ({ const isTablet = matchesMd && isTouchScreen const [syncSubtitle, setSyncSubtitle] = useState('') - const showSyncSubtitle = isMobileScreen && !!syncSubtitle + const [outOfSync, setOutOfSync] = useState(false) + const showSyncSubtitle = isMobileScreen && (!!syncSubtitle || outOfSync) useEffect(() => { return application.addEventObserver(async (event) => { @@ -64,6 +65,16 @@ const ContentListHeader = ({ return } + if (event === ApplicationEvent.EnteredOutOfSync) { + setOutOfSync(true) + return + } + + if (event === ApplicationEvent.ExitedOutOfSync) { + setOutOfSync(false) + return + } + const syncStatus = application.sync.getSyncStatus() const { localDataDone, localDataCurrent, localDataTotal } = syncStatus.getStats() @@ -165,14 +176,18 @@ const ContentListHeader = ({ )}
{panelTitle}
- {showSyncSubtitle &&
{syncSubtitle}
} + {showSyncSubtitle && ( +
+ {outOfSync ? 'Potentially Out of Sync' : syncSubtitle} +
+ )} {optionsSubtitle &&
{optionsSubtitle}
}
) - }, [optionsSubtitle, selectedTag, showSyncSubtitle, icon, panelTitle, syncSubtitle]) + }, [optionsSubtitle, showSyncSubtitle, icon, panelTitle, outOfSync, syncSubtitle, selectedTag]) const PhoneAndDesktopLayout = useMemo(() => { return (