import { useCallback, memo } from 'react' import { Modal, ModalClose, Button } from '@janhq/joi' import { useAtom, useAtomValue } from 'jotai' import useDeleteThread from '@/hooks/useDeleteThread' import { janDataFolderPathAtom } from '@/helpers/atoms/AppConfig.atom' import { modalActionThreadAtom, ThreadModalAction, threadsAtom, } from '@/helpers/atoms/Thread.atom' const ModalDeleteAllThreads = () => { const { deleteAllThreads } = useDeleteThread() const [modalActionThread, setModalActionThread] = useAtom( modalActionThreadAtom ) const [threads] = useAtom(threadsAtom) const janDataFolderPath = useAtomValue(janDataFolderPathAtom) const onDeleteAllThreads = useCallback( (e: React.MouseEvent) => { e.stopPropagation() deleteAllThreads(threads) }, [deleteAllThreads, threads] ) const onCloseModal = useCallback(() => { setModalActionThread({ showModal: undefined, thread: undefined, }) }, [setModalActionThread]) return (

Are you sure you want to delete all chat history? This will remove{' '} all {threads.length} conversation threads in{' '} {janDataFolderPath}\threads and cannot be undone.

e.stopPropagation()}>
} /> ) } export default memo(ModalDeleteAllThreads)