在提交区域添加“刷新”和“推送”右键快捷操作

This commit is contained in:
xintaofei
2026-03-21 20:48:04 +08:00
parent d9032f1c82
commit 8432475ca6
11 changed files with 79 additions and 20 deletions

View File

@@ -21,6 +21,7 @@ import {
GitBranchPlus,
GitCompare,
RefreshCw,
Upload,
} from "lucide-react"
import {
Commit,
@@ -82,6 +83,7 @@ import {
gitListAllBranches,
gitLog,
gitNewBranch,
openPushWindow,
} from "@/lib/tauri"
import type { GitBranchList, GitLogEntry, GitLogFileChange } from "@/lib/types"
import { toast } from "sonner"
@@ -1168,6 +1170,28 @@ export function GitLogTab() {
<GitCompare className="h-3.5 w-3.5" />
{tCommon("viewDiff")}
</ContextMenuItem>
<ContextMenuItem
onSelect={() => {
void fetchLog()
}}
>
<RefreshCw className="size-3.5" />
{tCommon("refresh")}
</ContextMenuItem>
<ContextMenuItem
onSelect={() => {
if (!folder) return
openPushWindow(folder.id).catch((err) => {
const msg = toErrorMessage(err)
toast.error(t("toasts.openPushWindowFailed"), {
description: msg,
})
})
}}
>
<Upload className="size-3.5" />
{tCommon("push")}
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
)
@@ -1180,8 +1204,23 @@ export function GitLogTab() {
void fetchLog()
}}
>
<RefreshCw className="size-3.5" />
{tCommon("refresh")}
</ContextMenuItem>
<ContextMenuItem
onSelect={() => {
if (!folder) return
openPushWindow(folder.id).catch((err) => {
const msg = toErrorMessage(err)
toast.error(t("toasts.openPushWindowFailed"), {
description: msg,
})
})
}}
>
<Upload className="size-3.5" />
{tCommon("push")}
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>

View File

@@ -678,7 +678,8 @@
"create": "إنشاء",
"createAndSwitch": "إنشاء والتبديل",
"openFile": "فتح الملف",
"viewDiff": "عرض Diff"
"viewDiff": "عرض Diff",
"push": "دفع..."
},
"modes": {
"conversation": "وضع المحادثة",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "تم إنشاء فرع جديد والتبديل إليه",
"newBranchFromCommit": "{name} (من {shortHash})",
"createBranchFailed": "فشل إنشاء الفرع"
"createBranchFailed": "فشل إنشاء الفرع",
"openPushWindowFailed": "فشل فتح نافذة الدفع"
},
"branchSelector": {
"selectBranchPlaceholder": "اختر فرعًا...",

View File

@@ -678,7 +678,8 @@
"create": "Erstellen",
"createAndSwitch": "Erstellen und wechseln",
"openFile": "Datei öffnen",
"viewDiff": "Diff anzeigen"
"viewDiff": "Diff anzeigen",
"push": "Pushen..."
},
"modes": {
"conversation": "Konversationsmodus",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "Neuen Branch erstellt und gewechselt",
"newBranchFromCommit": "{name} (aus {shortHash})",
"createBranchFailed": "Branch konnte nicht erstellt werden"
"createBranchFailed": "Branch konnte nicht erstellt werden",
"openPushWindowFailed": "Push-Fenster konnte nicht geöffnet werden"
},
"branchSelector": {
"selectBranchPlaceholder": "Branch auswählen...",

View File

@@ -678,7 +678,8 @@
"create": "Create",
"createAndSwitch": "Create and Switch",
"openFile": "Open File",
"viewDiff": "View Diff"
"viewDiff": "View Diff",
"push": "Push..."
},
"modes": {
"conversation": "Conversation Mode",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "Created and switched to new branch",
"newBranchFromCommit": "{name} (from {shortHash})",
"createBranchFailed": "Failed to create branch"
"createBranchFailed": "Failed to create branch",
"openPushWindowFailed": "Failed to open push window"
},
"branchSelector": {
"selectBranchPlaceholder": "Select branch...",

View File

@@ -678,7 +678,8 @@
"create": "Crear",
"createAndSwitch": "Crear y cambiar",
"openFile": "Abrir archivo",
"viewDiff": "Ver Diff"
"viewDiff": "Ver Diff",
"push": "Enviar..."
},
"modes": {
"conversation": "Modo conversación",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "Nueva rama creada y activada",
"newBranchFromCommit": "{name} (desde {shortHash})",
"createBranchFailed": "No se pudo crear la rama"
"createBranchFailed": "No se pudo crear la rama",
"openPushWindowFailed": "No se pudo abrir la ventana de envío"
},
"branchSelector": {
"selectBranchPlaceholder": "Seleccionar rama...",

View File

@@ -678,7 +678,8 @@
"create": "Créer",
"createAndSwitch": "Créer et basculer",
"openFile": "Ouvrir le fichier",
"viewDiff": "Voir le Diff"
"viewDiff": "Voir le Diff",
"push": "Pousser..."
},
"modes": {
"conversation": "Mode conversation",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "Nouvelle branche créée et activée",
"newBranchFromCommit": "{name} (depuis {shortHash})",
"createBranchFailed": "Échec de la création de la branche"
"createBranchFailed": "Échec de la création de la branche",
"openPushWindowFailed": "Échec de l'ouverture de la fenêtre de push"
},
"branchSelector": {
"selectBranchPlaceholder": "Sélectionner une branche...",

View File

@@ -678,7 +678,8 @@
"create": "作成",
"createAndSwitch": "作成して切り替え",
"openFile": "ファイルを開く",
"viewDiff": "差分を見る"
"viewDiff": "差分を見る",
"push": "プッシュ..."
},
"modes": {
"conversation": "会話モード",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "新しいブランチを作成して切り替えました",
"newBranchFromCommit": "{name}{shortHash} から)",
"createBranchFailed": "ブランチ作成に失敗しました"
"createBranchFailed": "ブランチ作成に失敗しました",
"openPushWindowFailed": "プッシュウィンドウを開けませんでした"
},
"branchSelector": {
"selectBranchPlaceholder": "ブランチを選択...",

View File

@@ -678,7 +678,8 @@
"create": "생성",
"createAndSwitch": "생성 후 전환",
"openFile": "파일 열기",
"viewDiff": "Diff 보기"
"viewDiff": "Diff 보기",
"push": "푸시..."
},
"modes": {
"conversation": "대화 모드",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "새 브랜치를 생성하고 전환했습니다",
"newBranchFromCommit": "{name} ({shortHash}에서 생성)",
"createBranchFailed": "브랜치 생성에 실패했습니다"
"createBranchFailed": "브랜치 생성에 실패했습니다",
"openPushWindowFailed": "푸시 창을 열지 못했습니다"
},
"branchSelector": {
"selectBranchPlaceholder": "브랜치 선택...",

View File

@@ -678,7 +678,8 @@
"create": "Criar",
"createAndSwitch": "Criar e alternar",
"openFile": "Abrir arquivo",
"viewDiff": "Ver Diff"
"viewDiff": "Ver Diff",
"push": "Enviar..."
},
"modes": {
"conversation": "Modo conversa",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "Nova branch criada e selecionada",
"newBranchFromCommit": "{name} (de {shortHash})",
"createBranchFailed": "Falha ao criar branch"
"createBranchFailed": "Falha ao criar branch",
"openPushWindowFailed": "Falha ao abrir a janela de push"
},
"branchSelector": {
"selectBranchPlaceholder": "Selecionar branch...",

View File

@@ -678,7 +678,8 @@
"create": "创建",
"createAndSwitch": "创建并切换",
"openFile": "打开文件",
"viewDiff": "查看差异"
"viewDiff": "查看差异",
"push": "推送..."
},
"modes": {
"conversation": "会话模式",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "已创建并切换到新分支",
"newBranchFromCommit": "{name}(来自 {shortHash}",
"createBranchFailed": "新建分支失败"
"createBranchFailed": "新建分支失败",
"openPushWindowFailed": "打开推送窗口失败"
},
"branchSelector": {
"selectBranchPlaceholder": "选择分支...",

View File

@@ -678,7 +678,8 @@
"create": "建立",
"createAndSwitch": "建立並切換",
"openFile": "打開檔案",
"viewDiff": "查看差異"
"viewDiff": "查看差異",
"push": "推送..."
},
"modes": {
"conversation": "會話模式",
@@ -1083,7 +1084,8 @@
"toasts": {
"createdAndSwitchedNewBranch": "已建立並切換到新分支",
"newBranchFromCommit": "{name}(來自 {shortHash}",
"createBranchFailed": "新增分支失敗"
"createBranchFailed": "新增分支失敗",
"openPushWindowFailed": "開啟推送視窗失敗"
},
"branchSelector": {
"selectBranchPlaceholder": "選擇分支...",