import { useMemo } from 'react' import { ModelVersion } from '@janhq/core/lib/types' import { Modal, ModalTrigger, ModalClose, ModalFooter, ModalContent, ModalHeader, Button, ModalTitle, } from '@janhq/uikit' import { atom, useAtomValue } from 'jotai' import { useDownloadState } from '@/hooks/useDownloadState' import useGetPerformanceTag from '@/hooks/useGetPerformanceTag' import { formatDownloadPercentage } from '@/utils/converter' type Props = { suitableModel: ModelVersion isFromList?: boolean } export default function ModalCancelDownload({ suitableModel, isFromList, }: Props) { const { modelDownloadStateAtom } = useDownloadState() useGetPerformanceTag() const downloadAtom = useMemo( () => atom((get) => get(modelDownloadStateAtom)[suitableModel._id]), // eslint-disable-next-line react-hooks/exhaustive-deps [suitableModel._id] ) const downloadState = useAtomValue(downloadAtom) return ( {isFromList ? ( ) : ( )} Cancel Download

Are you sure you want to cancel the download of  {downloadState?.fileName}?

) }