Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Icons and close branch button changes (#37143)

Saxon Fletchera829c23c825c
diff --git a/apps/studio/components/interfaces/BranchManagement/EdgeFunctionsDiffPanel.tsx b/apps/studio/components/interfaces/BranchManagement/EdgeFunctionsDiffPanel.tsx
index 6bcd2ba8bbb..ad99d760f6c 100644
--- a/apps/studio/components/interfaces/BranchManagement/EdgeFunctionsDiffPanel.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/EdgeFunctionsDiffPanel.tsx
@@ -1,4 +1,4 @@
-import { Code, Wind } from 'lucide-react'
+import { Circle, Code, Minus, Plus, Wind } from 'lucide-react'
import Link from 'next/link'
import { useEffect, useMemo, useState } from 'react'
@@ -34,15 +34,31 @@ const fileKey = (fullPath: string) => basename(fullPath)
const getStatusColor = (status: FileStatus): string => {
switch (status) {
case 'added':
- return 'bg-brand'
+ return 'text-brand'
case 'removed':
- return 'bg-destructive'
+ return 'text-destructive'
case 'modified':
- return 'bg-warning'
+ return 'text-warning'
case 'unchanged':
- return 'bg-muted'
+ return 'text-muted'
default:
- return 'bg-muted'
+ return 'text-muted'
+ }
+}
+
+// Helper to get the status icon for file indicators
+const getStatusIcon = (status: FileStatus) => {
+ switch (status) {
+ case 'added':
+ return Plus
+ case 'removed':
+ return Minus
+ case 'modified':
+ return Circle
+ case 'unchanged':
+ return Circle
+ default:
+ return Circle
}
}
@@ -65,8 +81,12 @@ const FunctionDiff = ({
}
}, [allFileKeys, activeFileKey])
- const currentFile = currentBody.find((f) => fileKey(f.name) === activeFileKey)
- const mainFile = mainBody.find((f) => fileKey(f.name) === activeFileKey)
+ const currentFile = currentBody.find(
+ (f: EdgeFunctionBodyData[number]) => fileKey(f.name) === activeFileKey
+ )
+ const mainFile = mainBody.find(
+ (f: EdgeFunctionBodyData[number]) => fileKey(f.name) === activeFileKey
+ )
const language = useMemo(() => {
if (!activeFileKey) return 'plaintext'
@@ -96,28 +116,31 @@ const FunctionDiff = ({
<div className="flex h-full min-h-0">
<div className="w-48 border-r bg-surface-200 flex flex-col overflow-y-auto">
<ul className="divide-y divide-border">
- {fileInfos.map((fileInfo) => (
- <li key={fileInfo.key} className="flex">
- <button
- type="button"
- onClick={() => setActiveFileKey(fileInfo.key)}
- className={cn(
- 'flex-1 text-left text-xs px-4 py-2 flex items-center gap-2',
- activeFileKey === fileInfo.key
- ? 'bg-surface-300 text-foreground'
- : 'text-foreground-light hover:bg-surface-300'
- )}
- >
- <div
+ {fileInfos.map((fileInfo) => {
+ const Icon = getStatusIcon(fileInfo.status)
+
+ return (
+ <li key={fileInfo.key} className="flex">
+ <button
+ type="button"
+ onClick={() => setActiveFileKey(fileInfo.key)}
className={cn(
- 'w-1 h-1 rounded-full flex-shrink-0',
- getStatusColor(fileInfo.status)
+ 'flex-1 text-left text-xs px-4 py-2 flex items-center gap-2',
+ activeFileKey === fileInfo.key
+ ? 'bg-surface-300 text-foreground'
+ : 'text-foreground-light hover:bg-surface-300'
)}
- />
- <span className="truncate">{fileInfo.key}</span>
- </button>
- </li>
- ))}
+ >
+ <Icon
+ className={cn('flex-shrink-0', getStatusColor(fileInfo.status))}
+ size={12}
+ strokeWidth={1}
+ />
+ <span className="truncate">{fileInfo.key}</span>
+ </button>
+ </li>
+ )
+ })}
</ul>
</div>
<div className="flex-1 min-h-0">
diff --git a/apps/studio/pages/project/[ref]/merge.tsx b/apps/studio/pages/project/[ref]/merge.tsx
index 4ebd96a1fc4..2f8d10228cf 100644
--- a/apps/studio/pages/project/[ref]/merge.tsx
+++ b/apps/studio/pages/project/[ref]/merge.tsx
@@ -520,7 +520,8 @@ const MergePage: NextPageWithLayout = () => {
>
<Link href={`/project/${parentProjectRef}/branches`}>Create new branch</Link>
</Button>
- ) : hasCurrentWorkflowCompleted ? (
+ ) : hasCurrentWorkflowCompleted &&
+ currentWorkflowRun?.id === parentBranchWorkflow?.id ? (
<Button
type="default"
onClick={handleCloseBranch}