import { useCallback } from 'react' import React from 'react' import { Modal, ModalClose, Button } from '@janhq/joi' import { Trash2Icon } from 'lucide-react' import { toaster } from '@/containers/Toast' import useThreads from '@/hooks/useThreads' type Props = { id: string title: string closeContextMenu?: () => void } const ModalDeleteThread: React.FC = ({ id, title, closeContextMenu, }) => { const { deleteThread } = useThreads() const onDeleteThreadClick = useCallback(async () => { await deleteThread(id) toaster({ title: 'Thread successfully deleted.', description: `Thread ${title} has been successfully deleted.`, type: 'success', }) }, [deleteThread, id, title]) return ( { if (open && closeContextMenu) { closeContextMenu() } }} trigger={
e.stopPropagation()} > Delete thread
} content={

Are you sure you want to delete this thread? This action cannot be undone.

e.stopPropagation()}>
} /> ) } export default React.memo(ModalDeleteThread)