fix: clarify sync button and result toasts

Show sync label when no remote changes are known
Report pulled file counts in sync success toasts
Count pulled files correctly in VS Code sync
This commit is contained in:
Bohdan Triapitsyn
2026-05-05 23:53:21 +03:00
parent 93267927ff
commit 7b66bca2c5
9 changed files with 61 additions and 8 deletions
@@ -54,11 +54,16 @@ export const SyncActions: React.FC<SyncActionsProps> = ({
const blocksRebaseSync = behindCount > 0 && hasUncommittedChanges;
const isPrimaryDisabled = disabled || syncAction !== null || isRemovingRemote || !trackingRemote || blocksRebaseSync;
const isDropdownDisabled = disabled || syncAction !== null || isRemovingRemote || remotes.length === 0;
const countsLabel = t('gitView.sync.syncCounts', { ahead: aheadCount, behind: behindCount });
const hasKnownSyncWork = aheadCount > 0 || behindCount > 0;
const primaryLabel = hasKnownSyncWork
? t('gitView.sync.syncCounts', { ahead: aheadCount, behind: behindCount })
: t('gitView.sync.sync');
const tooltipLabel = blocksRebaseSync
? t('gitView.sync.commitOrStashTooltip')
: trackingRemote
? t('gitView.sync.syncChangesTooltip', { ahead: aheadCount, behind: behindCount })
? hasKnownSyncWork
? t('gitView.sync.syncChangesTooltip', { ahead: aheadCount, behind: behindCount })
: t('gitView.sync.syncChanges')
: t('gitView.sync.noRemoteTooltip');
const handleSync = () => {
@@ -87,7 +92,7 @@ export const SyncActions: React.FC<SyncActionsProps> = ({
) : (
<RiRefreshLine className="size-4" />
)}
<span className="whitespace-nowrap tabular-nums">{countsLabel}</span>
<span className="whitespace-nowrap tabular-nums">{primaryLabel}</span>
</button>
</TooltipTrigger>
<TooltipContent sideOffset={8}>{tooltipLabel}</TooltipContent>