import { useMemo } from 'react' import { PluginType } from '@janhq/core' import { ModelPlugin } from '@janhq/core/lib/plugins' import { Model } 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 { formatDownloadPercentage } from '@/utils/converter' import { downloadingModelsAtom } from '@/helpers/atoms/Model.atom' import { pluginManager } from '@/plugin' type Props = { suitableModel: Model isFromList?: boolean } export default function ModalCancelDownload({ suitableModel, isFromList, }: Props) { const { modelDownloadStateAtom } = useDownloadState() const downloadAtom = useMemo( () => atom((get) => get(modelDownloadStateAtom)[suitableModel.name]), // eslint-disable-next-line react-hooks/exhaustive-deps [suitableModel.name] ) const models = useAtomValue(downloadingModelsAtom) const downloadState = useAtomValue(downloadAtom) return ( {isFromList ? ( ) : ( )} Cancel Download

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

) }