|
30 | 30 | loadingSyncLexboxToFlex: boolean, |
31 | 31 | loadingSyncLexboxToLocal: boolean, |
32 | 32 | canSyncLexboxToFlex?: boolean, |
33 | | - syncLexboxToFlex?: () => Promise<void> |
| 33 | + syncLexboxToFlex?: (flexToLexboxCount: number, lexboxToFlexCount: number) => Promise<void> |
34 | 34 | onLoginStatusChange?: (status: 'logged-in' | 'logged-out') => void; |
35 | 35 | } = $props(); |
36 | 36 | const lastFlexSyncDate = $derived(remoteStatus?.lastMercurialCommitDate ? new Date(remoteStatus.lastMercurialCommitDate) : undefined); |
37 | 37 | const lastFwLiteSyncDate = $derived(remoteStatus?.lastCrdtCommitDate ? new Date(remoteStatus.lastCrdtCommitDate) : undefined); |
38 | 38 | let lexboxToFlexCount = $derived(remoteStatus?.pendingCrdtChanges ?? '?'); |
39 | 39 | let flexToLexboxCount = $derived(remoteStatus?.pendingMercurialChanges ?? '?'); |
40 | 40 |
|
41 | | - function onSyncLexboxToFlex() { |
| 41 | + function onSyncLexboxToFlex(flexToLexboxCount: number, lexboxToFlexCount: number) { |
42 | 42 | loadingSyncLexboxToFlex = true; |
43 | | - void syncLexboxToFlex().finally(() => { |
| 43 | + void syncLexboxToFlex(flexToLexboxCount, lexboxToFlexCount).finally(() => { |
44 | 44 | loadingSyncLexboxToFlex = false; |
45 | 45 | }); |
46 | 46 | } |
|
72 | 72 | <SyncArrow dir="left" tailLength={120} size={1.25}/> |
73 | 73 | <Button |
74 | 74 | loading={loadingSyncLexboxToFlex} |
75 | | - disabled={loadingSyncLexboxToLocal || !canSyncLexboxToFlex || !remoteStatus} |
76 | | - onclick={onSyncLexboxToFlex} |
| 75 | + disabled={loadingSyncLexboxToLocal || !canSyncLexboxToFlex || !remoteStatus |
| 76 | + || (typeof flexToLexboxCount !== 'number' || typeof lexboxToFlexCount !== 'number')} |
| 77 | + onclick={() => onSyncLexboxToFlex(flexToLexboxCount as number, lexboxToFlexCount as number)} |
77 | 78 | icon="i-mdi-sync" |
78 | 79 | iconProps={{ class: 'size-5' }}> |
79 | 80 | {$t`Sync`} |
|
0 commit comments