import { useMemo } from 'react' import { ModelExtension, ExtensionType } from '@janhq/core' import { Model } from '@janhq/core' 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 { extensionManager } from '@/extension' import { downloadingModelsAtom } from '@/helpers/atoms/Model.atom' type Props = { model: Model isFromList?: boolean } export default function ModalCancelDownload({ model, isFromList }: Props) { const { modelDownloadStateAtom } = useDownloadState() const downloadAtom = useMemo( () => atom((get) => get(modelDownloadStateAtom)[model.id]), // eslint-disable-next-line react-hooks/exhaustive-deps [model.id] ) const downloadState = useAtomValue(downloadAtom) const cancelText = `Cancel ${formatDownloadPercentage(downloadState.percent)}` return ( {isFromList ? ( ) : ( )} Cancel Download

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

) }