Files
supabase/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx
Danny WhiteandJoshen Lim 5ff03b2971 feat: custom bucket icons (#39280)
* chore: separate interfaces per bucket type

* chore: reuse existing bucket creation modal for files

* chore: allow external trigger for new bucket modal

* chore: minor fixes

* chore: full-size empty state

* chore: files other tabs

* fix: show tab bar when on file subroute

* chore: use existing table component to list buckets

* fix: tests

* fix: build error

* chore: remove future bucket type components from PR

* fix: dependency

* Couple of refactors to simplify implementation

* Fix TS

* chore: move s3 settings out to sidebar

* fix: minor nits

* fix: reuse existing loading spinners from schema visualiser

* fix: loading for files

* fix: prevent loading of table for zero buckets

* chore: improved loading state

* chore: shimmer on table

* chore: copywriting on S3

* chore: improve empty states

* fix: deprecated input instructions

* fix: filter/search bucket table

* chore: tidy

* fix: tests

* first commit

* improve documentation and fix icon build error

* change svg kebab case to camel case for React

* copy nits

* fix svg codeblock color

* add bucket (normal) icon

* add bucket icon to policies

* add bucket icon to other storage bucket surfaces

* fix spacing on empty state

* fix inconsistent icons in home sections

Make 1:1 with what we have in the sidebar with optically-correct strokeWidth.

* fix icons

Like the previous commit, this makes sure we use the same product icons as in the sidebar.

* clearer bucket add icon naming

* remove unused layouts

* fix naming collision

* Tinnnnyyy nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-08 13:14:03 +11:00

30 lines
1.2 KiB
TypeScript

import { BucketAdd } from 'icons'
import { CreateBucketModal } from './CreateBucketModal'
import { BUCKET_TYPES } from './Storage.constants'
interface EmptyBucketStateProps {
bucketType: keyof typeof BUCKET_TYPES
}
export const EmptyBucketState = ({ bucketType }: EmptyBucketStateProps) => {
const config = BUCKET_TYPES[bucketType]
return (
<aside className="mt-12 border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-4 items-center text-center gap-1 text-balance">
<div className="flex flex-col gap-3 items-center text-center">
<BucketAdd size={24} strokeWidth={1.5} className="text-foreground-muted" />
<div className="flex flex-col gap-1">
<h3>Create {config.label}</h3>
<p className="text-foreground-light text-sm">{config.valueProp}</p>
</div>
</div>
{/* [Joshen] We can render the individual bucket modals here instead - where each modal has its own trigger */}
{/* [Danny] CreateBucketModal needs to be split into CreateFileBucketModal, CreateAnalyticsBucketModal, CreateVectorsBucketModal */}
{bucketType === 'files' && (
<CreateBucketModal buttonSize="tiny" buttonType="primary" buttonClassName="w-fit" />
)}
</aside>
)
}