The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: setup getLayout
Alaister Youngd29d5ba7ef2b
diff --git a/studio/components/interfaces/Functions/FunctionsLayout.tsx b/studio/components/interfaces/Functions/FunctionsLayout.tsxindex a539500390c..94dee01c80d 100644--- a/studio/components/interfaces/Functions/FunctionsLayout.tsx+++ b/studio/components/interfaces/Functions/FunctionsLayout.tsx@@ -10,7 +10,7 @@ import Link from 'next/link'import WarningBanner from 'components/ui/WarningBanner'import { WARNING_MESSAGE } from './Functions.constants'-const PageLayout = ({ children, centered }: { children?: React.ReactNode; centered?: boolean }) => {+const FunctionsLayout = ({ children }: { children?: React.ReactNode }) => {const { functions, ui } = useStore()const router = useRouter()@@ -33,6 +33,9 @@ const PageLayout = ({ children, centered }: { children?: React.ReactNode; centerconst item = id ? functions.byId(id) : nullconst name = item?.name || ''+ const hasFunctions = functions.list().length > 0+ const centered = !hasFunctions+return (<BaseLayout><WarningBanner title={WARNING_MESSAGE.title} description={WARNING_MESSAGE.description} />@@ -138,4 +141,4 @@ const PageLayout = ({ children, centered }: { children?: React.ReactNode; center)}-export default withAuth(observer(PageLayout))+export default withAuth(observer(FunctionsLayout))diff --git a/studio/pages/_app.tsx b/studio/pages/_app.tsxindex 1ebb8cf841d..a58d38901a0 100644--- a/studio/pages/_app.tsx+++ b/studio/pages/_app.tsx@@ -11,7 +11,8 @@ import 'styles/react-data-grid-logs.scss'import 'styles/date-picker.scss'import Head from 'next/head'-import type { AppProps } from 'next/app'+import { AppPropsWithLayout } from 'types'+import { useRouter } from 'next/router'import { useEffect, useState } from 'react'import { RootStore } from 'stores'@@ -23,7 +24,7 @@ import { PortalToast, GoTrueWrapper, RouteValidationWrapper } from 'components/iimport PageTelemetry from 'components/ui/PageTelemetry'import FlagProvider from 'components/ui/Flag/FlagProvider'-function MyApp({ Component, pageProps }: AppProps) {+function MyApp({ Component, pageProps }: AppPropsWithLayout) {const [rootStore] = useState(() => new RootStore())const router = useRouter()@@ -38,6 +39,8 @@ function MyApp({ Component, pageProps }: AppProps) {}}, [])+ const getLayout = Component.getLayout ?? ((page) => page)+return (<StoreProvider rootStore={rootStore}><FlagProvider>@@ -49,7 +52,7 @@ function MyApp({ Component, pageProps }: AppProps) {<GoTrueWrapper><PageTelemetry><RouteValidationWrapper>- <Component {...pageProps} />+ {getLayout(<Component {...pageProps} />)}</RouteValidationWrapper></PageTelemetry></GoTrueWrapper>diff --git a/studio/pages/project/[ref]/functions/[id]/details.tsx b/studio/pages/project/[ref]/functions/[id]/details.tsxindex ca32036e925..a70480970c0 100644--- a/studio/pages/project/[ref]/functions/[id]/details.tsx+++ b/studio/pages/project/[ref]/functions/[id]/details.tsx@@ -1,5 +1,5 @@import { observer } from 'mobx-react-lite'-import { useStore, withAuth } from 'hooks'+import { useStore } from 'hooks'import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'import CommandRender from 'components/interfaces/Functions/CommandRender'@@ -9,8 +9,9 @@ import { toJS } from 'mobx'import { IconExternalLink, IconGlobe, IconTerminal, Loading } from '@supabase/ui'import Link from 'next/link'import dayjs from 'dayjs'+import { NextPageWithLayout } from 'types'-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const router = useRouter()const { ref, id } = router.query@@ -95,116 +96,106 @@ const PageLayout = () => {]return (- <FunctionsLayout>- <div className="grid gap-y-12 lg:grid-cols-2 lg:gap-x-16">- <div>- <div- className="- px-12 py-8 bg-scale-100 dark:bg-scale-300 rounded border drop-shadow-sm-- "- >- {console.log('inside the render', functions.byId(id))}- <div>{selectedFunction?.createdAt}</div>-- <div className="space-y-4">- <div>- <span className="block text-scale-900 text-xs mb-1">Function name</span>- <div className="text-base text-scale-1100">{selectedFunction?.name}</div>- </div>+ <div className="grid gap-y-12 lg:grid-cols-2 lg:gap-x-16">+ <div>+ <div className="px-12 py-8 border rounded bg-scale-100 dark:bg-scale-300 drop-shadow-sm">+ {console.log('inside the render', functions.byId(id))}+ <div>{selectedFunction?.createdAt}</div>++ <div className="space-y-4">+ <div>+ <span className="block mb-1 text-xs text-scale-900">Function name</span>+ <div className="text-base text-scale-1100">{selectedFunction?.name}</div>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Status</span>- <div className="flex items-center gap-2">- <div- className="text-base bg-brand-300 dark:bg-brand-100 px-3 py-0.5 rounded-full lowercasefirst-letter:+ <div>+ <span className="block mb-1 text-xs text-scale-900">Status</span>+ <div className="flex items-center gap-2">+ <div+ className="text-base bg-brand-300 dark:bg-brand-100 px-3 py-0.5 rounded-full lowercasefirst-letter:flex items-center gap-3 lowercase text-brand-900"- >- {selectedFunction?.status}- <div className="relative w-2 h-2">- <span className="flex h-2 w-2">- <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-800 opacity-75"></span>- <span className="relative inline-flex rounded-full h-2 w-2 bg-brand-900"></span>- </span>- </div>+ >+ {selectedFunction?.status}+ <div className="relative w-2 h-2">+ <span className="flex w-2 h-2">+ <span className="absolute inline-flex w-full h-full rounded-full opacity-75 animate-ping bg-brand-800"></span>+ <span className="relative inline-flex w-2 h-2 rounded-full bg-brand-900"></span>+ </span></div>- <span className="text-xs text-scale-900">This function is running correctly</span></div>+ <span className="text-xs text-scale-900">This function is running correctly</span></div>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Endpoint url</span>- <Link- href={`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}- passHref+ <div>+ <span className="block mb-1 text-xs text-scale-900">Endpoint url</span>+ <Link+ href={`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}+ passHref+ >+ <a+ className="flex items-center gap-2 group text-scale-1100 hover:text-scale-1200"+ target="_target">- <a- className="flex items-center gap-2 group text-scale-1100 hover:text-scale-1200"- target="_target"- >- <span className="underline">{`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}</span>- <IconExternalLink size={14} />- </a>- </Link>- </div>+ <span className="underline">{`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}</span>+ <IconExternalLink size={14} />+ </a>+ </Link>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Created at</span>- <div className="text-base text-scale-1100">- {selectedFunction?.created_at &&- dayjs(selectedFunction.created_at).format('dddd, MMMM D, YYYY h:mm A')}- </div>+ <div>+ <span className="block mb-1 text-xs text-scale-900">Created at</span>+ <div className="text-base text-scale-1100">+ {selectedFunction?.created_at &&+ dayjs(selectedFunction.created_at).format('dddd, MMMM D, YYYY h:mm A')}</div>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Updated at</span>- <div className="text-base text-scale-1100">- {selectedFunction?.updated_at &&- dayjs(selectedFunction.updated_at).format('dddd, MMMM D, YYYY h:mm A')}- </div>+ <div>+ <span className="block mb-1 text-xs text-scale-900">Updated at</span>+ <div className="text-base text-scale-1100">+ {selectedFunction?.updated_at &&+ dayjs(selectedFunction.updated_at).format('dddd, MMMM D, YYYY h:mm A')}</div>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Version</span>- <div className="text-base text-scale-1100">v {selectedFunction?.version}</div>- </div>+ <div>+ <span className="block mb-1 text-xs text-scale-900">Version</span>+ <div className="text-base text-scale-1100">v {selectedFunction?.version}</div>+ </div>- <div>- <span className="block text-scale-900 text-xs mb-1">Regions</span>- <div className="flex items-center gap-3">- <div className="text-base text-scale-1100 flex items-center gap-2">- <IconGlobe />- <span>Earth</span>- </div>- <span className="text-xs text-scale-900">Supabase functions run on the edge</span>+ <div>+ <span className="block mb-1 text-xs text-scale-900">Regions</span>+ <div className="flex items-center gap-3">+ <div className="flex items-center gap-2 text-base text-scale-1100">+ <IconGlobe />+ <span>Earth</span></div>+ <span className="text-xs text-scale-900">Supabase functions run on the edge</span></div></div></div></div>- <div>- <div- className="px-12 py-8- bg-scale-100 dark:bg-scale-300 border drop-shadow-sm- rounded- space-y-6"- >- <div className="flex items-center gap-3">- <div className="border p-2 flex items-center justify-center w-8 h-8 text-scale-100 dark:text-scale-1200 bg-scale-1200 dark:bg-scale-100 rounded">- <IconTerminal strokeWidth={2} />- </div>- <h4>Command line access</h4>+ </div>+ <div>+ <div className="px-12 py-8 space-y-6 border rounded bg-scale-100 dark:bg-scale-300 drop-shadow-sm">+ <div className="flex items-center gap-3">+ <div className="flex items-center justify-center w-8 h-8 p-2 border rounded text-scale-100 dark:text-scale-1200 bg-scale-1200 dark:bg-scale-100">+ <IconTerminal strokeWidth={2} /></div>- <h5 className="text-base">Deployment management</h5>- <CommandRender commands={managementCommands} />- <h5 className="text-base">Secrets management</h5>- <CommandRender commands={secretCommands} />+ <h4>Command line access</h4></div>+ <h5 className="text-base">Deployment management</h5>+ <CommandRender commands={managementCommands} />+ <h5 className="text-base">Secrets management</h5>+ <CommandRender commands={secretCommands} /></div></div>- </FunctionsLayout>+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/functions/[id]/index.tsx b/studio/pages/project/[ref]/functions/[id]/index.tsxindex 88090571608..bcd921d47f2 100644--- a/studio/pages/project/[ref]/functions/[id]/index.tsx+++ b/studio/pages/project/[ref]/functions/[id]/index.tsx@@ -1,5 +1,4 @@import { observer } from 'mobx-react-lite'-import { withAuth } from 'hooks'import useSWR from 'swr'import dayjs from 'dayjs'@@ -15,6 +14,7 @@ import { get } from 'lib/common/fetch'import { API_URL, DATE_FORMAT } from 'lib/constants'import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'+import { NextPageWithLayout } from 'types'const CHART_INTERVALS = [{@@ -49,7 +49,7 @@ function calculateHighlightedValue(array: any, attribute: string, options?: { su}}-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const [interval, setInterval] = useState<string>('15min')const router = useRouter()const { ref, id } = router.query@@ -91,123 +91,120 @@ const PageLayout = () => {}return (- <FunctionsLayout>- <div className="space-y-6 py-2">- <div className="flex flex-row items-center gap-2">- <div className="flex items-center">- {CHART_INTERVALS.map((item, i) => {- const classes = []-- if (i === 0) {- classes.push('rounded-tr-none rounded-br-none')- } else if (i === CHART_INTERVALS.length - 1) {- classes.push('rounded-tl-none rounded-bl-none')- } else {- classes.push('rounded-none')- }-- return (- <Button- key={`function-filter-${i}`}- type={interval === item.key ? 'secondary' : 'default'}- onClick={() => setInterval(item.key)}- className={classes.join(' ')}- >- {item.label}- </Button>- )- })}- </div>-- <span className="text-scale-1000 text-xs">- Statistics for past {selectedInterval.label}- </span>+ <div className="py-2 space-y-6">+ <div className="flex flex-row items-center gap-2">+ <div className="flex items-center">+ {CHART_INTERVALS.map((item, i) => {+ const classes = []++ if (i === 0) {+ classes.push('rounded-tr-none rounded-br-none')+ } else if (i === CHART_INTERVALS.length - 1) {+ classes.push('rounded-tl-none rounded-bl-none')+ } else {+ classes.push('rounded-none')+ }++ return (+ <Button+ key={`function-filter-${i}`}+ type={interval === item.key ? 'secondary' : 'default'}+ onClick={() => setInterval(item.key)}+ className={classes.join(' ')}+ >+ {item.label}+ </Button>+ )+ })}</div>- <div className="">- {startDate && endDate && (- <>- <div className="grid grid-cols-1 md:gap-4 md:grid-cols-2 lg:grid-cols-2 lg:gap-8">- <Panel key="database-chart">- <Panel.Content className="space-y-4">- {/*- // @ts-ignore */}- <ChartHandler- label="Execution time"- defaultChartStyle="line"- startDate={startDate}- endDate={endDate}- attribute={'avg_execution_time'}- provider="log-stats"- // interval="1d"- hideChartType- customDateFormat={datetimeFormat}- data={charts}- format="ms"- isLoading={!charts.data && !error ? true : false}- highlightedValue={calculateHighlightedValue(- data?.result,- 'avg_execution_time'- )}- // onBarClick={(v) => handleBarClick(v, '/rest')}- />- </Panel.Content>- </Panel>- <Panel key="invocation-chart">- <Panel.Content className="space-y-4">- {/*- // @ts-ignore */}- <ChartHandler- label="Invocations"- startDate={startDate}- endDate={endDate}- attribute={'count'}- provider="log-stats"- // interval="1d"- hideChartType- customDateFormat={datetimeFormat}- data={charts}- isLoading={!charts.data && !error ? true : false}- highlightedValue={calculateHighlightedValue(data?.result, 'count', {- sum: true,- })}- onBarClick={(v) => handleBarClick(v, '/auth')}- />- </Panel.Content>- </Panel>- </div>- <Panel key="error-chart">++ <span className="text-xs text-scale-1000">+ Statistics for past {selectedInterval.label}+ </span>+ </div>+ <div className="">+ {startDate && endDate && (+ <>+ <div className="grid grid-cols-1 md:gap-4 md:grid-cols-2 lg:grid-cols-2 lg:gap-8">+ <Panel key="database-chart"><Panel.Content className="space-y-4">{/*// @ts-ignore */}<ChartHandler+ label="Execution time"defaultChartStyle="line"- label="Error count"startDate={startDate}endDate={endDate}- attribute={'min_execution_time'}+ attribute={'avg_execution_time'}provider="log-stats"// interval="1d"hideChartTypecustomDateFormat={datetimeFormat}data={charts}+ format="ms"isLoading={!charts.data && !error ? true : false}- highlightedValue={calculateHighlightedValue(- data?.result,- 'min_execution_time',- {- sum: true,- }- )}+ highlightedValue={calculateHighlightedValue(data?.result, 'avg_execution_time')}+ // onBarClick={(v) => handleBarClick(v, '/rest')}+ />+ </Panel.Content>+ </Panel>+ <Panel key="invocation-chart">+ <Panel.Content className="space-y-4">+ {/*+ {/*+ {/*+ // @ts-ignore */}+ <ChartHandler+ label="Invocations"+ startDate={startDate}+ endDate={endDate}+ attribute={'count'}+ provider="log-stats"+ // interval="1d"+ hideChartType+ customDateFormat={datetimeFormat}+ data={charts}+ isLoading={!charts.data && !error ? true : false}+ highlightedValue={calculateHighlightedValue(data?.result, 'count', {+ sum: true,+ })}onBarClick={(v) => handleBarClick(v, '/auth')}/></Panel.Content></Panel>- </>- )}- </div>+ </div>+ <Panel key="error-chart">+ <Panel.Content className="space-y-4">+ {/*+ {/*+ {/*+ // @ts-ignore */}+ <ChartHandler+ defaultChartStyle="line"+ label="Error count"+ startDate={startDate}+ endDate={endDate}+ attribute={'min_execution_time'}+ provider="log-stats"+ // interval="1d"+ hideChartType+ customDateFormat={datetimeFormat}+ data={charts}+ isLoading={!charts.data && !error ? true : false}+ highlightedValue={calculateHighlightedValue(data?.result, 'min_execution_time', {+ sum: true,+ })}+ onBarClick={(v) => handleBarClick(v, '/auth')}+ />+ </Panel.Content>+ </Panel>+ </>+ )}</div>- </FunctionsLayout>+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/functions/[id]/invocations.tsx b/studio/pages/project/[ref]/functions/[id]/invocations.tsxindex 5217ba872bc..872126b3d43 100644--- a/studio/pages/project/[ref]/functions/[id]/invocations.tsx+++ b/studio/pages/project/[ref]/functions/[id]/invocations.tsx@@ -1,32 +1,26 @@import React from 'react'-import { NextPage } from 'next'import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'-import { withAuth } from 'hooks'-import { LOG_TYPE_LABEL_MAPPING } from 'components/interfaces/Settings/Logs'import LogsPreviewer from 'components/interfaces/Settings/Logs/LogsPreviewer'import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'+import { NextPageWithLayout } from 'types'/*** Placeholder page for logs previewers until we figure out where to slot them*/-export const LogPage: NextPage = () => {+export const LogPage: NextPageWithLayout = () => {const router = useRouter()- const { ref, type, id } = router.query-- const title = `Invocation Logs - ${- LOG_TYPE_LABEL_MAPPING[type as keyof typeof LOG_TYPE_LABEL_MAPPING]- }`+ const { ref, id } = router.queryreturn (- <FunctionsLayout title={title}>- <LogsPreviewer- projectRef={ref as string}- queryType={'fn_edge'}- override={{ key: 'function_id', value: id }}- />- </FunctionsLayout>+ <LogsPreviewer+ projectRef={ref as string}+ queryType={'fn_edge'}+ override={{ key: 'function_id', value: id }}+ />)}-export default withAuth(observer(LogPage))+LogPage.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(LogPage)diff --git a/studio/pages/project/[ref]/functions/[id]/logs.tsx b/studio/pages/project/[ref]/functions/[id]/logs.tsxindex 4ac048890ea..4b8e8853417 100644--- a/studio/pages/project/[ref]/functions/[id]/logs.tsx+++ b/studio/pages/project/[ref]/functions/[id]/logs.tsx@@ -1,32 +1,26 @@import React from 'react'-import { NextPage } from 'next'import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'-import { withAuth } from 'hooks'-import { LOG_TYPE_LABEL_MAPPING } from 'components/interfaces/Settings/Logs'import LogsPreviewer from 'components/interfaces/Settings/Logs/LogsPreviewer'import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'+import { NextPageWithLayout } from 'types'/*** Placeholder page for logs previewers until we figure out where to slot them*/-export const LogPage: NextPage = () => {+export const LogPage: NextPageWithLayout = () => {const router = useRouter()- const { ref, type, id } = router.query-- const title = `Function Logs - ${- LOG_TYPE_LABEL_MAPPING[type as keyof typeof LOG_TYPE_LABEL_MAPPING]- }`+ const { ref, id } = router.queryreturn (- <FunctionsLayout title={title}>- <LogsPreviewer- projectRef={ref as string}- queryType={'functions'}- override={{ key: 'metadata.function_id', value: id }}- />- </FunctionsLayout>+ <LogsPreviewer+ projectRef={ref as string}+ queryType={'functions'}+ override={{ key: 'metadata.function_id', value: id }}+ />)}-export default withAuth(observer(LogPage))+LogPage.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(LogPage)diff --git a/studio/pages/project/[ref]/functions/[id]/triggers.tsx b/studio/pages/project/[ref]/functions/[id]/triggers.tsxindex 6a1bb91493c..e0b05e11cc8 100644--- a/studio/pages/project/[ref]/functions/[id]/triggers.tsx+++ b/studio/pages/project/[ref]/functions/[id]/triggers.tsx@@ -1,10 +1,11 @@-import { observer } from 'mobx-react-lite'-import { withAuth } from 'hooks'-import FunctionsLayout from 'components/interfaces/Functions/FunctionsLayout'+import { observer } from 'mobx-react-lite'+import { NextPageWithLayout } from 'types'-const PageLayout = () => {- return <FunctionsLayout>Triggers</FunctionsLayout>+const PageLayout: NextPageWithLayout = () => {+ return <div>Triggers</div>}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsxindex c07a15bd1f8..cbdc14b5895 100644--- a/studio/pages/project/[ref]/functions/index.tsx+++ b/studio/pages/project/[ref]/functions/index.tsx@@ -12,6 +12,7 @@ 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 { NextPageWithLayout } from 'types'const EmptyFunctions = () => {const router = useRouter()@@ -100,13 +101,13 @@ const EmptyFunctions = () => {]return (<>- <div className="grid lg:grid-cols-12 gap-y-12 lg:gap-x-16 max-w-7xl py-12">- <div className="space-y-4 col-span-5">- <p className="text-scale-1200 text-base max-w-lg">+ <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 pay-as-you-go functions as a service (FaaS) to run your code with zero servermanagement.</p>- <p className="text-scale-1100 text-sm max-w-lg">+ <p className="max-w-lg text-sm text-scale-1100">No servers to provision, manage, or upgrade Automatically scale based on the loadIntegrated monitoring, logging, and debugging capability Built-in security at role andper function level based on the principle of least privilege Key networking capabilities@@ -120,17 +121,9 @@ const EmptyFunctions = () => {</Link></div></div>- <div- className="- col-span-7- bg-scale-100 dark:bg-scale-300 px-8 py-6- shadow-- border rounded- space-y-8"- >+ <div className="col-span-7 px-8 py-6 space-y-8 border rounded shadow bg-scale-100 dark:bg-scale-300"><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 items-center justify-center w-8 h-8 p-2 border rounded bg-scale-100"><IconTerminal strokeWidth={2} /></div><h4>Terminal instructions</h4>@@ -148,7 +141,7 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {return (<><div className="flex flex-col gap-3 py-12">- <div className="flex justify-between items-center">+ <div className="flex items-center justify-between"><span className="text-sm text-scale-900">{`${functions.length} function${functions.length > 1 ? 's' : ''} deployed`}</span>@@ -177,22 +170,13 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {</div>{/* <div- className="- col-span-2- bg-scale-300 rounded px-10 py-8 flex flex-col gap-8"+ 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 lg:grid-cols-3 gap-8">+ <div className="grid gap-8 lg:grid-cols-3"><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- "+ className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"><IconGlobe /></div>@@ -205,14 +189,7 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {</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- "+ className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"><IconGlobe /></div>@@ -225,14 +202,7 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {</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- "+ className="flex items-center justify-center w-10 h-10 bg-indigo-900 rounded-md bordershadow-indigo-900 text-scale-fixed-100"><IconGlobe /></div>@@ -249,15 +219,13 @@ const FunctionsList = ({ functions }: { functions: Function[] }) => {)}-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const { functions } = useStore()const hasFunctions = functions.list().length > 0- return (- <FunctionsLayout centered={!hasFunctions}>- {hasFunctions ? <FunctionsList functions={functions.list()} /> : <EmptyFunctions />}- </FunctionsLayout>- )+ return hasFunctions ? <FunctionsList functions={functions.list()} /> : <EmptyFunctions />}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <FunctionsLayout>{page}</FunctionsLayout>++export default observer(PageLayout)diff --git a/studio/types/index.ts b/studio/types/index.tsindex 3a097cbde06..29bd20bcbc3 100644--- a/studio/types/index.ts+++ b/studio/types/index.ts@@ -1,3 +1,4 @@export * from './base'export * from './ui'export * from './userContent'+export * from './next'diff --git a/studio/types/next.ts b/studio/types/next.tsnew file mode 100644index 00000000000..b525bed86bc--- /dev/null+++ b/studio/types/next.ts@@ -0,0 +1,11 @@+import { NextPage } from 'next'+import { AppProps } from 'next/app'+import { ReactElement, ReactNode } from 'react'++export type AppPropsWithLayout = AppProps & {+ Component: NextPageWithLayout+}++export type NextPageWithLayout = NextPage & {+ getLayout?: (page: ReactElement) => ReactNode+}