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 CohortDeleteButton({ cohortId, websiteId, name, onSave, }: { cohortId: string; websiteId: string; name: string; onSave?: () => void; }) { const { formatMessage, labels } = useMessages(); const { mutate, isPending, error, touch } = useDeleteQuery( `/websites/${websiteId}/segments/${cohortId}`, ); const handleConfirm = (close: () => void) => { mutate(null, { onSuccess: () => { touch('cohorts'); onSave?.(); close(); }, }); }; return ( }> {({ close }) => ( )} ); }