Files
supabase/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx
784f77d398 Add example code for Vector buckets (#40440)
* Add examples.

* Move the button for creating a vector bucket outside of the dialog.

* Install the wrappers extension if missing when creating a vector bucket.

* Refactor the quick start code for vector buckets.

* Fix a type error.

* chore(studio): vector tables UI improvements (#40598)

* Add examples.

* clearer examples

* clearer dimension samples

* quick start as sheet

* improve structure

* cleanup

* icons and text size

* improve snippet code

* icons

* sql editor link

* cleanup

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>

* Minor naming fix.

* Fix the link to the Table Editor.

* Smol fix + refactor and clean up

* Nit

* Nit improvement

* Make the SQL option default.

* fix docs link

* fix example code

* remove redundant card

* Check if the project has secret keys or service role keys. Remove the NEXT_PUBLIC from the env vars to avoid exposing them to the FE.

---------

Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-27 11:26:25 +01:00

42 lines
1.3 KiB
TypeScript

import { BucketPlus } from 'icons'
import { EmptyStatePresentational } from 'ui-patterns'
import { CreateAnalyticsBucketModal } from './AnalyticsBuckets/CreateAnalyticsBucketModal'
import { CreateBucketModal } from './CreateBucketModal'
import { BUCKET_TYPES } from './Storage.constants'
import { CreateVectorBucketButton } from './VectorBuckets/CreateVectorBucketDialog'
interface EmptyBucketStateProps {
bucketType: keyof typeof BUCKET_TYPES
className?: string
onCreateBucket?: () => void
}
export const EmptyBucketState = ({
bucketType,
className,
onCreateBucket,
}: EmptyBucketStateProps) => {
const config = BUCKET_TYPES[bucketType]
return (
<EmptyStatePresentational
icon={BucketPlus}
title={`Create ${config.article} ${config.singularName} bucket`}
description={config.valueProp}
className={className}
>
{bucketType === 'files' && (
<CreateBucketModal buttonSize="tiny" buttonType="primary" buttonClassName="w-fit" />
)}
{bucketType === 'analytics' && (
<CreateAnalyticsBucketModal
buttonSize="tiny"
buttonType="primary"
buttonClassName="w-fit"
/>
)}
{bucketType === 'vectors' && <CreateVectorBucketButton onClick={onCreateBucket} />}
</EmptyStatePresentational>
)
}