import { m } from '@/paraglide/messages'; import useHasPermission from '@hooks/use-has-permission'; import usePreventAutoFocus from '@hooks/use-prevent-auto-focus'; import { cn } from '@lib/utils'; import { PlusIcon } from '@phosphor-icons/react'; import { Button } from '@ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from '@ui/dialog'; import { Skeleton } from '@ui/skeleton'; import { useState } from 'react'; import CreateNewBoxForm from '../form/box/create-new-box-form'; type CreateNewBoxProps = { className?: string; }; const CreateBoxAction = ({ className }: CreateNewBoxProps) => { const { hasPermission, isLoading } = useHasPermission('box', 'create'); const [_open, _setOpen] = useState(false); const prevent = usePreventAutoFocus(); if (isLoading) { return ; } if (!hasPermission) return null; return ( e.preventDefault()} > {m.nav_add_new()} {m.nav_add_new()} ); }; export default CreateBoxAction;