Skip to content

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

Refactor functions pages - organize files and add the terminal instructions even if project has functions deployed

Joshen Lim596927baf7d6
diff --git a/studio/components/interfaces/Functions/Functions.types.ts b/studio/components/interfaces/Functions/Functions.types.ts
index ed54073082f..2fc8915a916 100644
--- a/studio/components/interfaces/Functions/Functions.types.ts
+++ b/studio/components/interfaces/Functions/Functions.types.ts
@@ -7,3 +7,10 @@ export interface Function {
created_at: number
updated_at: number
}
+
+export interface Commands {
+ command: string
+ description: string
+ jsx?: () => void
+ comment?: string
+}
diff --git a/studio/components/interfaces/Functions/FunctionsEmptyState.tsx b/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
new file mode 100644
index 00000000000..fc9e4c12eac
--- /dev/null
+++ b/studio/components/interfaces/Functions/FunctionsEmptyState.tsx
@@ -0,0 +1,32 @@
+import Link from 'next/link'
+import { Button, IconBookOpen } 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="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.
+ </p>
+ <p className="max-w-lg text-sm text-scale-1100">
+ Edge Functions are server-side Typescript functions, distributed globally at the edge -
+ close to your users. They can be used for listening to webhooks or integrating your
+ Supabase project with third-parties.
+ </p>
+ <div className="flex gap-2">
+ <Link passHref href="https://supabase.com/docs/guides/functions">
+ <Button as="a" type="default" iconRight={<IconBookOpen />}>
+ Documentation
+ </Button>
+ </Link>
+ </div>
+ </div>
+ <TerminalInstructions />
+ </div>
+ </>
+ )
+}
+
+export default FunctionsEmptyState
diff --git a/studio/components/interfaces/Functions/TerminalInstructions.tsx b/studio/components/interfaces/Functions/TerminalInstructions.tsx
new file mode 100644
index 00000000000..aa6a7f0b083
--- /dev/null
+++ b/studio/components/interfaces/Functions/TerminalInstructions.tsx
@@ -0,0 +1,125 @@
+import { useRouter } from 'next/router'
+import { Button, IconTerminal, IconMaximize2, IconMinimize2 } 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'
+
+interface Props {
+ closable?: boolean
+}
+
+const TerminalInstructions: FC<Props> = ({ closable = false }) => {
+ const router = useRouter()
+ const { ref } = router.query
+
+ const { tokens } = useAccessTokens()
+ const { services } = useProjectSettings(ref as string | undefined)
+
+ const [showInstructions, setShowInstructions] = useState(!closable)
+
+ // Get the API service
+ const API_SERVICE_ID = 1
+ const apiService = (services ?? []).find((x: any) => x.app.id == API_SERVICE_ID)
+ const apiKeys = apiService?.service_api_keys ?? []
+ const anonKey = apiKeys.find((x: any) => x.name === 'anon key')?.api_key
+
+ const endpoint = apiService?.app_config.endpoint ?? ''
+ const endpointSections = endpoint.split('.')
+ const functionsEndpoint = [
+ ...endpointSections.slice(0, 1),
+ 'functions',
+ ...endpointSections.slice(1),
+ ].join('.')
+
+ const commands: Commands[] = [
+ {
+ command: 'supabase functions new hello-world',
+ description: ' creates a function stub at ./functions/hello-world/index.ts',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions new hello-world
+ </>
+ )
+ },
+ comment: 'Create a function',
+ },
+ {
+ command: `supabase functions deploy hello-world --project-ref ${ref}`,
+ description: 'Deploys function at ./functions/hello-world/index.ts',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions deploy hello-world
+ --project-ref {ref}
+ </>
+ )
+ },
+ comment: 'Deploy your function',
+ },
+ {
+ command: `curl -L -X POST 'https://${ref}.functions.supabase.co/hello-world' -H 'Authorization: Bearer ${
+ anonKey ?? '[YOUR ANON KEY]'
+ }' --data '{"name":"Functions"}'`,
+ description: 'Invokes the hello-world function',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">curl</span> -L -X POST 'https://{functionsEndpoint}
+ /hello-world' -H 'Authorization: Bearer [YOUR ANON KEY]'{' '}
+ {`--data '{"name":"Functions"}'`}
+ </>
+ )
+ },
+ comment: 'Invoke your function',
+ },
+ ]
+
+ return (
+ <div
+ className="col-span-7 bg-scale-100 dark:bg-scale-300 shadow border rounded overflow-hidden transition-all"
+ style={{ maxHeight: showInstructions ? 500 : 80 }}
+ >
+ <div className="px-8 py-6 space-y-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">
+ <IconTerminal strokeWidth={2} />
+ </div>
+ <h4>Terminal instructions</h4>
+ </div>
+ {closable && (
+ <div className="cursor-pointer" onClick={() => setShowInstructions(!showInstructions)}>
+ {showInstructions ? (
+ <IconMinimize2 size={14} strokeWidth={1.5} />
+ ) : (
+ <IconMaximize2 size={14} strokeWidth={1.5} />
+ )}
+ </div>
+ )}
+ </div>
+ <div className="space-y-4">
+ <CommandRender commands={commands} />
+ </div>
+ </div>
+ {tokens && tokens.length === 0 ? (
+ <div className="px-8 border-t py-6 space-y-3">
+ <div>
+ <h3 className="text-base text-scale-1200">You may need to create an access token</h3>
+ <p className="text-sm text-scale-1100">
+ You can create a secure access token in your account section
+ </p>
+ </div>
+ <Button type="default" onClick={() => router.push('/account/tokens')}>
+ Access tokens
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ )
+}
+
+export default TerminalInstructions
diff --git a/studio/components/interfaces/Functions/FunctionsLayout.tsx b/studio/components/layouts/FunctionsLayout.tsx
similarity index 98%
rename from studio/components/interfaces/Functions/FunctionsLayout.tsx
rename to studio/components/layouts/FunctionsLayout.tsx
index fb84c92b03c..f6efbe32ec9 100644
--- a/studio/components/interfaces/Functions/FunctionsLayout.tsx
+++ b/studio/components/layouts/FunctionsLayout.tsx
@@ -5,7 +5,7 @@ import { observer } from 'mobx-react-lite'
import { IconCode } from '@supabase/ui'
import { useStore, withAuth } from 'hooks'
-import FunctionsNav from './FunctionsNav'
+import FunctionsNav from '../interfaces/Functions/FunctionsNav'
import BaseLayout from 'components/layouts'
const FunctionsLayout = ({ children }: { children?: React.ReactNode }) => {
diff --git a/studio/pages/project/[ref]/functions/[id]/details.tsx b/studio/pages/project/[ref]/functions/[id]/details.tsx
index 7bb5c786c6f..9c41cbc5035 100644
--- a/studio/pages/project/[ref]/functions/[id]/details.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/details.tsx
@@ -1,7 +1,7 @@
import { observer } from 'mobx-react-lite'
import { useProjectSettings, useStore } from 'hooks'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import CommandRender from 'components/interfaces/Functions/CommandRender'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
@@ -137,7 +137,7 @@ const PageLayout: NextPageWithLayout = () => {
<div className="space-y-4 w-full">
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1">Function Name</span>
- <div className="text-base text-scale-1200">{selectedFunction?.name}</div>
+ <div className="text-sm text-scale-1200">{selectedFunction?.name}</div>
</div>
<div className="grid grid-cols-3">
@@ -166,13 +166,13 @@ const PageLayout: NextPageWithLayout = () => {
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1 cols-span-1">Endpoint URL</span>
<div className="col-span-2">
- <span className="text-scale-1200 break-words w-full">{`https://${ref}.functions.supabase.co/${selectedFunction?.slug}`}</span>
+ <span className="text-sm text-scale-1200 break-words w-full">{`https://${ref}.functions.supabase.co/${selectedFunction?.slug}`}</span>
</div>
</div>
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1">Created At</span>
- <div className="text-base text-scale-1200 col-span-2">
+ <div className="text-sm text-scale-1200 col-span-2">
{selectedFunction?.created_at &&
dayjs(selectedFunction.created_at).format('dddd, MMMM D, YYYY h:mm A')}
</div>
@@ -180,7 +180,7 @@ const PageLayout: NextPageWithLayout = () => {
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1">Updated At</span>
- <div className="text-base text-scale-1200 col-span-2">
+ <div className="text-sm text-scale-1200 col-span-2">
{selectedFunction?.updated_at &&
dayjs(selectedFunction.updated_at).format('dddd, MMMM D, YYYY h:mm A')}
</div>
@@ -188,13 +188,13 @@ const PageLayout: NextPageWithLayout = () => {
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1">Version</span>
- <div className="text-base text-scale-1200 col-span-2">v{selectedFunction?.version}</div>
+ <div className="text-sm text-scale-1200 col-span-2">v{selectedFunction?.version}</div>
</div>
<div className="grid grid-cols-3">
<span className="block text-scale-1000 text-sm mb-1">Regions</span>
<div className="flex flex-col gap-1 col-span-2">
- <div className="text-base text-scale-1200 flex items-center gap-2">
+ <div className="text-sm text-scale-1200 flex items-center gap-2">
<IconGlobe />
<span>Earth</span>
</div>
diff --git a/studio/pages/project/[ref]/functions/[id]/index.tsx b/studio/pages/project/[ref]/functions/[id]/index.tsx
index 801e789f60d..ca9b57173d4 100644
--- a/studio/pages/project/[ref]/functions/[id]/index.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/index.tsx
@@ -13,7 +13,7 @@ import ChartHandler from 'components/to-be-cleaned/Charts/ChartHandler'
import { get } from 'lib/common/fetch'
import { API_URL, DATE_FORMAT } from 'lib/constants'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import { ChartIntervals, NextPageWithLayout } from 'types'
const CHART_INTERVALS: ChartIntervals[] = [
diff --git a/studio/pages/project/[ref]/functions/[id]/invocations.tsx b/studio/pages/project/[ref]/functions/[id]/invocations.tsx
index 9757e9a47a4..f207dfc5fd2 100644
--- a/studio/pages/project/[ref]/functions/[id]/invocations.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/invocations.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
import LogsPreviewer from 'components/interfaces/Settings/Logs/LogsPreviewer'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import { NextPageWithLayout } from 'types'
/**
diff --git a/studio/pages/project/[ref]/functions/[id]/logs-old.tsx b/studio/pages/project/[ref]/functions/[id]/logs-old.tsx
index 928f3fc59c6..d8b0a8d1b12 100644
--- a/studio/pages/project/[ref]/functions/[id]/logs-old.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/logs-old.tsx
@@ -7,9 +7,7 @@ import {
Button,
Checkbox,
IconCalendar,
- IconChevronRight,
IconExternalLink,
- IconGlobe,
IconSearch,
Input,
Popover,
@@ -18,97 +16,11 @@ import {
import { withAuth } from 'hooks'
import Table from 'components/to-be-cleaned/Table'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import FunctionLogsItem from 'components/interfaces/Functions/FunctionLogsItem'
import { LOGS_DATA } from 'components/interfaces/Functions/Functions.data'
-const EmptyFunctions = () => {
- return (
- <>
- <p className="text-scale-1200 text-base max-w-lg">
- Scalable pay-as-you-go functions as a service (FaaS) to run your code with zero server
- management.
- </p>
- <p className="text-scale-1100 text-sm max-w-lg">
- No servers to provision, manage, or upgrade Automatically scale based on the load Integrated
- monitoring, logging, and debugging capability Built-in security at role and per function
- level based on the principle of least privilege Key networking capabilities for hybrid and
- multi-cloud scenarios
- </p>
- <div className="flex gap-2">
- <Button iconRight={<IconChevronRight />}>Get started</Button>
- <Button type="link" iconRight={<IconExternalLink />}>
- Documentation
- </Button>
- </div>
- <div className="bg-scale-300 rounded px-10 py-8 flex flex-col gap-8">
- <h2 className="text-sm text-scale-1100">Function examples</h2>
- <div className="grid lg:grid-cols-3 gap-8">
- <div className="flex flex-col gap-3">
- <div
- className="
- h-10 w-10
- bg-indigo-900
- bordershadow-indigo-900
- rounded-md
- text-scale-fixed-100
- flex items-center justify-center
- "
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="
- h-10 w-10
- bg-indigo-900
- bordershadow-indigo-900
- rounded-md
- text-scale-fixed-100
- flex items-center justify-center
- "
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="
- h-10 w-10
- bg-indigo-900
- bordershadow-indigo-900
- rounded-md
- text-scale-fixed-100
- flex items-center justify-center
- "
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- </div>
- </div>
- </>
- )
-}
+// [Joshen] Is this supposed to be deprecated?
const FunctionsList = () => {
const [detailVisible, setDetailVisible] = useState(false)
@@ -116,32 +28,6 @@ const FunctionsList = () => {
const router = useRouter()
const { ref } = router.query
- const PageState = {
- functions: [
- {
- name: 'hello-world',
- id: 1,
- runtime: 'Node14',
- memory: 256,
- created_at: 1646524256,
- },
- {
- name: 'charge',
- id: 2,
- runtime: 'Node14',
- memory: 256,
- created_at: 1646524256,
- },
- {
- name: 'projects',
- id: 3,
- runtime: 'Node14',
- memory: 512,
- created_at: 1646524256,
- },
- ],
- }
-
const logDetails = (
<div className="grid grid-cols-12 gap-2">
<span className="col-span-3 text-sm text-scale-900 w-32">Status</span>
@@ -177,11 +63,6 @@ const FunctionsList = () => {
<div className="col-span-7 text-sm text-scale-1200">
<span className="">Something</span>
</div>
-
- {/* <div className="col-span-3 text-sm text-scale-900 w-32 grow">User agent</div>
- <div className="col-span-7 flex text-scale-1200">
- <span className="">{LOGS_DATA[0].user_agent}</span>
- </div> */}
</div>
)
@@ -315,15 +196,6 @@ const FunctionsList = () => {
}
const PageLayout = () => {
- const [pageState, setPageState] = useState('list')
-
- const Selection = () => (
- <div>
- <Button onClick={() => setPageState('empty')}>empty list</Button>
- <Button onClick={() => setPageState('list')}>list</Button>
- </div>
- )
-
return (
<FunctionsLayout>
<FunctionsList />
diff --git a/studio/pages/project/[ref]/functions/[id]/logs.tsx b/studio/pages/project/[ref]/functions/[id]/logs.tsx
index bdaf82e2195..2e1ca4fe80b 100644
--- a/studio/pages/project/[ref]/functions/[id]/logs.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/logs.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
import LogsPreviewer from 'components/interfaces/Settings/Logs/LogsPreviewer'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import { NextPageWithLayout } from 'types'
/**
diff --git a/studio/pages/project/[ref]/functions/[id]/triggers.tsx b/studio/pages/project/[ref]/functions/[id]/triggers.tsx
index e0b05e11cc8..a6ef881515a 100644
--- a/studio/pages/project/[ref]/functions/[id]/triggers.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/triggers.tsx
@@ -1,4 +1,4 @@
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import { observer } from 'mobx-react-lite'
import { NextPageWithLayout } from 'types'
diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx
index 9ff2fc1222e..43c89b08d8d 100644
--- a/studio/pages/project/[ref]/functions/index.tsx
+++ b/studio/pages/project/[ref]/functions/index.tsx
@@ -1,163 +1,13 @@
-import Link from 'next/link'
-import { useEffect } from 'react'
-import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
-import { Button, IconBookOpen, IconSearch, IconTerminal, Input, Loading } from '@supabase/ui'
-import { useProjectSettings, useStore, withAuth } from 'hooks'
-import { post } from 'lib/common/fetch'
-import { API_URL, PROJECT_STATUS } from 'lib/constants'
+import { NextPageWithLayout } from 'types'
+import { useStore } from 'hooks'
import Table from 'components/to-be-cleaned/Table'
-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'
+import FunctionsLayout from 'components/layouts/FunctionsLayout'
import FunctionsListItem from 'components/interfaces/Functions/FunctionsListItem'
-import CommandRender from 'components/interfaces/Functions/CommandRender'
import { Function } from 'components/interfaces/Functions/Functions.types'
-import { NextPageWithLayout } from 'types'
-import { useAccessTokens } from 'hooks/queries/useAccessTokens'
-import useSWR from 'swr'
-
-import { get } from 'lib/common/fetch'
-
-const EmptyFunctions = () => {
- const router = useRouter()
- const { ref } = router.query
-
- const { tokens, isLoading } = useAccessTokens()
- const { services } = useProjectSettings(ref as string | undefined)
-
- const API_SERVICE_ID = 1
-
- // Get the API service
- const apiService = (services ?? []).find((x: any) => x.app.id == API_SERVICE_ID)
- const apiKeys = apiService?.service_api_keys ?? []
- const anonKey = apiKeys.find((x: any) => x.name === 'anon key')?.api_key
-
- const endpoint = apiService?.app_config.endpoint ?? ''
- const endpointSections = endpoint.split('.')
- const functionsEndpoint = [
- ...endpointSections.slice(0, 1),
- 'functions',
- ...endpointSections.slice(1),
- ].join('.')
-
- interface Commands {
- command: string
- description: string
- jsx?: () => void
- comment?: string
- }
- const commands: Commands[] = [
- {
- command: 'supabase functions new hello-world',
- description: ' creates a function stub at ./functions/hello-world/index.ts',
- jsx: () => {
- return (
- <>
- <span className="text-brand-1100">supabase</span> functions new hello-world
- </>
- )
- },
- comment: 'Create a function',
- },
- {
- command: `supabase functions deploy hello-world --project-ref ${ref}`,
- description: 'Deploys function at ./functions/hello-world/index.ts',
- jsx: () => {
- return (
- <>
- <span className="text-brand-1100">supabase</span> functions deploy hello-world
- --project-ref {ref}
- </>
- )
- },
- comment: 'Deploy your function',
- },
- {
- command: `curl -L -X POST 'https://${ref}.functions.supabase.co/hello-world' -H 'Authorization: Bearer ${
- anonKey ?? '[YOUR ANON KEY]'
- }' --data '{"name":"Functions"}'`,
- description: 'Invokes the hello-world function',
- jsx: () => {
- return (
- <>
- <span className="text-brand-1100">curl</span> -L -X POST 'https://{functionsEndpoint}
- /hello-world' -H 'Authorization: Bearer [YOUR ANON KEY]'{' '}
- {`--data '{"name":"Functions"}'`}
- </>
- )
- },
- comment: 'Invoke your function',
- },
- ]
- return (
- <>
- <div className="grid py-12 lg:grid-cols-12 gap-y-12 lg:gap-x-16 max-w-7xl">
- <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.
- </p>
- <p className="max-w-lg text-sm text-scale-1100">
- Edge Functions are server-side Typescript functions, distributed globally at the edge -
- close to your users. They can be used for listening to webhooks or integrating your
- Supabase project with third-parties.
- </p>
- <div className="flex gap-2">
- <Link passHref href="https://supabase.com/docs/guides/functions">
- <Button as="a" type="default" iconRight={<IconBookOpen />}>
- Documentation
- </Button>
- </Link>
- </div>
- </div>
- <div
- className="
- col-span-7
- bg-scale-100 dark:bg-scale-300
- shadow
- border rounded
- "
- >
- <div className="px-8 py-6 space-y-6">
- <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">
- <IconTerminal strokeWidth={2} />
- </div>
- <h4>Terminal instructions</h4>
- </div>
- <div className="space-y-4">
- <CommandRender commands={commands} />
- </div>
- </div>
- {tokens && tokens.length == 0 ? (
- <div className="px-8 border-t py-6 space-y-3">
- <div>
- <h3 className="text-base text-scale-1200">
- You may need to create an access token
- </h3>
- <p className="text-sm text-scale-1100">
- You can create a secure access token in your account section
- </p>
- </div>
- <Button type="default" onClick={() => router.push('/account/tokens')}>
- Access tokens
- </Button>
- </div>
- ) : null}
- {/* <div className="px-8 border-t py-6">
- <Input
- value={ref}
- readOnly
- copy
- size="small"
- label="Project ref"
- descriptionText="You may need this reference when deploying a function"
- />
- </div> */}
- </div>
- </div>
- </>
- )
-}
+import FunctionsEmptyState from 'components/interfaces/Functions/FunctionsEmptyState'
+import TerminalInstructions from 'components/interfaces/Functions/TerminalInstructions'
const FunctionsList = ({ functions }: { functions: Function[] }) => {
return (
@@ -189,53 +39,6 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {
/>
</div>
</div>
-
- {/* <div
- className="flex flex-col col-span-2 gap-8 px-10 py-8 rounded bg-scale-300"
- >
- <h2 className="text-sm text-scale-1100">Function examples</h2>
- <div className="grid gap-8 lg:grid-cols-3">
- <div className="flex flex-col gap-3">
- <div
- className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- </div>
- </div> */}
</>
)
}
@@ -244,7 +47,14 @@ const PageLayout: NextPageWithLayout = () => {
const { functions } = useStore()
const hasFunctions = functions.list().length > 0
- return hasFunctions ? <FunctionsList functions={functions.list()} /> : <EmptyFunctions />
+ return hasFunctions ? (
+ <div className="py-6">
+ <TerminalInstructions closable />
+ <FunctionsList functions={functions.list()} />
+ </div>
+ ) : (
+ <FunctionsEmptyState />
+ )
}
PageLayout.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>