The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: improve commands
Jonathan Summers-Muir10548aa317f3
diff --git a/studio/components/interfaces/Functions/FunctionsLayout.tsx b/studio/components/interfaces/Functions/FunctionsLayout.tsxindex 19e745a2890..eeb688b6d32 100644--- a/studio/components/interfaces/Functions/FunctionsLayout.tsx+++ b/studio/components/interfaces/Functions/FunctionsLayout.tsx@@ -37,17 +37,29 @@ const PageLayout = ({ children, centered }: { children?: React.ReactNode; center<BaseLayout>{centered ? (<>- <WarningBanner title={WARNING_MESSAGE.title} description={WARNING_MESSAGE.description} /><div className="mx-auto max-w-5xl py-24 px-5">- <div className="flex items-center gap-3">- <div- className="w-6 h-6 bg-brand-300 border border-brand-600 rounded text-brand-900+ <div+ className="flex+ flex-col+ gap-y-4+ xl:flex-row+ item-center+ justify-between"+ >+ <div className="flex items-center gap-3">+ <div+ className="w-6 h-6 bg-brand-300 border border-brand-600 rounded text-brand-900flex items-center justify-center"- >- <IconCode size={14} strokeWidth={3} />+ >+ <IconCode size={14} strokeWidth={3} />+ </div>+ <h1 className="text-2xl text-scale-1200">Functions</h1></div>- <h1 className="text-2xl text-scale-1200">Functions</h1>+ <WarningBanner+ title={WARNING_MESSAGE.title}+ description={WARNING_MESSAGE.description}+ /></div>{children}diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsxindex 7d400ad2a1d..ad1bc03c3ee 100644--- a/studio/pages/project/[ref]/functions/index.tsx+++ b/studio/pages/project/[ref]/functions/index.tsx@@ -12,11 +12,17 @@ import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'import FunctionsListItem from 'components/interfaces/Functions/FunctionsListItem'import CommandRender from 'components/interfaces/Functions/CommandRender'import { Function } from 'components/interfaces/Functions/Functions.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()+interface Commands {command: stringdescription: string@@ -24,42 +30,42 @@ const EmptyFunctions = () => {comment?: string}const commands: Commands[] = [- {- command: 'supabase init',- description: "Needed if the project hasen't been inited before",- jsx: () => {- return (- <>- <span className="text-brand-1100">supabase</span> init- </>- )- },- comment: 'Initialize Supabase locally',- },- {- command: 'supabase login',- description: "Writes the user's API token to disk",- jsx: () => {- return (- <>- <span className="text-brand-1100">supabase</span> login- </>- )- },- comment: 'Login using your access token',- },- {- command: `supabase link --ref ${ref}`,- description: `Associate the current folder with your Supabase project ${ref}`,- jsx: () => {- return (- <>- <span className="text-brand-1100">supabase</span> link --ref {ref}- </>- )- },- comment: 'Link this project',- },+ // {+ // command: 'supabase init',+ // description: "Needed if the project hasen't been inited before",+ // jsx: () => {+ // return (+ // <>+ // <span className="text-brand-1100">supabase</span> init+ // </>+ // )+ // },+ // comment: 'Initialize Supabase locally',+ // },+ // {+ // command: 'supabase login',+ // description: "Writes the user's API token to disk",+ // jsx: () => {+ // return (+ // <>+ // <span className="text-brand-1100">supabase</span> login+ // </>+ // )+ // },+ // comment: 'Login using your access token',+ // },+ // {+ // command: `supabase link --ref ${ref}`,+ // description: `Associate the current folder with your Supabase project ${ref}`,+ // jsx: () => {+ // return (+ // <>+ // <span className="text-brand-1100">supabase</span> link --ref {ref}+ // </>+ // )+ // },+ // comment: 'Link this project',+ // },{command: 'supabase functions new hello',description: ' creates a function stub at ./functions/hello/hello.ts',@@ -78,7 +84,8 @@ const EmptyFunctions = () => {jsx: () => {return (<>- <span className="text-brand-1100">supabase</span> functions deploy hello+ <span className="text-brand-1100">supabase</span> functions deploy hello --project-ref{' '}+ {ref}</>)},@@ -123,21 +130,47 @@ const EmptyFunctions = () => {<divclassName="col-span-7- bg-scale-100 dark:bg-scale-300 px-8 py-6+ bg-scale-100 dark:bg-scale-300shadow-border rounded- space-y-8"+ ">- <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 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>- <h4>Terminal instructions</h4>- </div>- <div className="space-y-4">- <CommandRender commands={commands} /></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></>@@ -252,9 +285,22 @@ const PageLayout = () => {const { functions } = useStore()const hasFunctions = functions.list().length > 0+ const router = useRouter()+ const { ref } = router.query++ const {+ data,+ error,+ mutate: mutateSettings,+ }: any = useSWR(`${API_URL}/props/project/${ref}/settings`, get)+ const { data: config, mutate: mutateConfig }: any = useSWR(+ `${API_URL}/projects/${ref}/config?app=postgrest`,+ get+ )+return (- <FunctionsLayout centered={!hasFunctions}>- {hasFunctions ? <FunctionsList functions={functions.list()} /> : <EmptyFunctions />}+ <FunctionsLayout centered={true}>+ {false ? <FunctionsList functions={functions.list()} /> : <EmptyFunctions />}</FunctionsLayout>)}