import { useEffect, useState } from 'react'; import { Database } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { IconTile } from '@/components/ui/icon-tile'; import { toast } from 'sonner'; interface CreateBucketDialogProps { open: boolean; onOpenChange: (open: boolean) => void; onCreateBucket: (name: string) => Promise; } export function CreateBucketDialog({ open, onOpenChange, onCreateBucket }: CreateBucketDialogProps) { const [bucketName, setBucketName] = useState(''); useEffect(() => { if (!open) setBucketName(''); }, [open]); const handleCreate = async () => { if (!bucketName) { toast.error('Please enter a bucket name'); return; } const success = await onCreateBucket(bucketName); if (success) { setBucketName(''); onOpenChange(false); } }; return ( } tone="primary" size="md" />
Create New Bucket Create a new storage bucket for your objects
setBucketName(e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter') { handleCreate(); } }} />

Must be unique and follow DNS naming conventions

); }