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:
@@ -2241,18 +2241,7 @@ export const GitView: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<GitEmptyState
|
<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);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -1,23 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { RiGitCommitLine, RiRefreshLine, RiLoader4Line } from '@remixicon/react';
|
import { RiGitCommitLine } from '@remixicon/react';
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
|
|
||||||
interface GitEmptyStateProps {
|
export const GitEmptyState: React.FC = () => {
|
||||||
ahead: number;
|
|
||||||
behind: number;
|
|
||||||
onSync: () => void;
|
|
||||||
isSyncing: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GitEmptyState: React.FC<GitEmptyStateProps> = ({
|
|
||||||
ahead,
|
|
||||||
behind,
|
|
||||||
onSync,
|
|
||||||
isSyncing,
|
|
||||||
}) => {
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const hasSyncChanges = ahead > 0 || behind > 0;
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center justify-center py-10 px-4 text-center">
|
<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" />
|
<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">
|
<p className="typography-meta text-muted-foreground mb-4">
|
||||||
{t('gitView.empty.cleanDescription')}
|
{t('gitView.empty.cleanDescription')}
|
||||||
</p>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user