import { IS_PLATFORM, useParams } from 'common' import { useIsAnalyticsBucketsEnabled, useIsVectorBucketsEnabled, } from 'data/config/project-storage-config-query' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import Link from 'next/link' import { Badge, Menu } from 'ui' import { BUCKET_TYPES } from './Storage.constants' import { useStorageV2Page } from './Storage.utils' export const StorageMenuV2 = () => { const { ref } = useParams() const page = useStorageV2Page() const { storageAnalytics, storageVectors } = useIsFeatureEnabled([ 'storage:analytics', 'storage:vectors', ]) const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref }) const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef: ref }) const bucketTypes = Object.entries(BUCKET_TYPES).filter(([key]) => { if (key === 'analytics') return IS_PLATFORM && storageAnalytics if (key === 'vectors') return IS_PLATFORM && storageVectors return true }) return (
Manage} /> {bucketTypes.map(([type, config]) => { const isSelected = page === type const isAlphaEnabled = (type === 'analytics' && isAnalyticsBucketsEnabled) || (type === 'vectors' && isVectorBucketsEnabled) return (

{config.displayName}

{isAlphaEnabled && New}
) })}
{IS_PLATFORM && ( <>
Configuration} />

S3

)}
) }