推送窗口现在会判断是否有配置Git远程仓库,显示正确的提示信息

This commit is contained in:
xintaofei
2026-03-31 18:52:18 +08:00
parent 8937543f80
commit c5fe85d309
11 changed files with 21 additions and 3 deletions

View File

@@ -414,8 +414,10 @@ export function PushWorkspace({
<span className="truncate text-sm font-medium">
{pushInfoData.branch}
</span>
<ArrowRight className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
{uniqueRemotes.length <= 1 ? (
{uniqueRemotes.length > 0 && (
<ArrowRight className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
)}
{uniqueRemotes.length === 0 ? null : uniqueRemotes.length <= 1 ? (
<span className="truncate text-sm text-muted-foreground">
{selectedRemote ?? "origin"}/{pushInfoData.branch}
</span>
@@ -453,6 +455,10 @@ export function PushWorkspace({
<div className="flex items-center justify-center py-12">
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
</div>
) : uniqueRemotes.length === 0 ? (
<div className="flex items-center justify-center px-4 py-12 text-center text-sm text-muted-foreground whitespace-pre-line">
{t("noRemoteConfigured")}
</div>
) : unpushedCommits.length === 0 ? (
<div className="flex items-center justify-center py-12 text-sm text-muted-foreground">
{!hasUpstream
@@ -533,7 +539,9 @@ export function PushWorkspace({
<Button
className="w-full"
disabled={
pushing || (hasUpstream && unpushedCommits.length === 0)
pushing ||
uniqueRemotes.length === 0 ||
(hasUpstream && unpushedCommits.length === 0)
}
onClick={handlePush}
>