The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: implement getLayout in StorageLayout
Alaister Youngd0edc848c9fe
diff --git a/studio/components/layouts/StorageLayout/StorageLayout.tsx b/studio/components/layouts/StorageLayout/StorageLayout.tsxindex 1aedbeeab84..32d3e101e50 100644--- a/studio/components/layouts/StorageLayout/StorageLayout.tsx+++ b/studio/components/layouts/StorageLayout/StorageLayout.tsx@@ -2,7 +2,7 @@ import { FC, ReactNode, useEffect } from 'react'import { find, filter, get as _get } from 'lodash'import { observer } from 'mobx-react-lite'-import { useStore } from 'hooks'+import { useStore, withAuth } from 'hooks'import { API_URL } from 'lib/constants'import { get } from 'lib/common/fetch'import ProjectLayout from '../ProjectLayout/ProjectLayout'@@ -123,4 +123,4 @@ const StorageLayout: FC<Props> = ({ title, children }) => {)}-export default observer(StorageLayout)+export default withAuth(observer(StorageLayout))diff --git a/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx b/studio/pages/project/[ref]/storage/buckets/[bucketId].tsxindex 854ab530fe3..901c93ae87c 100644--- a/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx+++ b/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx@@ -4,18 +4,19 @@ import { observer } from 'mobx-react-lite'import { find } from 'lodash'import { API_URL } from 'lib/constants'-import { withAuth, useStore } from 'hooks'+import { useStore } from 'hooks'import { post } from 'lib/common/fetch'import { PROJECT_STATUS } from 'lib/constants'import { StorageLayout } from 'components/layouts'import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'import { StorageExplorer } from 'components/to-be-cleaned/Storage'import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'+import { NextPageWithLayout } from 'types'/*** PageLayout is used to setup layout - as usual it will requires inject global store*/-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const router = useRouter()const { ref, bucketId } = router.query@@ -36,36 +37,36 @@ const PageLayout = () => {const bucket = find(buckets, { id: bucketId })return (- <StorageLayout title="Buckets">- <div className="storage-container p-4 flex flex-grow">- {loaded ? (- !bucket ? (- <div className="w-full h-full flex items-center justify-center">- <ProductEmptyState- title="Storage"- ctaButtonLabel="Create a new bucket"- infoButtonLabel="About storage"- infoButtonUrl="https://supabase.com/docs/guides/storage"- onClickCta={openCreateBucketModal}- >- <p className="text-sm text-scale-1100">- Create buckets to store and serve any type of digital content.- </p>- <p className="text-sm text-scale-1100">- Make your buckets private or public depending on your security preference.- </p>- </ProductEmptyState>- </div>- ) : (- // @ts-ignore- <StorageExplorer bucket={bucket} />- )+ <div className="storage-container flex flex-grow p-4">+ {loaded ? (+ !bucket ? (+ <div className="flex h-full w-full items-center justify-center">+ <ProductEmptyState+ title="Storage"+ ctaButtonLabel="Create a new bucket"+ infoButtonLabel="About storage"+ infoButtonUrl="https://supabase.com/docs/guides/storage"+ onClickCta={openCreateBucketModal}+ >+ <p className="text-scale-1100 text-sm">+ Create buckets to store and serve any type of digital content.+ </p>+ <p className="text-scale-1100 text-sm">+ Make your buckets private or public depending on your security preference.+ </p>+ </ProductEmptyState>+ </div>) : (- <div />- )}- </div>- </StorageLayout>+ // @ts-ignore+ <StorageExplorer bucket={bucket} />+ )+ ) : (+ <div />+ )}+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <StorageLayout title="Buckets">{page}</StorageLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/storage/buckets/index.tsx b/studio/pages/project/[ref]/storage/buckets/index.tsxindex 441de7b110e..1204c62c4fe 100644--- a/studio/pages/project/[ref]/storage/buckets/index.tsx+++ b/studio/pages/project/[ref]/storage/buckets/index.tsx@@ -3,17 +3,18 @@ import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'import { API_URL } from 'lib/constants'-import { withAuth, useStore } from 'hooks'+import { useStore } from 'hooks'import { post } from 'lib/common/fetch'import { PROJECT_STATUS } from 'lib/constants'import { StorageLayout } from 'components/layouts'import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'+import { NextPageWithLayout } from 'types'/*** PageLayout is used to setup layout - as usual it will requires inject global store*/-const PageLayout = ({}) => {+const PageLayout: NextPageWithLayout = ({}) => {const router = useRouter()const { ref } = router.query@@ -32,25 +33,25 @@ const PageLayout = ({}) => {if (!project) return <div></div>return (- <StorageLayout title="Buckets">- <div className="storage-container flex flex-grow">- <ProductEmptyState- title="Storage"- ctaButtonLabel="Create a new bucket"- infoButtonLabel="About storage"- infoButtonUrl="https://supabase.com/docs/guides/storage"- onClickCta={openCreateBucketModal}- >- <p className="text-sm text-scale-1100">- Create buckets to store and serve any type of digital content.- </p>- <p className="text-sm text-scale-1100">- Make your buckets private or public depending on your security preference.- </p>- </ProductEmptyState>- </div>- </StorageLayout>+ <div className="storage-container flex flex-grow">+ <ProductEmptyState+ title="Storage"+ ctaButtonLabel="Create a new bucket"+ infoButtonLabel="About storage"+ infoButtonUrl="https://supabase.com/docs/guides/storage"+ onClickCta={openCreateBucketModal}+ >+ <p className="text-scale-1100 text-sm">+ Create buckets to store and serve any type of digital content.+ </p>+ <p className="text-scale-1100 text-sm">+ Make your buckets private or public depending on your security preference.+ </p>+ </ProductEmptyState>+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <StorageLayout title="Buckets">{page}</StorageLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/storage/index.tsx b/studio/pages/project/[ref]/storage/index.tsxindex 8c416a36b32..884d5909fff 100644--- a/studio/pages/project/[ref]/storage/index.tsx+++ b/studio/pages/project/[ref]/storage/index.tsx@@ -1,15 +1,12 @@-import { NextPage } from 'next'import { observer } from 'mobx-react-lite'-import { withAuth } from 'hooks'import { StorageLayout } from 'components/layouts'+import { NextPageWithLayout } from 'types'-const Storage: NextPage = () => {- return (- <StorageLayout title="Storage">- <>{/* <h1>Use this as a template for storage pages</h1> */}</>- </StorageLayout>- )+const Storage: NextPageWithLayout = () => {+ return <>{/* <h1>Use this as a template for storage pages</h1> */}</>}-export default withAuth(observer(Storage))+Storage.getLayout = (page) => <StorageLayout title="Storage">{page}</StorageLayout>++export default observer(Storage)diff --git a/studio/pages/project/[ref]/storage/policies.tsx b/studio/pages/project/[ref]/storage/policies.tsxindex 51270b251bd..340b0faf7af 100644--- a/studio/pages/project/[ref]/storage/policies.tsx+++ b/studio/pages/project/[ref]/storage/policies.tsx@@ -5,14 +5,15 @@ import { observer } from 'mobx-react-lite'import { API_URL } from 'lib/constants'import { post } from 'lib/common/fetch'import { PROJECT_STATUS } from 'lib/constants'-import { useStore, withAuth } from 'hooks'+import { useStore } from 'hooks'import { StorageLayout } from 'components/layouts'import { StoragePolicies } from 'components/to-be-cleaned/Storage'+import { NextPageWithLayout } from 'types'/*** PageLayout is used to setup layout - as usual it will requires inject global store*/-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const router = useRouter()const { ref } = router.query@@ -28,12 +29,12 @@ const PageLayout = () => {if (!project) return <div></div>return (- <StorageLayout title="Policies">- <div className="storage-container flex flex-grow p-4">- <StoragePolicies />- </div>- </StorageLayout>+ <div className="storage-container flex flex-grow p-4">+ <StoragePolicies />+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <StorageLayout title="Policies">{page}</StorageLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/storage/settings.tsx b/studio/pages/project/[ref]/storage/settings.tsxindex ecb47812553..4de917bef40 100644--- a/studio/pages/project/[ref]/storage/settings.tsx+++ b/studio/pages/project/[ref]/storage/settings.tsx@@ -3,15 +3,16 @@ import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'import { API_URL, PROJECT_STATUS } from 'lib/constants'-import { useStore, withAuth } from 'hooks'+import { useStore } from 'hooks'import { post } from 'lib/common/fetch'import { StorageLayout } from 'components/layouts'import { StorageSettings } from 'components/to-be-cleaned/Storage'+import { NextPageWithLayout } from 'types'/*** PageLayout is used to setup layout - as usual it will requires inject global store*/-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const router = useRouter()const { ref } = router.query@@ -27,12 +28,12 @@ const PageLayout = () => {if (!project) return <div></div>return (- <StorageLayout title="Settings">- <div className="storage-container flex flex-grow p-4">- <StorageSettings projectRef={ref} />- </div>- </StorageLayout>+ <div className="storage-container flex flex-grow p-4">+ <StorageSettings projectRef={ref} />+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <StorageLayout title="Settings">{page}</StorageLayout>++export default observer(PageLayout)diff --git a/studio/pages/project/[ref]/storage/usage.tsx b/studio/pages/project/[ref]/storage/usage.tsxindex 72518d5cd79..3f3e7fc2849 100644--- a/studio/pages/project/[ref]/storage/usage.tsx+++ b/studio/pages/project/[ref]/storage/usage.tsx@@ -3,16 +3,17 @@ import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'import { API_URL } from 'lib/constants'-import { useStore, withAuth } from 'hooks'+import { useStore } from 'hooks'import { post } from 'lib/common/fetch'import { PROJECT_STATUS } from 'lib/constants'import { StorageLayout } from 'components/layouts'import { StorageUsage } from 'components/to-be-cleaned/Storage'+import { NextPageWithLayout } from 'types'/*** PageLayout is used to setup layout - as usual it will requires inject global store*/-const PageLayout = () => {+const PageLayout: NextPageWithLayout = () => {const router = useRouter()const { ref } = router.query@@ -28,12 +29,12 @@ const PageLayout = () => {if (!project) return <div></div>return (- <StorageLayout title="Usage">- <div className="storage-container flex flex-grow">- <StorageUsage />- </div>- </StorageLayout>+ <div className="storage-container flex flex-grow">+ <StorageUsage />+ </div>)}-export default withAuth(observer(PageLayout))+PageLayout.getLayout = (page) => <StorageLayout title="Usage">{page}</StorageLayout>++export default observer(PageLayout)