Skip to content

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

Couple of minor UI nudges in edge functions UI (#44123)

Joshen Limc3f7318dbc2e
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.constants.ts b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.constants.ts
index f8492a1c694..887fa663533 100644
--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.constants.ts
+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.constants.ts
@@ -34,6 +34,7 @@ export const INVOCATION_TABS: InvocationTab[] = [
language: 'js',
hideLineNumbers: true,
code: ({ functionName }) => `import { createClient } from '@supabase/supabase-js'
+
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY)
const { data, error } = await supabase.functions.invoke('${functionName}', {
body: { name: 'Functions' },
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
index 2fc17538c5c..1fcf9c254d8 100644
--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
@@ -13,6 +13,7 @@ import {
Card,
CardContent,
CardFooter,
+ CardHeader,
cn,
CodeBlock,
copyToClipboard,
@@ -182,11 +183,22 @@ export const EdgeFunctionDetails = () => {
layout="flex-row-reverse"
description={
<>
- Requires a JWT signed{' '}
- <em className="text-brand not-italic">only by the legacy secret</em>{' '}
- in the <code>Authorization</code> header. The <code>anon</code> key
- satisfies this. Recommended: OFF with JWT and custom auth logic in
- your function code.
+ <p className="mb-2">
+ Requires a JWT signed{' '}
+ <em className="text-foreground not-italic">
+ only by the legacy secret
+ </em>{' '}
+ in the{' '}
+ <code className="text-code-inline !break-keep">
+ Authorization
+ </code>{' '}
+ header. The <code className="text-code-inline">anon</code> key
+ satisfies this.
+ </p>
+ <p>
+ Recommended: OFF with JWT and custom auth logic in your function
+ code.
+ </p>
</>
}
>
@@ -265,15 +277,16 @@ export const EdgeFunctionDetails = () => {
})
return (
- <TabsContent key={tab.id} value={tab.id} className="mt-4 px-6">
+ <TabsContent key={tab.id} value={tab.id}>
<CodeBlock
value={code}
+ wrapperClassName="[&>div]:top-0 [&>div]:right-3 px-6"
className={cn(
- 'p-0 text-xs !mt-0 border-none [&>code]:!whitespace-pre-wrap',
+ 'p-0 text-xs !mt-0 border-none ',
showKey ? '[&>code]:break-all' : '[&>code]:break-words'
)}
language={tab.language}
- wrapLines={true}
+ wrapLines={false}
hideLineNumbers={tab.hideLineNumbers}
handleCopy={() => {
copyToClipboard(
@@ -313,7 +326,7 @@ export const EdgeFunctionDetails = () => {
description: 'Download the function to your local machine',
jsx: () => (
<>
- <span className="text-brand-600">supabase</span> functions download{' '}
+ <span className="text-brand">supabase</span> functions download{' '}
{selectedFunction?.slug}
</>
),
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.utils.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.utils.tsx
index f83befe18a2..448e73ebf1c 100644
--- a/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.utils.tsx
+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.utils.tsx
@@ -16,8 +16,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">supabase</span> functions deploy{' '}
- {selectedFunction?.slug}
+ <span className="text-brand">supabase</span> functions deploy {selectedFunction?.slug}
</>
)
},
@@ -29,8 +28,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">supabase</span> functions delete{' '}
- {selectedFunction?.slug}
+ <span className="text-brand">supabase</span> functions delete {selectedFunction?.slug}
</>
)
},
@@ -45,7 +43,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">supabase</span> secrets list
+ <span className="text-brand">supabase</span> secrets list
</>
)
},
@@ -57,7 +55,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">supabase</span> secrets set NAME1=VALUE1 NAME2=VALUE2
+ <span className="text-brand">supabase</span> secrets set NAME1=VALUE1 NAME2=VALUE2
</>
)
},
@@ -69,7 +67,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">supabase</span> secrets unset NAME1 NAME2
+ <span className="text-brand">supabase</span> secrets unset NAME1 NAME2
</>
)
},
@@ -86,7 +84,7 @@ export const generateCLICommands = ({
jsx: () => {
return (
<>
- <span className="text-brand-600">curl</span> -L -X POST '{functionUrl}'{' '}
+ <span className="text-brand">curl</span> -L -X POST '{functionUrl}'{' '}
{selectedFunction?.verify_jwt
? `-H
'Authorization: Bearer [YOUR ANON KEY]' `
diff --git a/apps/studio/components/interfaces/Realtime/Inspector/EmptyRealtime.tsx b/apps/studio/components/interfaces/Realtime/Inspector/EmptyRealtime.tsx
index 721825b7a04..2d0b725d1cb 100644
--- a/apps/studio/components/interfaces/Realtime/Inspector/EmptyRealtime.tsx
+++ b/apps/studio/components/interfaces/Realtime/Inspector/EmptyRealtime.tsx
@@ -6,6 +6,7 @@ import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'
import { AiIconAnimation, Button, Card, cn } from 'ui'
import { AnimatedCursors } from './AnimatedCursors'
+import { DocsButton } from '@/components/ui/DocsButton'
/**
* Acts as a container component for the entire log display
@@ -93,13 +94,10 @@ export const EmptyRealtime = ({ projectRef }: { projectRef: string }) => {
<p className="text-foreground-light text-sm mb-4 flex-1">
Receive realtime messages in your application by listening to a channel
</p>
- <Button type="default" asChild>
- <Link
- href={`${DOCS_URL}/guides/realtime/subscribing-to-database-changes#listening-on-client-side`}
- >
- Read the guide
- </Link>
- </Button>
+ <DocsButton
+ abbrev={false}
+ href={`${DOCS_URL}/guides/realtime/subscribing-to-database-changes#listening-on-client-side`}
+ />
</div>
</Card>
</div>
diff --git a/apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx b/apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx
index ae3565f0110..c65b7130fbf 100644
--- a/apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx
+++ b/apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx
@@ -37,6 +37,7 @@ import {
PopoverTrigger_Shadcn_,
Separator,
} from 'ui'
+import { TimestampInfo } from 'ui-patterns'
import { Input } from 'ui-patterns/DataInputs/Input'
import {
PageHeader,
@@ -293,23 +294,35 @@ const EdgeFunctionDetailsLayout = ({
</span>
</button>
</HoverCardTrigger>
- <HoverCardContent side="bottom" align="start" className="w-[320px] p-0">
+ <HoverCardContent side="bottom" align="start" className="w-40 p-0">
{createdRelative && (
<div className="px-4 py-2 space-y-1">
<h3 className="heading-meta text-foreground-light">Created</h3>
- <p className="text-foreground">{createdRelative}</p>
+ {!!selectedFunction && (
+ <TimestampInfo
+ className="text-sm"
+ label={createdRelative}
+ utcTimestamp={selectedFunction.created_at}
+ />
+ )}
</div>
)}
{updatedRelative && (
<div className="px-4 py-2 space-y-1">
<h3 className="heading-meta text-foreground-light">Last deployed</h3>
- <p className="text-foreground">{updatedRelative}</p>
+ {!!selectedFunction && (
+ <TimestampInfo
+ className="text-sm"
+ label={updatedRelative}
+ utcTimestamp={selectedFunction.updated_at}
+ />
+ )}
</div>
)}
{selectedFunction?.version !== undefined && (
<div className="px-4 py-2 space-y-1">
<h3 className="heading-meta text-foreground-light">Deployments</h3>
- <p className="text-foreground">{selectedFunction.version}</p>
+ <p className="text-sm text-foreground">{selectedFunction.version}</p>
</div>
)}
</HoverCardContent>