From f2e34ed9af5cad58df1abc10d402416e85235a4f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 24 Dec 2025 19:34:18 -0600 Subject: [PATCH] Display dot indicator where there are unsynced changes --- src/components/git-sync/GitSyncButton.tsx | 14 +++++++++--- src/components/git-sync/steps/SyncStep.tsx | 26 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/components/git-sync/GitSyncButton.tsx b/src/components/git-sync/GitSyncButton.tsx index 182c3597..450080da 100644 --- a/src/components/git-sync/GitSyncButton.tsx +++ b/src/components/git-sync/GitSyncButton.tsx @@ -20,9 +20,14 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { const originRemote = gitStatus?.remotes.find(r => r.name === 'origin'); const hasRemote = !!originRemote; + // Check for unsynced changes (ahead or behind remote) + const hasUnsyncedChanges = !isGitStatusLoading && hasRemote && gitStatus?.remoteBranchExists && ((gitStatus?.ahead ?? 0) > 0 || (gitStatus?.behind ?? 0) > 0); + // Determine if we need to show the indicator dot - // Show indicator if no origin remote is configured, UNLESS there are less than 2 commits - const showIndicator = !isGitStatusLoading && !hasRemote && (gitStatus?.totalCommits ?? 0) >= 2; + // Yellow indicator for unsynced changes takes precedence + // Purple indicator if no origin remote is configured, UNLESS there are less than 2 commits + const showYellowIndicator = hasUnsyncedChanges; + const showPurpleIndicator = !isGitStatusLoading && !hasRemote && (gitStatus?.totalCommits ?? 0) >= 2 && !showYellowIndicator; return ( @@ -34,7 +39,10 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { aria-label="Sync with Git" > - {showIndicator && ( + {showYellowIndicator && ( + + )} + {showPurpleIndicator && ( )} diff --git a/src/components/git-sync/steps/SyncStep.tsx b/src/components/git-sync/steps/SyncStep.tsx index afea7124..b682f013 100644 --- a/src/components/git-sync/steps/SyncStep.tsx +++ b/src/components/git-sync/steps/SyncStep.tsx @@ -314,6 +314,32 @@ export function SyncStep({ projectId, remoteUrl }: SyncStepProps) { /> )} + {/* Unsynced changes notification */} + {gitStatus?.remoteBranchExists && ((gitStatus?.ahead ?? 0) > 0 || (gitStatus?.behind ?? 0) > 0) && !error && ( +
+
+
+
+

+ This branch is{' '} + {(gitStatus?.ahead ?? 0) > 0 && ( + <> + {gitStatus.ahead} commit{gitStatus.ahead !== 1 ? 's' : ''} ahead of + {(gitStatus?.behind ?? 0) > 0 ? ' and ' : ' '} + + )} + {(gitStatus?.behind ?? 0) > 0 && ( + <> + {gitStatus.behind} commit{gitStatus.behind !== 1 ? 's' : ''} behind{' '} + + )} + {ref} on {remoteName}. +

+
+
+
+ )} +