Skip to content

Commit ff76174

Browse files
committed
Add pulse animations for loading sync-state values
1 parent 01a1b48 commit ff76174

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

frontend/viewer/src/app.postcss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
.app {
2727
@apply bg-background text-foreground;
2828
}
29+
30+
.loading-text {
31+
@apply bg-foreground/15 animate-pulse rounded-md text-transparent;
32+
}
2933
}
3034

3135
.font-inter {

frontend/viewer/src/lib/components/ui/format/format-relative-date.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
showActualDate?: boolean;
1515
actualDateOptions?: Intl.DateTimeFormatOptions;
1616
maxUnits?: number;
17+
loading?: boolean;
1718
};
1819
1920
const {
@@ -24,6 +25,7 @@
2425
showActualDate = false,
2526
actualDateOptions,
2627
maxUnits = 2,
28+
loading,
2729
...restProps
2830
}: Props = $props();
2931
@@ -60,7 +62,7 @@
6062
</script>
6163

6264
{#if showActualDate && actualFormattedDate}
63-
<span class="inline-flex items-center gap-1">
65+
<span class:loading-text={loading} class="inline-flex items-center gap-1">
6466
<time {...restProps}>{formattedRelativeDate}</time>
6567
<Popover.Root>
6668
<Popover.Trigger>
@@ -73,5 +75,5 @@
7375
</Popover.Root>
7476
</span>
7577
{:else}
76-
<time {...restProps}>{formattedRelativeDate}</time>
78+
<time class:loading-text={loading} {...restProps}>{formattedRelativeDate}</time>
7779
{/if}

frontend/viewer/src/project/sync/FwLiteToFwMergeDetails.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
const lastFwLiteSyncDate = $derived(remoteStatus?.lastCrdtCommitDate ? new Date(remoteStatus.lastCrdtCommitDate) : undefined);
3838
let lexboxToFlexCount = $derived(remoteStatus?.pendingCrdtChanges ?? '?');
3939
let flexToLexboxCount = $derived(remoteStatus?.pendingMercurialChanges ?? '?');
40+
let loading = $derived(remoteStatus === undefined);
4041
4142
function onSyncLexboxToFlex(flexToLexboxCount: number, lexboxToFlexCount: number) {
4243
loadingSyncLexboxToFlex = true;
@@ -55,6 +56,7 @@
5556
<FormatRelativeDate
5657
date={lastFwLiteSyncDate}
5758
showActualDate
59+
{loading}
5860
defaultValue={remoteStatus?.status === ProjectSyncStatusEnum.NeverSynced ? $t`Never` : $t`Unknown`}/>
5961
</T>
6062
</span>
@@ -68,7 +70,7 @@
6870
status={{loggedIn: false, server: server}}
6971
statusChange={s => onLoginStatusChange(s)}/>
7072
{:else}
71-
<span>{$t`${flexToLexboxCount} Commits`}</span>
73+
<span class:loading-text={loading}>{$t`${flexToLexboxCount} Commits`}</span>
7274
<SyncArrow dir="left" tailLength={120} size={1.25}/>
7375
<Button
7476
loading={loadingSyncLexboxToFlex}
@@ -80,7 +82,7 @@
8082
{$t`Sync`}
8183
</Button>
8284
<SyncArrow dir="right" tailLength={120} size={1.25}/>
83-
<span>{$t`${lexboxToFlexCount} Changes`}</span>
85+
<span class:loading-text={loading}>{$t`${lexboxToFlexCount} Commits`}</span>
8486
{/if}
8587
</div>
8688
<div class="border rounded flex flex-col items-center justify-center text-center p-2">
@@ -91,6 +93,7 @@
9193
<FormatRelativeDate
9294
date={lastFlexSyncDate}
9395
showActualDate
96+
{loading}
9497
defaultValue={remoteStatus?.status === ProjectSyncStatusEnum.NeverSynced ? $t`Never` : $t`Unknown`}/>
9598
</T>
9699
</span>

0 commit comments

Comments
 (0)