import { Dialog } from '@umami/react-zen'; import { ActionButton } from '@/components/input/ActionButton'; import { Trash } from '@/components/icons'; import { ConfirmationForm } from '@/components/common/ConfirmationForm'; import { messages } from '@/components/messages'; import { useDeleteQuery, useMessages } from '@/components/hooks'; export function SegmentDeleteButton({ segmentId, websiteId, name, onSave, }: { segmentId: string; websiteId: string; name: string; onSave?: () => void; }) { const { formatMessage, labels } = useMessages(); const { mutateAsync, isPending, error, touch } = useDeleteQuery( `/websites/${websiteId}/segments/${segmentId}`, ); const handleConfirm = async (close: () => void) => { await mutateAsync(null, { onSuccess: () => { touch('segments'); onSave?.(); close(); }, }); }; return ( }> {({ close }) => ( )} ); }