import styles from "./UpdateModal.module.scss"; import { useTranslation } from "react-i18next"; import { useStore_OpenedQuickSetting } from "@store"; import { useComputeMode, useUpdateSoftware } from "@logics_common"; import { useIsSoftwareUpdating, useIsSoftwareUpdateAvailable } from "@logics_common"; import clsx from "clsx"; export const UpdateModal = () => { const { t } = useTranslation(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); const { updateSoftware, updateSoftware_CUDA } = useUpdateSoftware(); const { updateIsSoftwareUpdating } = useIsSoftwareUpdating(); const { currentComputeMode } = useComputeMode(); const { currentIsSoftwareUpdateAvailable } = useIsSoftwareUpdateAvailable(); const is_latest_version_already = currentIsSoftwareUpdateAvailable.data === false; const is_cpu_version = currentComputeMode.data === "cpu"; const onClickUpdateSoftware = () => { updateIsSoftwareUpdating(true); updateSoftware(); } const onClickUpdateSoftware_CUDA = () => { updateIsSoftwareUpdating(true); updateSoftware_CUDA(); } const cpu_accept_button_class_name = clsx(styles.accept_button, { [styles.current_compute_version]: is_cpu_version, [styles.is_latest_version_already]: is_latest_version_already, }) const cuda_accept_button_class_name = clsx(styles.accept_button, { [styles.current_compute_version]: !is_cpu_version, [styles.is_latest_version_already]: is_latest_version_already, }) return (
{t("update_modal.download_latest_and_restart")}
{props.desc}
{t("update_modal.is_latest_version_already")}
; } return{t("update_modal.is_current_compute_device")}
; };