Skip to content

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

chore: feature flag for new Storage UI (#39093)

Danny Whitef596989ed474
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
index f7448acba98..9a56fd87b21 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
@@ -1,9 +1,16 @@
import { LOCAL_STORAGE_KEYS } from 'common'
export const FEATURE_PREVIEWS = [
+ {
+ key: LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI,
+ name: 'New Storage interface',
+ discussionsUrl: undefined,
+ isNew: true,
+ isPlatformOnly: false,
+ },
{
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS,
- name: 'New Logs Interface',
+ name: 'New Logs interface',
discussionsUrl: 'https://github.com/orgs/supabase/discussions/37234',
isNew: true,
isPlatformOnly: true,
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
index e33348dd18d..885724aca13 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
@@ -110,12 +110,18 @@ export const useIsAdvisorRulesEnabled = () => {
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ADVISOR_RULES]
}
+export const useIsNewStorageUIEnabled = () => {
+ const { flags } = useFeaturePreviewContext()
+ return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI]
+}
+
export const useFeaturePreviewModal = () => {
const [featurePreviewModal, setFeaturePreviewModal] = useQueryState('featurePreviewModal')
const gitlessBranchingEnabled = useFlag('gitlessBranching')
const advisorRulesEnabled = useFlag('advisorRules')
const isUnifiedLogsPreviewAvailable = useFlag('unifiedLogs')
+ const isNewStorageUIAvailable = useFlag('storageAnalyticsVector')
const selectedFeatureKeyFromQuery = featurePreviewModal?.trim() ?? null
const showFeaturePreviewModal = selectedFeatureKeyFromQuery !== null
@@ -130,6 +136,8 @@ export const useFeaturePreviewModal = () => {
return advisorRulesEnabled
case 'supabase-ui-preview-unified-logs':
return isUnifiedLogsPreviewAvailable
+ case 'new-storage-ui':
+ return isNewStorageUIAvailable
default:
return true
}
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
index 751c08f92c9..ec463be8a64 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
@@ -14,6 +14,7 @@ import { CLSPreview } from './CLSPreview'
import { FEATURE_PREVIEWS } from './FeaturePreview.constants'
import { useFeaturePreviewContext, useFeaturePreviewModal } from './FeaturePreviewContext'
import { InlineEditorPreview } from './InlineEditorPreview'
+import { NewStorageUIPreview } from './NewStorageUIPreview'
import { UnifiedLogsPreview } from './UnifiedLogsPreview'
const FEATURE_PREVIEW_KEY_TO_CONTENT: {
@@ -25,6 +26,7 @@ const FEATURE_PREVIEW_KEY_TO_CONTENT: {
[LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL]: <APISidePanelPreview />,
[LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS]: <CLSPreview />,
[LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS]: <UnifiedLogsPreview />,
+ [LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI]: <NewStorageUIPreview />,
}
const FeaturePreviewModal = () => {
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx
new file mode 100644
index 00000000000..6225b04d523
--- /dev/null
+++ b/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx
@@ -0,0 +1,42 @@
+import Image from 'next/image'
+
+import { useParams } from 'common'
+import { InlineLink } from 'components/ui/InlineLink'
+import { BASE_PATH } from 'lib/constants'
+import { useIsNewStorageUIEnabled } from './FeaturePreviewContext'
+
+export const NewStorageUIPreview = () => {
+ const { ref } = useParams()
+ const isStorageV2 = useIsNewStorageUIEnabled()
+
+ return (
+ <div className="text-sm text-foreground-light">
+ <p className=" mb-4">
+ Experience our enhanced{' '}
+ <InlineLink href={`/project/${ref ?? '_'}/storage/${isStorageV2 ? 'files' : 'buckets'}`}>
+ Storage interface
+ </InlineLink>{' '}
+ with support for analytics and vector bucket types.
+ </p>
+ <Image
+ alt="new-storage-preview"
+ src={`${BASE_PATH}/img/previews/new-storage-preview.png`}
+ width={1160}
+ height={658}
+ className="rounded border mb-4"
+ />
+ <div className="space-y-2 !mt-4">
+ <p className="text-foreground">Enabling this preview will:</p>
+ <ul className="list-disc pl-6 space-y-1">
+ <li>Move Storage buckets from the sidebar into the main content area</li>
+ <li>Change the role of the sidebar to a bucket type selector</li>
+ <li>Nest settings and policies under their respective bucket types</li>
+ </ul>
+ <p>
+ These changes are necessary to support incoming analytics and vector bucket types. File
+ storage will remain the default, and be shown by default when entering Storage.
+ </p>
+ </div>
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
index b757cba8f45..0edff67d49f 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
@@ -16,7 +16,7 @@ export const UnifiedLogsPreview = () => {
className="rounded border mb-4"
/>
<p className="text-foreground-light text-sm mb-4">
- Experience our enhanced logs interface with improved filtering, real-time updates, and a
+ Experience our enhanced Logs interface with improved filtering, real-time updates, and a
unified view across all your services. Built for better performance and easier debugging.
</p>
<p className="text-foreground-light text-sm mb-4">
@@ -26,8 +26,8 @@ export const UnifiedLogsPreview = () => {
<p className="text-sm">Enabling this preview will:</p>
<ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">
<li>
- Replace the current logs interface on the{' '}
- <InlineLink href={`/project/${ref}/logs`}>logs page</InlineLink> with a unified view
+ Replace the current Logs interface on the{' '}
+ <InlineLink href={`/project/${ref}/logs`}>Logs page</InlineLink> with a unified view
</li>
<li>Provide enhanced filtering capabilities and real-time log streaming</li>
<li>Improve performance with optimized data loading and virtualization</li>
diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsx
index a4a7b9b4ea5..63c0ee2600e 100644
--- a/apps/studio/components/interfaces/Sidebar.tsx
+++ b/apps/studio/components/interfaces/Sidebar.tsx
@@ -43,6 +43,7 @@ import {
} from 'ui'
import {
useIsAPIDocsSidePanelEnabled,
+ useIsNewStorageUIEnabled,
useUnifiedLogsPreview,
} from './App/FeaturePreview/FeaturePreviewContext'
@@ -222,10 +223,13 @@ const ProjectLinks = () => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
const snap = useAppStateSnapshot()
- const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
const { securityLints, errorLints } = useLints()
const showReports = useIsFeatureEnabled('reports:all')
+ const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
+ const isStorageV2 = useIsNewStorageUIEnabled()
+ const { isEnabled: isUnifiedLogsEnabled } = useUnifiedLogsPreview()
+
const activeRoute = router.pathname.split('/')[3]
const {
@@ -246,10 +250,8 @@ const ProjectLinks = () => {
edgeFunctions: edgeFunctionsEnabled,
storage: storageEnabled,
realtime: realtimeEnabled,
+ isStorageV2,
})
-
- const { isEnabled: isUnifiedLogsEnabled } = useUnifiedLogsPreview()
-
const otherRoutes = generateOtherRoutes(ref, project, {
unifiedLogs: isUnifiedLogsEnabled,
showReports,
diff --git a/apps/studio/components/interfaces/Storage/Storage.constants.ts b/apps/studio/components/interfaces/Storage/Storage.constants.ts
index 674153a2cc0..9dc6cae7b37 100644
--- a/apps/studio/components/interfaces/Storage/Storage.constants.ts
+++ b/apps/studio/components/interfaces/Storage/Storage.constants.ts
@@ -1,3 +1,6 @@
+import { DOCS_URL } from 'lib/constants'
+
+// Original storage constants
export enum URL_EXPIRY_DURATION {
WEEK = 60 * 60 * 24 * 7,
MONTH = 60 * 60 * 24 * 30,
@@ -56,3 +59,26 @@ export const CONTEXT_MENU_KEYS = {
STORAGE_ITEM: 'STORAGE_ITEM',
STORAGE_FOLDER: 'STORAGE_FOLDER',
}
+
+// New bucket types configuration
+
+export const BUCKET_TYPES = {
+ files: {
+ displayName: 'Files',
+ description: 'General file storage for most types of digital content.',
+ docsUrl: `${DOCS_URL}/guides/storage/buckets/fundamentals`,
+ },
+ analytics: {
+ displayName: 'Analytics',
+ description: 'Purpose-built storage for analytical workloads.',
+ docsUrl: `${DOCS_URL}/guides/storage/analytics/introduction`,
+ },
+ vectors: {
+ displayName: 'Vectors',
+ description: 'Purpose-built storage for vector data.',
+ docsUrl: `${DOCS_URL}/guides/storage/vectors`,
+ },
+}
+
+export const BUCKET_TYPE_KEYS = Object.keys(BUCKET_TYPES) as Array<keyof typeof BUCKET_TYPES>
+export const DEFAULT_BUCKET_TYPE: keyof typeof BUCKET_TYPES = 'files'
diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.tsx
index 86f85653f4d..40dca82bbfe 100644
--- a/apps/studio/components/interfaces/Storage/StorageMenu.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageMenu.tsx
@@ -7,6 +7,7 @@ import { CreateBucketModal } from 'components/interfaces/Storage/CreateBucketMod
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { useBucketsQuery } from 'data/storage/buckets-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
+import { IS_PLATFORM } from 'lib/constants'
import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, Menu } from 'ui'
import {
@@ -16,10 +17,9 @@ import {
InnerSideBarFilterSortDropdown,
InnerSideBarFilterSortDropdownItem,
} from 'ui-patterns/InnerSideMenu'
-import { IS_PLATFORM } from 'lib/constants'
import { BucketRow } from './BucketRow'
-const StorageMenu = () => {
+export const StorageMenu = () => {
const router = useRouter()
const { ref, bucketId } = useParams()
const { data: projectDetails } = useSelectedProjectQuery()
@@ -169,5 +169,3 @@ const StorageMenu = () => {
</>
)
}
-
-export default StorageMenu
diff --git a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
new file mode 100644
index 00000000000..e5b8e8592ef
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
@@ -0,0 +1,30 @@
+import { useParams } from 'common'
+import Link from 'next/link'
+import { Menu } from 'ui'
+import { BUCKET_TYPES, BUCKET_TYPE_KEYS, DEFAULT_BUCKET_TYPE } from './Storage.constants'
+
+export const StorageMenuV2 = () => {
+ const { ref, bucketType } = useParams()
+ const selectedBucketType = bucketType || DEFAULT_BUCKET_TYPE
+
+ return (
+ <Menu type="pills" className="mt-6 flex flex-grow flex-col">
+ <div className="mx-3">
+ <Menu.Group title={<span className="uppercase font-mono">Bucket Types</span>} />
+
+ {BUCKET_TYPE_KEYS.map((bucketTypeKey) => {
+ const isSelected = selectedBucketType === bucketTypeKey
+ const config = BUCKET_TYPES[bucketTypeKey]
+
+ return (
+ <Link key={bucketTypeKey} href={`/project/${ref}/storage/${bucketTypeKey}`}>
+ <Menu.Item rounded active={isSelected}>
+ <p className="truncate">{config.displayName}</p>
+ </Menu.Item>
+ </Link>
+ )
+ })}
+ </div>
+ </Menu>
+ )
+}
diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index c08feee6cd6..2f0b698771c 100644
--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -41,10 +41,17 @@ export const generateToolRoutes = (ref?: string, project?: Project, features?: {
},
]
}
+
export const generateProductRoutes = (
ref?: string,
project?: Project,
- features?: { auth?: boolean; edgeFunctions?: boolean; storage?: boolean; realtime?: boolean }
+ features?: {
+ auth?: boolean
+ edgeFunctions?: boolean
+ storage?: boolean
+ realtime?: boolean
+ isStorageV2?: boolean
+ }
): Route[] => {
const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
@@ -54,6 +61,7 @@ export const generateProductRoutes = (
const edgeFunctionsEnabled = features?.edgeFunctions ?? true
const storageEnabled = features?.storage ?? true
const realtimeEnabled = features?.realtime ?? true
+ const isStorageV2 = features?.isStorageV2 ?? false
const databaseMenu = generateDatabaseMenu(project)
const authMenu = generateAuthMenu(ref as string)
@@ -89,7 +97,11 @@ export const generateProductRoutes = (
key: 'storage',
label: 'Storage',
icon: <Storage size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`),
+ link:
+ ref &&
+ (isProjectBuilding
+ ? buildingUrl
+ : `/project/${ref}/storage/${isStorageV2 ? 'files' : 'buckets'}`),
},
]
: []),
diff --git a/apps/studio/components/layouts/StorageLayout/BucketLayout.tsx b/apps/studio/components/layouts/StorageLayout/BucketLayout.tsx
new file mode 100644
index 00000000000..53d2a252e6f
--- /dev/null
+++ b/apps/studio/components/layouts/StorageLayout/BucketLayout.tsx
@@ -0,0 +1,30 @@
+import { PropsWithChildren } from 'react'
+
+import { useParams } from 'common'
+import { BUCKET_TYPES, DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
+import { DocsButton } from 'components/ui/DocsButton'
+import DefaultLayout from '../DefaultLayout'
+import { PageLayout } from '../PageLayout/PageLayout'
+import { ScaffoldContainer } from '../Scaffold'
+import StorageLayout from './StorageLayout'
+
+export const BucketTypeLayout = ({ children }: PropsWithChildren) => {
+ const { bucketType } = useParams()
+ const bucketTypeKey = bucketType || DEFAULT_BUCKET_TYPE
+ const config = BUCKET_TYPES[bucketTypeKey as keyof typeof BUCKET_TYPES]
+ const secondaryActions = [<DocsButton key="docs" href={config.docsUrl} />]
+
+ return (
+ <DefaultLayout>
+ <StorageLayout title="Storage">
+ <PageLayout
+ title={`${config?.displayName || 'Storage'} Buckets`}
+ subtitle={config?.description || 'Manage your storage buckets and files.'}
+ secondaryActions={secondaryActions}
+ >
+ <ScaffoldContainer>{children}</ScaffoldContainer>
+ </PageLayout>
+ </StorageLayout>
+ </DefaultLayout>
+ )
+}
diff --git a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
index 79c1898809f..101a5c519c9 100644
--- a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
+++ b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
@@ -1,6 +1,8 @@
import { ReactNode } from 'react'
-import StorageMenu from 'components/interfaces/Storage/StorageMenu'
+import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { StorageMenu } from 'components/interfaces/Storage/StorageMenu'
+import { StorageMenuV2 } from 'components/interfaces/Storage/StorageMenuV2'
import { withAuth } from 'hooks/misc/withAuth'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
@@ -10,12 +12,14 @@ export interface StorageLayoutProps {
}
const StorageLayout = ({ title, children }: StorageLayoutProps) => {
+ const isStorageV2 = useIsNewStorageUIEnabled()
+
return (
<ProjectLayout
- stickySidebarBottom
+ stickySidebarBottom={isStorageV2 ? false : true}
title={title || 'Storage'}
product="Storage"
- productMenu={<StorageMenu />}
+ productMenu={isStorageV2 ? <StorageMenuV2 /> : <StorageMenu />}
>
{children}
</ProjectLayout>
diff --git a/apps/studio/hooks/ui/useFlag.ts b/apps/studio/hooks/ui/useFlag.ts
index 979334882d3..3ad15f0cc5e 100644
--- a/apps/studio/hooks/ui/useFlag.ts
+++ b/apps/studio/hooks/ui/useFlag.ts
@@ -1,8 +1,7 @@
import * as Sentry from '@sentry/nextjs'
-import { useFeatureFlags, useFlag } from 'common'
+import { useFeatureFlags } from 'common'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { trackFeatureFlag } from 'lib/posthog'
const isObjectEmpty = (obj: Object) => {
diff --git a/apps/studio/pages/project/[ref]/storage/[bucketType]/index.tsx b/apps/studio/pages/project/[ref]/storage/[bucketType]/index.tsx
new file mode 100644
index 00000000000..c762752bc47
--- /dev/null
+++ b/apps/studio/pages/project/[ref]/storage/[bucketType]/index.tsx
@@ -0,0 +1,40 @@
+import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+
+import { useParams } from 'common'
+import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { BUCKET_TYPES, DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
+import { BucketTypeLayout } from 'components/layouts/StorageLayout/BucketLayout'
+import type { NextPageWithLayout } from 'types'
+
+const BucketTypePage: NextPageWithLayout = () => {
+ const router = useRouter()
+ const { bucketType, ref } = useParams()
+ const isStorageV2 = useIsNewStorageUIEnabled()
+
+ const bucketTypeKey = bucketType || DEFAULT_BUCKET_TYPE
+ const config = BUCKET_TYPES[bucketTypeKey as keyof typeof BUCKET_TYPES]
+
+ useEffect(() => {
+ if (!isStorageV2) router.replace(`/project/${ref}/storage`)
+ }, [isStorageV2, ref])
+
+ useEffect(() => {
+ if (!config) {
+ router.replace(`/project/${ref}/storage`)
+ }
+ }, [config, ref, router])
+
+ return (
+ <div>
+ {/* [Danny] Purposefully duplicated directly below StorageLayout's config.description for now. Will be placed in a conditional empty state in next PR. TODO: consider reusing FormHeader for non-empty state.*/}
+ {/* <p className="text-foreground-light mb-4">{config.description}</p> */}
+ </div>
+ )
+}
+
+BucketTypePage.getLayout = (page) => {
+ return <BucketTypeLayout>{page}</BucketTypeLayout>
+}
+
+export default BucketTypePage
diff --git a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx b/apps/studio/pages/project/[ref]/storage/buckets/index.tsx
index 4ca7587160f..6cefe0c843d 100644
--- a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx
+++ b/apps/studio/pages/project/[ref]/storage/buckets/index.tsx
@@ -1,5 +1,9 @@
import { useParams } from 'common'
+import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError'
import DefaultLayout from 'components/layouts/DefaultLayout'
import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
@@ -9,17 +13,22 @@ import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import type { NextPageWithLayout } from 'types'
-/**
- * PageLayout is used to setup layout - as usual it will requires inject global store
- */
const PageLayout: NextPageWithLayout = () => {
const { ref } = useParams()
+ const router = useRouter()
+ const isStorageV2 = useIsNewStorageUIEnabled()
const { data: project } = useSelectedProjectQuery()
const { error, isError } = useBucketsQuery({ projectRef: ref })
+ useEffect(() => {
+ if (isStorageV2) {
+ router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`)
+ }
+ }, [isStorageV2, ref, router])
+
if (!project) return null
- if (isError) <StorageBucketsError error={error as any} />
+ if (isError) return <StorageBucketsError error={error as any} />
return (
<div className="storage-container flex flex-grow">
diff --git a/apps/studio/pages/project/[ref]/storage/index.tsx b/apps/studio/pages/project/[ref]/storage/index.tsx
index 153afc04db5..0b9672eb09d 100644
--- a/apps/studio/pages/project/[ref]/storage/index.tsx
+++ b/apps/studio/pages/project/[ref]/storage/index.tsx
@@ -1,9 +1,27 @@
-import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
+import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+
+import { useParams } from 'common'
+import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
import DefaultLayout from 'components/layouts/DefaultLayout'
+import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
import type { NextPageWithLayout } from 'types'
const Storage: NextPageWithLayout = () => {
- return <>{/* <h1>Use this as a template for storage pages</h1> */}</>
+ const { ref } = useParams()
+ const router = useRouter()
+ const isStorageV2 = useIsNewStorageUIEnabled()
+
+ useEffect(() => {
+ if (isStorageV2) {
+ router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`)
+ } else {
+ router.replace(`/project/${ref}/storage/buckets`)
+ }
+ }, [isStorageV2, ref, router])
+
+ return null
}
Storage.getLayout = (page) => (
diff --git a/apps/studio/public/img/previews/new-storage-preview.png b/apps/studio/public/img/previews/new-storage-preview.png
new file mode 100644
index 00000000000..18e6b9344d6
Binary files /dev/null and b/apps/studio/public/img/previews/new-storage-preview.png differ
diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.ts
index 11e8d32ce6a..0ac015cb730 100644
--- a/packages/common/constants/local-storage.ts
+++ b/packages/common/constants/local-storage.ts
@@ -15,6 +15,7 @@ export const LOCAL_STORAGE_KEYS = {
UI_ONBOARDING_NEW_PAGE_SHOWN: 'supabase-ui-onboarding-new-page-shown',
UI_PREVIEW_BRANCHING_2_0: 'supabase-ui-branching-2-0',
UI_PREVIEW_ADVISOR_RULES: 'supabase-ui-advisor-rules',
+ UI_PREVIEW_NEW_STORAGE_UI: 'new-storage-ui',
NEW_LAYOUT_NOTICE_ACKNOWLEDGED: 'new-layout-notice-acknowledge',
TABS_INTERFACE_ACKNOWLEDGED: 'tabs-interface-acknowledge',