feat: add stash access in clean git state

Show a Stashes button when the working tree is clean
Keep stash management available even without visible file changes
This commit is contained in:
Bohdan Triapitsyn
2026-05-06 15:13:38 +03:00
parent dbc06dd6fa
commit c9289eb24f
8 changed files with 29 additions and 5 deletions
+3 -3
View File
@@ -982,7 +982,7 @@ export const GitView: React.FC = () => {
} else if (pushedChanges) {
toast.success(t('gitView.toast.pushedToUpstream'));
} else {
toast.success(t('gitView.toast.syncedChanges'));
toast.success(t('gitView.toast.alreadyUpToDate'));
}
}
@@ -1104,7 +1104,7 @@ export const GitView: React.FC = () => {
} else if (pushedChanges) {
toast.success(t('gitView.toast.pushedToUpstream'));
} else {
toast.success(t('gitView.toast.syncedChanges'));
toast.success(t('gitView.toast.alreadyUpToDate'));
}
triggerFireworks();
@@ -2241,7 +2241,7 @@ export const GitView: React.FC = () => {
/>
</>
) : (
<GitEmptyState />
<GitEmptyState onOpenStashes={() => setIsStashesDialogOpen(true)} />
)}
</div>
) : null}
@@ -1,8 +1,13 @@
import React from 'react';
import { RiGitCommitLine } from '@remixicon/react';
import { RiArchiveStackLine, RiGitCommitLine } from '@remixicon/react';
import { Button } from '@/components/ui/button';
import { useI18n } from '@/lib/i18n';
export const GitEmptyState: React.FC = () => {
interface GitEmptyStateProps {
onOpenStashes?: () => void;
}
export const GitEmptyState: React.FC<GitEmptyStateProps> = ({ onOpenStashes }) => {
const { t } = useI18n();
return (
<div className="flex flex-col items-center justify-center py-10 px-4 text-center">
@@ -13,6 +18,19 @@ export const GitEmptyState: React.FC = () => {
<p className="typography-meta text-muted-foreground mb-4">
{t('gitView.empty.cleanDescription')}
</p>
{onOpenStashes ? (
<Button
type="button"
variant="outline"
size="sm"
onClick={onOpenStashes}
className="gap-1.5"
>
<RiArchiveStackLine className="size-4" />
{t('gitView.stashes.title')}
</Button>
) : null}
</div>
);
};
+1
View File
@@ -708,6 +708,7 @@ export const dict = {
'gitView.toast.pulledFilesSingle': 'Pulled {count} file from {name}',
'gitView.toast.pushedToUpstream': 'Pushed to upstream',
'gitView.toast.commitOrStashBeforeSync': 'Commit or stash your changes before syncing',
'gitView.toast.alreadyUpToDate': 'Already up to date',
'gitView.toast.syncedPulledPluralAndPushed': 'Pulled {count} files from {name} and pushed to upstream',
'gitView.toast.syncedPulledSingleAndPushed': 'Pulled {count} file from {name} and pushed to upstream',
'gitView.toast.syncedChanges': 'Synced changes',
+1
View File
@@ -709,6 +709,7 @@ export const dict: Record<I18nKey, string> = {
"gitView.toast.pulledFilesSingle": "Se trajo {count} archivo de {name}",
"gitView.toast.pushedToUpstream": "Enviado al upstream",
"gitView.toast.commitOrStashBeforeSync": "Haz commit o stash de tus cambios antes de sincronizar",
"gitView.toast.alreadyUpToDate": "Ya está actualizado",
"gitView.toast.syncedPulledPluralAndPushed": "Se trajeron {count} archivos de {name} y se envió al upstream",
"gitView.toast.syncedPulledSingleAndPushed": "Se trajo {count} archivo de {name} y se envió al upstream",
"gitView.toast.syncedChanges": "Cambios sincronizados",
+1
View File
@@ -709,6 +709,7 @@ export const dict: Record<I18nKey, string> = {
'gitView.toast.pulledFilesSingle': '{name}에서 파일 {count}개를 풀했습니다',
'gitView.toast.pushedToUpstream': '업스트림에 푸시했습니다',
'gitView.toast.commitOrStashBeforeSync': '동기화하기 전에 변경 사항을 커밋하거나 stash하세요',
'gitView.toast.alreadyUpToDate': '이미 최신 상태입니다',
'gitView.toast.syncedPulledPluralAndPushed': '{name}에서 파일 {count}개를 풀하고 업스트림에 푸시했습니다',
'gitView.toast.syncedPulledSingleAndPushed': '{name}에서 파일 {count}개를 풀하고 업스트림에 푸시했습니다',
'gitView.toast.syncedChanges': '변경 사항을 동기화했습니다',
@@ -709,6 +709,7 @@ export const dict: Record<I18nKey, string> = {
"gitView.toast.pulledFilesSingle": "Se trajo {count} arquivo de {name}",
"gitView.toast.pushedToUpstream": "Enviado ao upstream",
"gitView.toast.commitOrStashBeforeSync": "Faça commit ou stash das alterações antes de sincronizar",
"gitView.toast.alreadyUpToDate": "Já está atualizado",
"gitView.toast.syncedPulledPluralAndPushed": "Foram trazidos {count} arquivos de {name} e enviados ao upstream",
"gitView.toast.syncedPulledSingleAndPushed": "Foi trazido {count} arquivo de {name} e enviado ao upstream",
"gitView.toast.syncedChanges": "Alterações sincronizadas",
+1
View File
@@ -709,6 +709,7 @@ export const dict: Record<I18nKey, string> = {
"gitView.toast.pulledFilesSingle": "Отримано файл: {count} з {name}",
"gitView.toast.pushedToUpstream": "Надіслано в upstream",
"gitView.toast.commitOrStashBeforeSync": "Закомітьте або сховайте зміни перед синхронізацією",
"gitView.toast.alreadyUpToDate": "Вже актуально",
"gitView.toast.syncedPulledPluralAndPushed": "Отримано файлів: {count} з {name} і надіслано в upstream",
"gitView.toast.syncedPulledSingleAndPushed": "Отримано файл: {count} з {name} і надіслано в upstream",
"gitView.toast.syncedChanges": "Зміни синхронізовано",
@@ -709,6 +709,7 @@ export const dict: Record<I18nKey, string> = {
'gitView.toast.pulledFilesSingle': '已从 {name} 拉取 {count} 个文件',
'gitView.toast.pushedToUpstream': '已推送到上游',
'gitView.toast.commitOrStashBeforeSync': '同步前请先提交或储藏你的更改',
'gitView.toast.alreadyUpToDate': '已是最新状态',
'gitView.toast.syncedPulledPluralAndPushed': '已从 {name} 拉取 {count} 个文件并推送到上游',
'gitView.toast.syncedPulledSingleAndPushed': '已从 {name} 拉取 {count} 个文件并推送到上游',
'gitView.toast.syncedChanges': '已同步更改',