Skip to content

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

chore: ordering switch for new functions (#34290)

Pamela Chiae6aac8e995d0
diff --git a/apps/studio/components/interfaces/Functions/FunctionsEmptyState.tsx b/apps/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
index 5ac058fbd3b..4e1327a15a8 100644
--- a/apps/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
+++ b/apps/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
@@ -40,38 +40,31 @@ export const FunctionsEmptyState = () => {
<CardTitle>Create your first edge function</CardTitle>
</CardHeader>
<CardContent className="p-0 grid grid-cols-[repeat(auto-fit,minmax(240px,1fr))] divide-y md:divide-y-0 md:divide-x divide-default items-stretch">
- {/* CLI Option */}
- <div className="p-8">
- <div className="flex items-center gap-2">
- <Terminal strokeWidth={1.5} size={20} />
- <h4 className="text-base text-foreground">Via CLI</h4>
+ {/* Editor Option */}
+ {edgeFunctionCreate && (
+ <div className="p-8">
+ <div className="flex items-center gap-2">
+ <Code strokeWidth={1.5} size={20} />
+ <h4 className="text-base text-foreground">Via Editor</h4>
+ </div>
+ <p className="text-sm text-foreground-light mb-4 mt-1">
+ Create and edit functions directly in the browser. Download to local at any time.
+ </p>
+ <Button
+ type="default"
+ onClick={() => {
+ router.push(`/project/${ref}/functions/new`)
+ sendEvent({
+ action: 'edge_function_via_editor_button_clicked',
+ properties: { origin: 'no_functions_block' },
+ groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
+ })
+ }}
+ >
+ Open Editor
+ </Button>
</div>
- <p className="text-sm text-foreground-light mb-4 mt-1">
- Create and deploy functions using the Supabase CLI. Ideal for local development and
- version control.
- </p>
-
- <Dialog>
- <DialogTrigger asChild>
- <Button
- type="default"
- onClick={() =>
- sendEvent({
- action: 'edge_function_via_cli_button_clicked',
- groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
- })
- }
- >
- View CLI Instructions
- </Button>
- </DialogTrigger>
- <DialogContent size="large">
- <DialogSection padding="small">
- <TerminalInstructions />
- </DialogSection>
- </DialogContent>
- </Dialog>
- </div>
+ )}
{/* AI Assistant Option */}
<div className="p-8">
@@ -109,31 +102,38 @@ export const FunctionsEmptyState = () => {
</Button>
</div>
- {/* Editor Option */}
- {edgeFunctionCreate && (
- <div className="p-8">
- <div className="flex items-center gap-2">
- <Code strokeWidth={1.5} size={20} />
- <h4 className="text-base text-foreground">Via Editor</h4>
- </div>
- <p className="text-sm text-foreground-light mb-4 mt-1">
- Create and edit functions directly in the browser. Download to local at any time.
- </p>
- <Button
- type="default"
- onClick={() => {
- router.push(`/project/${ref}/functions/new`)
- sendEvent({
- action: 'edge_function_via_editor_button_clicked',
- properties: { origin: 'no_functions_block' },
- groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
- })
- }}
- >
- Open Editor
- </Button>
+ {/* CLI Option */}
+ <div className="p-8">
+ <div className="flex items-center gap-2">
+ <Terminal strokeWidth={1.5} size={20} />
+ <h4 className="text-base text-foreground">Via CLI</h4>
</div>
- )}
+ <p className="text-sm text-foreground-light mb-4 mt-1">
+ Create and deploy functions using the Supabase CLI. Ideal for local development and
+ version control.
+ </p>
+
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button
+ type="default"
+ onClick={() =>
+ sendEvent({
+ action: 'edge_function_via_cli_button_clicked',
+ groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
+ })
+ }
+ >
+ View CLI Instructions
+ </Button>
+ </DialogTrigger>
+ <DialogContent size="large">
+ <DialogSection padding="small">
+ <TerminalInstructions />
+ </DialogSection>
+ </DialogContent>
+ </Dialog>
+ </div>
</CardContent>
</Card>
{edgeFunctionCreate && (
diff --git a/apps/studio/pages/project/[ref]/functions/index.tsx b/apps/studio/pages/project/[ref]/functions/index.tsx
index fb51ac6c600..ad369e7e507 100644
--- a/apps/studio/pages/project/[ref]/functions/index.tsx
+++ b/apps/studio/pages/project/[ref]/functions/index.tsx
@@ -58,24 +58,6 @@ const EdgeFunctionsPage: NextPageWithLayout = () => {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-80">
- <Dialog>
- <DialogTrigger asChild>
- <DropdownMenuItem className="gap-4" onSelect={(e) => e.preventDefault()}>
- <Terminal className="shrink-0" size={16} strokeWidth={1.5} />
- <div>
- <span className="text-foreground">Via CLI</span>
- <p>
- Create an edge function locally and then deploy your function via the Supabase CLI
- </p>
- </div>
- </DropdownMenuItem>
- </DialogTrigger>
- <DialogContent size="large">
- <DialogSection padding="small">
- <TerminalInstructions />
- </DialogSection>
- </DialogContent>
- </Dialog>
{edgeFunctionCreate && (
<DropdownMenuItem
onSelect={() => {
@@ -97,6 +79,24 @@ const EdgeFunctionsPage: NextPageWithLayout = () => {
</div>
</DropdownMenuItem>
)}
+ <Dialog>
+ <DialogTrigger asChild>
+ <DropdownMenuItem className="gap-4" onSelect={(e) => e.preventDefault()}>
+ <Terminal className="shrink-0" size={16} strokeWidth={1.5} />
+ <div>
+ <span className="text-foreground">Via CLI</span>
+ <p>
+ Create an edge function locally and then deploy your function via the Supabase CLI
+ </p>
+ </div>
+ </DropdownMenuItem>
+ </DialogTrigger>
+ <DialogContent size="large">
+ <DialogSection padding="small">
+ <TerminalInstructions />
+ </DialogSection>
+ </DialogContent>
+ </Dialog>
</DropdownMenuContent>
</DropdownMenu>
)