aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-09 22:35:27 +0800
committercrupest <crupest@outlook.com>2020-08-09 22:35:27 +0800
commita69514dbef806bf1ee531cac3a7a9fee18162f2b (patch)
treeedc39923ae2f4ee7a04849ef9d6c49bddd636789 /Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
parente9ae7fb738546edc235ada011699895b665b4d53 (diff)
downloadtimeline-a69514dbef806bf1ee531cac3a7a9fee18162f2b.tar.gz
timeline-a69514dbef806bf1ee531cac3a7a9fee18162f2b.tar.bz2
timeline-a69514dbef806bf1ee531cac3a7a9fee18162f2b.zip
Refactor timeline observable.
Diffstat (limited to 'Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx')
-rw-r--r--Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
index 70507988..18b3323d 100644
--- a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
+++ b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
@@ -24,7 +24,7 @@ import Timeline, {
import AppBar from '../common/AppBar';
import TimelinePostEdit, { TimelinePostSendCallback } from './TimelinePostEdit';
-type TimelinePostSyncState = 'cache' | 'syncing' | 'synced' | 'offline';
+type TimelinePostSyncState = 'syncing' | 'synced' | 'offline';
const TimelinePostSyncStateBadge: React.FC<{
state: TimelinePostSyncState;
@@ -37,7 +37,6 @@ const TimelinePostSyncStateBadge: React.FC<{
<div style={style} className={clsx('timeline-sync-state-badge', className)}>
{(() => {
switch (state) {
- case 'cache':
case 'syncing': {
return (
<>
@@ -226,11 +225,17 @@ export default function TimelinePageTemplateUI<TManageItems>(
? 'calc(68px + 1.5em)'
: `${cardHeight + 60}px`;
+ const syncState: TimelinePostSyncState = postListState.syncing
+ ? 'syncing'
+ : postListState.type === 'synced'
+ ? 'synced'
+ : 'offline';
+
timelineBody = (
<div>
<TimelinePostSyncStateBadge
style={{ top: topHeight }}
- state={postListState.type}
+ state={syncState}
/>
<Timeline
containerRef={timelineRef}