Files
supabase/apps/studio/components/interfaces/Storage/NewBucketButton.tsx
T
Joshen Lim 27e89ed64e Analytics bucket support creating bucket tables in dashboard (#40858)
* Midway

* Hook up create/delete table, and update all iceberg RQs with mgmt API routes

* Add insert data CTA, update create table logic for decimal and fixed types

* Clean up

* Nit

* Fix test
2025-12-02 22:17:13 +08:00

35 lines
924 B
TypeScript

import { PermissionAction } from '@supabase/shared-types/out/constants'
import { Plus } from 'lucide-react'
import { MouseEventHandler } from 'react'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
export const CreateBucketButton = ({
onClick,
}: {
onClick?: MouseEventHandler<HTMLButtonElement>
}) => {
const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')
return (
<ButtonTooltip
block
size="tiny"
type="primary"
className="w-fit"
icon={<Plus size={14} />}
disabled={!canCreateBuckets}
onClick={onClick}
tooltip={{
content: {
side: 'bottom',
text: !canCreateBuckets ? 'You need additional permissions to create buckets' : undefined,
},
}}
>
New bucket
</ButtonTooltip>
)
}