From 3a33cbcce55cb3b5535de9fe4ee68cd81098f3e2 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 13 Oct 2026 23:48:48 +0800 Subject: [PATCH] Show main branch as part of the empty state (#51607) ## Context Shows the production branch as part of the branching empty state (Shifts `BranchingEmptyState` into `Overview`) It's so that users can still then reach the "View logs" button for the production branch which was otherwise hidden image --- .../interfaces/BranchManagement/Overview.tsx | 244 ++++++++++-------- .../pages/project/[ref]/branches/index.tsx | 29 +-- 2 files changed, 142 insertions(+), 131 deletions(-) diff --git a/apps/studio/components/interfaces/BranchManagement/Overview.tsx b/apps/studio/components/interfaces/BranchManagement/Overview.tsx index 6b797f75cc2..b8bdedf306c 100644 --- a/apps/studio/components/interfaces/BranchManagement/Overview.tsx +++ b/apps/studio/components/interfaces/BranchManagement/Overview.tsx @@ -10,6 +10,7 @@ import { Pencil, Redo, RefreshCw, + RefreshCwIcon, Shield, Trash2, } from 'lucide-react' @@ -26,10 +27,12 @@ import { } from 'ui' import { ConfirmationModal } from 'ui-patterns/Dialogs/ConfirmationModal' +import { BranchingEmptyState } from './BranchingEmptyState' import { BranchLoader, BranchManagementSection, BranchRow, BranchRowLoader } from './BranchPanels' import { EditBranchModal } from './EditBranchModal' import { PreviewBranchesEmptyState } from './EmptyStates' import { SwitchToPreviewModal } from './SwitchToPreviewModal' +import { ButtonTooltip } from '@/components/ui/ButtonTooltip' import { DropdownMenuItemTooltip } from '@/components/ui/DropdownMenuItemTooltip' import { TextConfirmModal } from '@/components/ui/TextConfirmModalWrapper' import { useBranchPushMutation } from '@/data/branches/branch-push-mutation' @@ -81,6 +84,8 @@ export const Overview = ({ const { hasAccess: hasAccessToPersistentBranching, isLoading: isLoadingEntitlement } = useCheckEntitlements('branching_persistent') + const showEmptyState = isSuccess && previewBranches.length === 0 + return ( <> @@ -111,118 +116,125 @@ export const Overview = ({ )} - {/* Persistent Branches Section */} - - {(isLoading || isLoadingEntitlement) && } - {isSuccess && - !isLoadingEntitlement && - !hasAccessToPersistentBranching && - IS_PLATFORM && - persistentBranches.length === 0 && ( -
-
-

Upgrade to unlock persistent branches

-

- Persistent branches are long-lived, cannot be reset, and are ideal for staging - environments. -

-
- -
- )} - {isSuccess && - !isLoadingEntitlement && - hasAccessToPersistentBranching && - persistentBranches.length === 0 && ( -
-

No persistent branches

-

- Persistent branches are long-lived, cannot be reset, and are ideal for staging - environments. -

-
- )} - {isSuccess && - !isLoadingEntitlement && - persistentBranches.map((branch) => { - return ( - + ) : ( + <> + {/* Persistent Branches Section */} + + {(isLoading || isLoadingEntitlement) && } + {isSuccess && + !isLoadingEntitlement && + !hasAccessToPersistentBranching && + IS_PLATFORM && + persistentBranches.length === 0 && ( +
+
+

Upgrade to unlock persistent branches

+

+ Persistent branches are long-lived, cannot be reset, and are ideal for staging + environments. +

+
+ +
+ )} + {isSuccess && + !isLoadingEntitlement && + hasAccessToPersistentBranching && + persistentBranches.length === 0 && ( +
+

No persistent branches

+

+ Persistent branches are long-lived, cannot be reset, and are ideal for staging + environments. +

+
+ )} + {isSuccess && + !isLoadingEntitlement && + persistentBranches.map((branch) => { + return ( + onSelectDeleteBranch(branch)} - generateCreatePullRequestURL={generateCreatePullRequestURL} + branch={branch} + rowActions={ + onSelectDeleteBranch(branch)} + generateCreatePullRequestURL={generateCreatePullRequestURL} + /> + } /> - } - /> - ) - })} -
+ ) + })} +
- {/* Ephemeral/Preview Branches Section */} - - {isLoading && } - {isSuccess && ephemeralBranches.length === 0 && ( - - )} - {isSuccess && - ephemeralBranches.map((branch) => { - return ( - + {isLoading && } + {isSuccess && ephemeralBranches.length === 0 && ( + + )} + {isSuccess && + ephemeralBranches.map((branch) => { + return ( + onSelectDeleteBranch(branch)} - generateCreatePullRequestURL={generateCreatePullRequestURL} - /> - } - /> - ) - })} - - {/* Scheduled for deletion branches section */} - - {isLoading && } - {isSuccess && scheduledForDeletionBranches.length === 0 && ( -
-

No branches scheduled for deletion

-
- )} - {isSuccess && - scheduledForDeletionBranches.map((branch) => { - return ( - onSelectDeleteBranch(branch)} - generateCreatePullRequestURL={generateCreatePullRequestURL} + rowActions={ + onSelectDeleteBranch(branch)} + generateCreatePullRequestURL={generateCreatePullRequestURL} + /> + } /> - } - /> - ) - })} -
+ ) + })} + + + {/* Scheduled for deletion branches section */} + + {isLoading && } + {isSuccess && scheduledForDeletionBranches.length === 0 && ( +
+

No branches scheduled for deletion

+
+ )} + {isSuccess && + scheduledForDeletionBranches.map((branch) => { + return ( + onSelectDeleteBranch(branch)} + generateCreatePullRequestURL={generateCreatePullRequestURL} + /> + } + /> + ) + })} +
+ + )} ) } @@ -596,15 +608,21 @@ const MainBranchActions = ({ branch, repo }: { branch: Branch; repo: string }) = <> -