fix: remove duplicate clean-state sync action

Keep sync available only in the Git header
Simplify the clean working tree empty state
This commit is contained in:
Bohdan Triapitsyn
2026-05-06 01:31:23 +03:00
parent 0546de31f6
commit 9af3b49e7b
2 changed files with 3 additions and 43 deletions
+1 -12
View File
@@ -2241,18 +2241,7 @@ export const GitView: React.FC = () => {
/>
</>
) : (
<GitEmptyState
ahead={effectiveRemotes.length > 0 ? (status?.ahead ?? 0) : 0}
behind={effectiveRemotes.length > 0 ? (status?.behind ?? 0) : 0}
isSyncing={syncAction === 'sync'}
onSync={() => {
const remote = effectiveRemotes[0];
if (!remote) {
return;
}
void handleSyncAction('sync', remote);
}}
/>
<GitEmptyState />
)}
</div>
) : null}
@@ -1,23 +1,9 @@
import React from 'react';
import { RiGitCommitLine, RiRefreshLine, RiLoader4Line } from '@remixicon/react';
import { Button } from '@/components/ui/button';
import { RiGitCommitLine } from '@remixicon/react';
import { useI18n } from '@/lib/i18n';
interface GitEmptyStateProps {
ahead: number;
behind: number;
onSync: () => void;
isSyncing: boolean;
}
export const GitEmptyState: React.FC<GitEmptyStateProps> = ({
ahead,
behind,
onSync,
isSyncing,
}) => {
export const GitEmptyState: React.FC = () => {
const { t } = useI18n();
const hasSyncChanges = ahead > 0 || behind > 0;
return (
<div className="flex flex-col items-center justify-center py-10 px-4 text-center">
<RiGitCommitLine className="size-10 text-muted-foreground/70 mb-4" />
@@ -27,21 +13,6 @@ export const GitEmptyState: React.FC<GitEmptyStateProps> = ({
<p className="typography-meta text-muted-foreground mb-4">
{t('gitView.empty.cleanDescription')}
</p>
{hasSyncChanges && (
<Button
variant="default"
onClick={onSync}
disabled={isSyncing}
>
{isSyncing ? (
<RiLoader4Line className="size-4 animate-spin" />
) : (
<RiRefreshLine className="size-4" />
)}
{t('gitView.sync.syncCounts', { ahead, behind })}
</Button>
)}
</div>
);
};