The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Create merge request (#37009)
Saxon Fletchera046c5fd5265
diff --git a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsxindex bcd95439ffd..c8637b7f443 100644--- a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx+++ b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx@@ -27,6 +27,7 @@ import { Button } from 'ui'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'import TextConfirmModal from 'ui-patterns/Dialogs/TextConfirmModal'import { BranchLoader, BranchManagementSection, BranchRow } from './BranchPanels'+import { BranchSelector } from './BranchSelector'import { PreviewBranchesEmptyState, PullRequestsEmptyState } from './EmptyStates'import { Overview } from './Overview'import { ReviewRow } from './ReviewRow'@@ -118,15 +119,30 @@ const BranchManagement = () => {},})- const { mutate: updateBranch } = useBranchUpdateMutation({- onSuccess: () => {- toast.success('Branch updated successfully')- },- onError: (error) => {- toast.error(`Failed to update branch: ${error.message}`)+ const { mutate: updateBranch, isLoading: isUpdating } = useBranchUpdateMutation({+ onError: () => {+ toast.error(`Failed to update the branch`)},})+ const handleMarkBranchForReview = (branch: Branch) => {+ if (branch.id && projectRef) {+ updateBranch(+ {+ id: branch.id,+ projectRef,+ requestReview: true,+ },+ {+ onSuccess: () => {+ toast.success('Branch marked as ready for review')+ router.push(`/project/${branch.project_ref}/merge`)+ },+ }+ )+ }+ }+const generateCreatePullRequestURL = (branch?: string) => {if (githubConnection === undefined) return 'https://github.com'@@ -147,16 +163,6 @@ const BranchManagement = () => {disableBranching({ projectRef, branchIds: previewBranches?.map((branch) => branch.id) })}- const handleReadyForReview = () => {- if (!currentBranch?.id || !projectRef) return- updateBranch({- id: currentBranch.id,- projectRef,- requestReview: true,- })- router.push(`/project/${currentBranch.project_ref}/merge`)- }-return (<><ScaffoldContainer>@@ -268,7 +274,19 @@ const BranchManagement = () => {<div className="space-y-4">{gitlessBranching && (<BranchManagementSection- header={`${branchesReadyForReview.length} branches ready for review`}+ header={+ <div className="flex items-center justify-between w-full">+ <span>+ {branchesReadyForReview.length} branches ready for review+ </span>+ <BranchSelector+ branches={previewBranches}+ onBranchSelected={handleMarkBranchForReview}+ disabled={!projectRef}+ isUpdating={isUpdating}+ />+ </div>+ }>{isBranch && !isCurrentBranchReadyForReview && currentBranch && (<div className="bg-background px-6 py-4">@@ -286,7 +304,9 @@ const BranchManagement = () => {<Buttontype="primary"size="tiny"- onClick={handleReadyForReview}+ onClick={() =>+ currentBranch && handleMarkBranchForReview(currentBranch)+ }>Ready for review</Button>diff --git a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsxindex b05ad093c42..dc7c142d066 100644--- a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx+++ b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx@@ -44,7 +44,7 @@ import { EditBranchModal } from './EditBranchModal'import WorkflowLogs from './WorkflowLogs'interface BranchManagementSectionProps {- header: string+ header: string | ReactNodefooter?: ReactNode}@@ -56,7 +56,7 @@ export const BranchManagementSection = ({return (<div className="border rounded-lg"><div className="bg-surface-100 shadow-sm flex justify-between items-center px-6 py-2 rounded-t-lg text-sm">- {header}+ {typeof header === 'string' ? <span>{header}</span> : header}</div><div className="bg-surface border-t shadow-sm rounded-b-lg text-sm divide-y">{children}</div>{footer !== undefined && <div className="bg-surface-100 px-6 py-1 border-t">{footer}</div>}diff --git a/apps/studio/components/interfaces/BranchManagement/BranchSelector.tsx b/apps/studio/components/interfaces/BranchManagement/BranchSelector.tsxnew file mode 100644index 00000000000..3c9b4c277c1--- /dev/null+++ b/apps/studio/components/interfaces/BranchManagement/BranchSelector.tsx@@ -0,0 +1,91 @@+import { Check, Plus, Shield } from 'lucide-react'+import { useState } from 'react'++import { Branch } from 'data/branches/branches-query'+import {+ Button,+ CommandEmpty_Shadcn_,+ CommandGroup_Shadcn_,+ CommandInput_Shadcn_,+ CommandItem_Shadcn_,+ CommandList_Shadcn_,+ Command_Shadcn_,+ PopoverContent_Shadcn_,+ PopoverTrigger_Shadcn_,+ Popover_Shadcn_,+ ScrollArea,+} from 'ui'++interface BranchSelectorProps {+ branches: Branch[]+ onBranchSelected?: (branch: Branch) => void+ disabled?: boolean+ isUpdating?: boolean+}++export const BranchSelector = ({+ branches,+ onBranchSelected,+ disabled = false,+ isUpdating = false,+}: BranchSelectorProps) => {+ const [open, setOpen] = useState(false)+ const [selectedBranch, setSelectedBranch] = useState<Branch | null>(null)++ // Filter out branches that are already ready for review and the main branch+ const availableBranches = branches.filter(+ (branch) => !branch.is_default && !branch.review_requested_at+ )++ const handleBranchSelect = (branch: Branch) => {+ setSelectedBranch(branch)+ setOpen(false)+ onBranchSelected?.(branch)+ }++ return (+ <Popover_Shadcn_ open={open} onOpenChange={setOpen} modal={false}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button+ type="outline"+ size="tiny"+ disabled={disabled || availableBranches.length === 0 || isUpdating}+ icon={<Plus size={14} strokeWidth={1.5} />}+ >+ {isUpdating ? 'Creating...' : 'Create review'}+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="p-0 w-80" side="bottom">+ <Command_Shadcn_>+ <CommandInput_Shadcn_ placeholder="Find branch to review..." />+ <CommandList_Shadcn_>+ <CommandEmpty_Shadcn_>No available branches found</CommandEmpty_Shadcn_>+ <CommandGroup_Shadcn_>+ <ScrollArea className="max-h-[210px] overflow-y-auto">+ {availableBranches.map((branch) => (+ <CommandItem_Shadcn_+ key={branch.id}+ value={branch.name.replaceAll('"', '')}+ className="cursor-pointer w-full flex items-center justify-between"+ onSelect={() => handleBranchSelect(branch)}+ disabled={isUpdating}+ >+ <div className="flex items-center gap-2">+ {branch.is_default && <Shield size={14} className="text-amber-900" />}+ <span className="truncate" title={branch.name}>+ {branch.name}+ </span>+ </div>+ {selectedBranch?.id === branch.id && (+ <Check size={14} strokeWidth={1.5} className="text-brand" />+ )}+ </CommandItem_Shadcn_>+ ))}+ </ScrollArea>+ </CommandGroup_Shadcn_>+ </CommandList_Shadcn_>+ </Command_Shadcn_>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )+}