fix(git): clean up in-progress merge/rebase banner
Use the real status-warning tokens (--status-warning-bg did not exist, so the card rendered without a fill), drop the decorative icons, and fold the conflict count into the title as a single full-message key per locale. The operation description now wraps instead of truncating, and both the conflict and ready-to-continue states share the same action layout.
This commit is contained in:
@@ -2019,14 +2019,14 @@ export const GitView: React.FC<GitViewProps> = ({ isActive }) => {
|
||||
}
|
||||
}, [currentDirectory, git, conflictOperation, refreshStatusAndBranches, refreshLog, clearConflictState, t]);
|
||||
|
||||
// Check if there are unresolved conflicts (files with 'U' status)
|
||||
const hasUnresolvedConflicts = React.useMemo(() => {
|
||||
if (!status?.files) return false;
|
||||
return status.files.some((f) =>
|
||||
// Count unresolved conflicts (files with 'U' status)
|
||||
const conflictCount = React.useMemo(() => {
|
||||
if (!status?.files) return 0;
|
||||
return status.files.filter((f) =>
|
||||
(f.index === 'U' || f.working_dir === 'U') ||
|
||||
(f.index === 'A' && f.working_dir === 'A') ||
|
||||
(f.index === 'D' && f.working_dir === 'D')
|
||||
);
|
||||
).length;
|
||||
}, [status?.files]);
|
||||
|
||||
const handleContinueOperation = React.useCallback(async () => {
|
||||
@@ -2350,7 +2350,7 @@ export const GitView: React.FC<GitViewProps> = ({ isActive }) => {
|
||||
onContinue={handleContinueOperation}
|
||||
onAbort={handleAbortOperation}
|
||||
onResolveWithAI={handleResolveWithAIFromBanner}
|
||||
hasUnresolvedConflicts={hasUnresolvedConflicts}
|
||||
conflictCount={conflictCount}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -10,7 +10,7 @@ interface InProgressOperationBannerProps {
|
||||
onContinue: () => Promise<void>;
|
||||
onAbort: () => Promise<void>;
|
||||
onResolveWithAI?: () => void;
|
||||
hasUnresolvedConflicts?: boolean;
|
||||
conflictCount?: number;
|
||||
isLoading?: boolean;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export const InProgressOperationBanner: React.FC<InProgressOperationBannerProps>
|
||||
onContinue,
|
||||
onAbort,
|
||||
onResolveWithAI,
|
||||
hasUnresolvedConflicts = false,
|
||||
conflictCount = 0,
|
||||
isLoading = false,
|
||||
}) => {
|
||||
const { t } = useI18n();
|
||||
@@ -30,7 +30,7 @@ export const InProgressOperationBanner: React.FC<InProgressOperationBannerProps>
|
||||
const hasMergeInProgress = mergeInProgress && mergeInProgress.head;
|
||||
const hasRebaseInProgress = rebaseInProgress && (rebaseInProgress.headName || rebaseInProgress.onto);
|
||||
const operation = hasMergeInProgress ? 'merge' : hasRebaseInProgress ? 'rebase' : null;
|
||||
|
||||
|
||||
if (!operation) {
|
||||
return null;
|
||||
}
|
||||
@@ -54,54 +54,52 @@ export const InProgressOperationBanner: React.FC<InProgressOperationBannerProps>
|
||||
};
|
||||
|
||||
const isProcessing = processingAction !== null;
|
||||
const hasUnresolvedConflicts = conflictCount > 0;
|
||||
|
||||
const operationLabel = operation === 'merge' ? t('gitView.operation.merge') : t('gitView.operation.rebase');
|
||||
const operationIconName = operation === 'merge' ? 'git-merge' : 'git-branch';
|
||||
|
||||
// Build description
|
||||
let description = '';
|
||||
if (mergeInProgress) {
|
||||
description = mergeInProgress.message
|
||||
description = mergeInProgress.message
|
||||
? t('gitView.operation.mergingMessage', { message: mergeInProgress.message })
|
||||
: t('gitView.operation.mergeInProgressWithHead', { head: mergeInProgress.head });
|
||||
} else if (rebaseInProgress) {
|
||||
description = rebaseInProgress.headName
|
||||
description = rebaseInProgress.headName
|
||||
? t('gitView.operation.rebasingOnto', { headName: rebaseInProgress.headName, onto: rebaseInProgress.onto || '' })
|
||||
: t('gitView.operation.rebaseInProgress');
|
||||
}
|
||||
|
||||
const title = !hasUnresolvedConflicts
|
||||
? t('gitView.operation.inProgressTitle', { operation: operationLabel })
|
||||
: conflictCount === 1
|
||||
? t('gitView.operation.inProgressTitleOneConflict', { operation: operationLabel, count: conflictCount })
|
||||
: t('gitView.operation.inProgressTitleManyConflicts', { operation: operationLabel, count: conflictCount });
|
||||
|
||||
const hint = hasUnresolvedConflicts
|
||||
? t('gitView.operation.resolveConflictsHint')
|
||||
: t('gitView.operation.readyToContinueHint');
|
||||
|
||||
return (
|
||||
<div className="bg-[var(--status-warning-bg)] border border-[var(--status-warning)] rounded-lg p-3 mx-3 mt-3">
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex items-start gap-2 min-w-0">
|
||||
<Icon name={operationIconName} className="size-4 text-[var(--status-warning)] shrink-0" />
|
||||
<div className="min-w-0">
|
||||
<p className="typography-label text-[var(--status-warning)]">
|
||||
{t('gitView.operation.inProgressTitle', { operation: operationLabel })}
|
||||
<div className="mx-4 mt-3 overflow-hidden rounded-lg border border-[var(--status-warning-border)]">
|
||||
<div className="flex flex-col gap-3 p-3">
|
||||
<div className="min-w-0">
|
||||
<p className="typography-label text-[var(--status-warning)]">
|
||||
{title}
|
||||
</p>
|
||||
{description && (
|
||||
<p className="typography-micro break-words text-muted-foreground">
|
||||
{description}
|
||||
</p>
|
||||
{description && (
|
||||
<p className="typography-micro text-muted-foreground truncate">
|
||||
{description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{hasUnresolvedConflicts && onResolveWithAI && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={onResolveWithAI}
|
||||
disabled={isProcessing || isLoading}
|
||||
className="gap-1.5"
|
||||
>
|
||||
<Icon name="sparkling" className="size-4" />
|
||||
{t('gitView.operation.resolveWithAi')}
|
||||
</Button>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p className="typography-micro min-w-0 flex-1 text-muted-foreground">
|
||||
{hint}
|
||||
</p>
|
||||
|
||||
{processingAction !== 'continue' && (
|
||||
<div className="flex shrink-0 items-center gap-1.5">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
@@ -116,31 +114,36 @@ export const InProgressOperationBanner: React.FC<InProgressOperationBannerProps>
|
||||
)}
|
||||
{t('gitView.operation.abort')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{!hasUnresolvedConflicts && (
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
onClick={handleContinue}
|
||||
disabled={isProcessing || isLoading}
|
||||
className="gap-1.5"
|
||||
>
|
||||
{processingAction === 'continue' ? (
|
||||
<Icon name="loader-4" className="size-4 animate-spin" />
|
||||
) : (
|
||||
<Icon name="check" className="size-4" />
|
||||
{hasUnresolvedConflicts
|
||||
? onResolveWithAI && (
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
onClick={onResolveWithAI}
|
||||
disabled={isProcessing || isLoading}
|
||||
>
|
||||
{t('gitView.operation.resolveWithAi')}
|
||||
</Button>
|
||||
)
|
||||
: (
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
onClick={handleContinue}
|
||||
disabled={isProcessing || isLoading}
|
||||
className="gap-1.5"
|
||||
>
|
||||
{processingAction === 'continue' ? (
|
||||
<Icon name="loader-4" className="size-4 animate-spin" />
|
||||
) : (
|
||||
<Icon name="check" className="size-4" />
|
||||
)}
|
||||
{t('gitView.operation.continue')}
|
||||
</Button>
|
||||
)}
|
||||
{t('gitView.operation.continue')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{hasUnresolvedConflicts && (
|
||||
<p className="typography-micro text-[var(--status-warning)]">
|
||||
{t('gitView.operation.resolveConflictsHint')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -833,12 +833,15 @@ export const dict = {
|
||||
'gitView.operation.abort': 'Abort',
|
||||
'gitView.operation.continue': 'Continue',
|
||||
'gitView.operation.inProgressTitle': '{operation} in progress',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} in progress: {count} conflicts',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} in progress: {count} conflict',
|
||||
'gitView.operation.merge': 'Merge',
|
||||
'gitView.operation.mergeInProgressWithHead': 'Merging {head}',
|
||||
'gitView.operation.mergingMessage': 'Merging: {message}',
|
||||
'gitView.operation.rebase': 'Rebase',
|
||||
'gitView.operation.rebaseInProgress': 'Rebase in progress',
|
||||
'gitView.operation.rebasingOnto': 'Rebasing {headName} onto {onto}',
|
||||
'gitView.operation.readyToContinueHint': 'All conflicts resolved. Continue to finish the operation.',
|
||||
'gitView.operation.resolveConflictsHint': 'Resolve conflicts, then continue the operation.',
|
||||
'gitView.operation.resolveWithAi': 'Resolve with AI',
|
||||
'gitView.stash.confirmButton': '{operation}',
|
||||
|
||||
@@ -834,12 +834,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
"gitView.operation.abort": "Abortar",
|
||||
"gitView.operation.continue": "Continuar",
|
||||
"gitView.operation.inProgressTitle": "{operation} en progreso",
|
||||
"gitView.operation.inProgressTitleManyConflicts": "{operation} en curso: {count} conflictos",
|
||||
"gitView.operation.inProgressTitleOneConflict": "{operation} en curso: {count} conflicto",
|
||||
"gitView.operation.merge": "Merge",
|
||||
"gitView.operation.mergeInProgressWithHead": "Haciendo merge de {head}",
|
||||
"gitView.operation.mergingMessage": "Haciendo merge: {message}",
|
||||
"gitView.operation.rebase": "Rebase",
|
||||
"gitView.operation.rebaseInProgress": "Rebase en progreso",
|
||||
"gitView.operation.rebasingOnto": "Haciendo rebase de {headName} sobre {onto}",
|
||||
"gitView.operation.readyToContinueHint": "Todos los conflictos están resueltos. Continúa para finalizar la operación.",
|
||||
"gitView.operation.resolveConflictsHint": "Resuelve los conflictos y luego continúa la operación.",
|
||||
"gitView.operation.resolveWithAi": "Resolver con IA",
|
||||
"gitView.stash.confirmButton": "Guardar cambios y continuar",
|
||||
|
||||
@@ -661,12 +661,15 @@ export const dict = {
|
||||
'gitView.operation.abort': 'Avorter',
|
||||
'gitView.operation.continue': 'Continuer',
|
||||
'gitView.operation.inProgressTitle': '{operation} en cours',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} en cours : {count} conflits',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} en cours : {count} conflit',
|
||||
'gitView.operation.merge': 'Fusionner',
|
||||
'gitView.operation.mergeInProgressWithHead': 'Fusion de {head}',
|
||||
'gitView.operation.mergingMessage': 'Fusion : {message}',
|
||||
'gitView.operation.rebase': 'Rebase',
|
||||
'gitView.operation.rebaseInProgress': 'Rebase en cours',
|
||||
'gitView.operation.rebasingOnto': 'Rebaser {headName} sur {onto}',
|
||||
'gitView.operation.readyToContinueHint': 'Tous les conflits sont résolus. Poursuivez pour terminer l’opération.',
|
||||
'gitView.operation.resolveConflictsHint': 'Résolvez les conflits, puis poursuivez l\'opération.',
|
||||
'gitView.operation.resolveWithAi': 'Résoudre avec l\'IA',
|
||||
'gitView.stash.confirmButton': 'Confirmer',
|
||||
|
||||
@@ -830,12 +830,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
'gitView.operation.abort': '中止',
|
||||
'gitView.operation.continue': '続行',
|
||||
'gitView.operation.inProgressTitle': '{operation}進行中',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} 進行中: 競合 {count} 件',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} 進行中: 競合 {count} 件',
|
||||
'gitView.operation.merge': 'マージ',
|
||||
'gitView.operation.mergeInProgressWithHead': '{head}をマージ中',
|
||||
'gitView.operation.mergingMessage': 'マージ中: {message}',
|
||||
'gitView.operation.rebase': 'リベース',
|
||||
'gitView.operation.rebaseInProgress': 'リベース進行中',
|
||||
'gitView.operation.rebasingOnto': '{headName}を{onto}にリベース中',
|
||||
'gitView.operation.readyToContinueHint': 'すべての競合が解決されました。続行して操作を完了してください。',
|
||||
'gitView.operation.resolveConflictsHint': '競合を解決してから操作を続行してください。',
|
||||
'gitView.operation.resolveWithAi': 'AIで解決',
|
||||
'gitView.stash.confirmButton': '{operation}',
|
||||
|
||||
@@ -834,12 +834,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
'gitView.operation.abort': '중단',
|
||||
'gitView.operation.continue': '계속',
|
||||
'gitView.operation.inProgressTitle': '{operation} 진행 중',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} 진행 중: 충돌 {count}개',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} 진행 중: 충돌 {count}개',
|
||||
'gitView.operation.merge': '병합',
|
||||
'gitView.operation.mergeInProgressWithHead': '{head} 병합 진행 중',
|
||||
'gitView.operation.mergingMessage': '병합 중: {message}',
|
||||
'gitView.operation.rebase': '리베이스',
|
||||
'gitView.operation.rebaseInProgress': '리베이스 진행 중',
|
||||
'gitView.operation.rebasingOnto': '{headName}을(를) {onto} 위로 리베이스 중',
|
||||
'gitView.operation.readyToContinueHint': '모든 충돌이 해결되었습니다. 계속하여 작업을 완료하세요.',
|
||||
'gitView.operation.resolveConflictsHint': '충돌을 해결한 뒤 작업을 계속하세요.',
|
||||
'gitView.operation.resolveWithAi': 'AI로 해결',
|
||||
'gitView.stash.confirmButton': '확인',
|
||||
|
||||
@@ -2023,12 +2023,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
'gitView.operation.abort': 'Przerwij',
|
||||
'gitView.operation.continue': 'Kontynuuj',
|
||||
'gitView.operation.inProgressTitle': 'Operacja w toku',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} w toku: {count} konfliktów',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} w toku: {count} konflikt',
|
||||
'gitView.operation.merge': 'Scal',
|
||||
'gitView.operation.mergeInProgressWithHead': 'Trwa scalanie z HEAD',
|
||||
'gitView.operation.mergingMessage': 'Trwa scalanie',
|
||||
'gitView.operation.rebase': 'Rebase',
|
||||
'gitView.operation.rebaseInProgress': 'Trwa rebase',
|
||||
'gitView.operation.rebasingOnto': 'Wykonywanie rebase na',
|
||||
'gitView.operation.readyToContinueHint': 'Wszystkie konflikty rozwiązane. Kontynuuj, aby zakończyć operację.',
|
||||
'gitView.operation.resolveConflictsHint': 'Rozwiąż konflikty, aby kontynuować.',
|
||||
'gitView.operation.resolveWithAi': 'Rozwiąż za pomocą AI',
|
||||
'gitView.pr.actions.add': 'Dodaj',
|
||||
|
||||
@@ -834,12 +834,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
"gitView.operation.abort": "Abortar",
|
||||
"gitView.operation.continue": "Continuar",
|
||||
"gitView.operation.inProgressTitle": "{operation} em andamento",
|
||||
"gitView.operation.inProgressTitleManyConflicts": "{operation} em andamento: {count} conflitos",
|
||||
"gitView.operation.inProgressTitleOneConflict": "{operation} em andamento: {count} conflito",
|
||||
"gitView.operation.merge": "Merge",
|
||||
"gitView.operation.mergeInProgressWithHead": "Fazendo merge de {head}",
|
||||
"gitView.operation.mergingMessage": "Fazendo merge: {message}",
|
||||
"gitView.operation.rebase": "Rebase",
|
||||
"gitView.operation.rebaseInProgress": "Rebase em andamento",
|
||||
"gitView.operation.rebasingOnto": "Fazendo rebase de {headName} sobre {onto}",
|
||||
"gitView.operation.readyToContinueHint": "Todos os conflitos foram resolvidos. Continue para finalizar a operação.",
|
||||
"gitView.operation.resolveConflictsHint": "Resolva os conflitos e depois continue a operação.",
|
||||
"gitView.operation.resolveWithAi": "Resolver com IA",
|
||||
"gitView.stash.confirmButton": "Salvar alterações e continuar",
|
||||
|
||||
@@ -834,12 +834,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
"gitView.operation.abort": "Перервати",
|
||||
"gitView.operation.continue": "Продовжити",
|
||||
"gitView.operation.inProgressTitle": "Виконується {operation}",
|
||||
"gitView.operation.inProgressTitleManyConflicts": "{operation} у процесі: {count} конфліктів",
|
||||
"gitView.operation.inProgressTitleOneConflict": "{operation} у процесі: {count} конфлікт",
|
||||
"gitView.operation.merge": "Злити",
|
||||
"gitView.operation.mergeInProgressWithHead": "Виконується злиття з {head}",
|
||||
"gitView.operation.mergingMessage": "Виконується злиття: {message}",
|
||||
"gitView.operation.rebase": "Перебазувати",
|
||||
"gitView.operation.rebaseInProgress": "Виконується перебазування",
|
||||
"gitView.operation.rebasingOnto": "Перебазування {headName} на {onto}",
|
||||
"gitView.operation.readyToContinueHint": "Усі конфлікти вирішено. Продовжте, щоб завершити операцію.",
|
||||
"gitView.operation.resolveConflictsHint": "Вирішіть конфлікти, потім продовжіть операцію.",
|
||||
"gitView.operation.resolveWithAi": "Вирішити за допомогою ШІ",
|
||||
"gitView.stash.confirmButton": "Підтвердити",
|
||||
|
||||
@@ -834,12 +834,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
'gitView.operation.abort': '中止',
|
||||
'gitView.operation.continue': '继续',
|
||||
'gitView.operation.inProgressTitle': '{operation} 进行中',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} 进行中:{count} 个冲突',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} 进行中:{count} 个冲突',
|
||||
'gitView.operation.merge': '合并',
|
||||
'gitView.operation.mergeInProgressWithHead': '合并进行中({head})',
|
||||
'gitView.operation.mergingMessage': '正在合并:{message}',
|
||||
'gitView.operation.rebase': '变基',
|
||||
'gitView.operation.rebaseInProgress': '变基进行中',
|
||||
'gitView.operation.rebasingOnto': '正在将 {headName} 变基到 {onto}',
|
||||
'gitView.operation.readyToContinueHint': '所有冲突已解决。继续以完成操作。',
|
||||
'gitView.operation.resolveConflictsHint': '解决冲突,然后继续操作。',
|
||||
'gitView.operation.resolveWithAi': '使用 AI 解决',
|
||||
'gitView.stash.confirmButton': '储藏并{operation}',
|
||||
|
||||
@@ -846,12 +846,15 @@ export const dict: Record<I18nKey, string> = {
|
||||
'gitView.operation.abort': '中止',
|
||||
'gitView.operation.continue': '繼續',
|
||||
'gitView.operation.inProgressTitle': '{operation} 進行中',
|
||||
'gitView.operation.inProgressTitleManyConflicts': '{operation} 進行中:{count} 個衝突',
|
||||
'gitView.operation.inProgressTitleOneConflict': '{operation} 進行中:{count} 個衝突',
|
||||
'gitView.operation.merge': '合併',
|
||||
'gitView.operation.mergeInProgressWithHead': '合併進行中({head})',
|
||||
'gitView.operation.mergingMessage': '正在合併:{message}',
|
||||
'gitView.operation.rebase': 'Rebase',
|
||||
'gitView.operation.rebaseInProgress': 'Rebase 進行中',
|
||||
'gitView.operation.rebasingOnto': '正在將 {headName} Rebase 到 {onto}',
|
||||
'gitView.operation.readyToContinueHint': '所有衝突已解決。繼續以完成操作。',
|
||||
'gitView.operation.resolveConflictsHint': '解決衝突,然後繼續操作。',
|
||||
'gitView.operation.resolveWithAi': '使用 AI 解決',
|
||||
'gitView.stash.confirmButton': 'Stash 並 {operation}',
|
||||
|
||||
Reference in New Issue
Block a user