Skip to content

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

Add docs and examples links to functions page

Terry Sutton96c66b7666d2
diff --git a/studio/components/interfaces/Functions/FunctionsEmptyState.tsx b/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
index fc9e4c12eac..607529dabd0 100644
--- a/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
+++ b/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
@@ -1,11 +1,11 @@
import Link from 'next/link'
-import { Button, IconBookOpen } from '@supabase/ui'
+import { Button, IconBookOpen, IconCode } from '@supabase/ui'
import TerminalInstructions from './TerminalInstructions'
const FunctionsEmptyState = () => {
return (
<>
- <div className="grid py-12 lg:grid-cols-12 gap-y-12 lg:gap-x-16 max-w-7xl">
+ <div className="grid max-w-7xl gap-y-12 py-12 lg:grid-cols-12 lg:gap-x-16">
<div className="col-span-5 space-y-4">
<p className="max-w-lg text-base text-scale-1200">
Scalable functions to run your code with no server management.
@@ -21,6 +21,14 @@ const FunctionsEmptyState = () => {
Documentation
</Button>
</Link>
+ <Link
+ passHref
+ href="https://github.com/supabase/supabase/tree/chore/stripe-issue/examples/edge-functions/supabase/functions"
+ >
+ <Button as="a" type="default" iconRight={<IconCode />}>
+ Examples
+ </Button>
+ </Link>
</div>
</div>
<TerminalInstructions />
diff --git a/studio/components/interfaces/Functions/TerminalInstructions.tsx b/studio/components/interfaces/Functions/TerminalInstructions.tsx
index ead46f004d5..d2097c24fcd 100644
--- a/studio/components/interfaces/Functions/TerminalInstructions.tsx
+++ b/studio/components/interfaces/Functions/TerminalInstructions.tsx
@@ -1,11 +1,19 @@
import { useRouter } from 'next/router'
-import { Button, IconTerminal, IconMaximize2, IconMinimize2 } from '@supabase/ui'
+import {
+ Button,
+ IconTerminal,
+ IconMaximize2,
+ IconMinimize2,
+ IconBookOpen,
+ IconCode,
+} from '@supabase/ui'
import { useProjectSettings } from 'hooks'
import { useAccessTokens } from 'hooks/queries/useAccessTokens'
import { Commands } from './Functions.types'
import CommandRender from 'components/interfaces/Functions/CommandRender'
import { FC, useState } from 'react'
import { useStore } from 'hooks'
+import Link from 'next/link'
interface Props {
closable?: boolean
@@ -85,13 +93,13 @@ const TerminalInstructions: FC<Props> = ({ closable = false }) => {
return (
<div
- className="col-span-7 bg-scale-100 dark:bg-scale-300 shadow border rounded overflow-hidden transition-all"
+ className="col-span-7 overflow-hidden rounded border bg-scale-100 shadow transition-all dark:bg-scale-300"
style={{ maxHeight: showInstructions ? 500 : 80 }}
>
- <div className="px-8 py-6 space-y-6">
+ <div className="space-y-6 px-8 py-6">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
- <div className="border p-2 flex items-center justify-center w-8 h-8 bg-scale-100 rounded">
+ <div className="flex h-8 w-8 items-center justify-center rounded border bg-scale-100 p-2">
<IconTerminal strokeWidth={2} />
</div>
<h4>Terminal instructions</h4>
@@ -111,7 +119,7 @@ const TerminalInstructions: FC<Props> = ({ closable = false }) => {
</div>
</div>
{tokens && tokens.length === 0 ? (
- <div className="px-8 border-t py-6 space-y-3">
+ <div className="space-y-3 border-t px-8 py-6">
<div>
<h3 className="text-base text-scale-1200">You may need to create an access token</h3>
<p className="text-sm text-scale-1100">
@@ -122,7 +130,31 @@ const TerminalInstructions: FC<Props> = ({ closable = false }) => {
Access tokens
</Button>
</div>
- ) : null}
+ ) : (
+ <div className="space-y-3 border-t px-8 py-6">
+ <div>
+ <h3 className="text-base text-scale-1200">Need help?</h3>
+ <p className="text-sm text-scale-1100">
+ Read the documentation, or browse some sample code.
+ </p>
+ </div>
+ <div className="flex gap-2">
+ <Link passHref href="https://supabase.com/docs/guides/functions">
+ <Button as="a" type="default" iconRight={<IconBookOpen />}>
+ Documentation
+ </Button>
+ </Link>
+ <Link
+ passHref
+ href="https://github.com/supabase/supabase/tree/chore/stripe-issue/examples/edge-functions/supabase/functions"
+ >
+ <Button as="a" type="default" iconRight={<IconCode />}>
+ Examples
+ </Button>
+ </Link>
+ </div>
+ </div>
+ )}
</div>
)
}