[Update] Config Page: Advanced Settings Tab. Add modal and section that is switchable between CPU and CUDA version.

This commit is contained in:
Sakamoto Shiina
2024-12-20 01:28:44 +09:00
parent 0eec985a62
commit 1d615ab97d
12 changed files with 238 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
import styles from "./UpdateModal.module.scss";
import { useTranslation } from "react-i18next";
import { useStore_OpenedQuickSetting } from "@store";
import { useUpdateSoftware } from "@logics_common";
import { useComputeMode, useUpdateSoftware } from "@logics_common";
import { useIsSoftwareUpdating } from "@logics_common";
export const UpdateModal = () => {
@@ -9,18 +9,26 @@ export const UpdateModal = () => {
const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting();
const { updateSoftware } = useUpdateSoftware();
const { updateIsSoftwareUpdating } = useIsSoftwareUpdating();
const { currentComputeMode } = useComputeMode();
const is_cpu_version = currentComputeMode.data === "cpu";
const onClickUpdateSoftware = () => {
updateIsSoftwareUpdating(true);
updateSoftware();
// Update to the same as now compute device
if (is_cpu_version === true) {
updateSoftware();
} else {
updateSoftware_CUDA();
}
};
return (
<div className={styles.container}>
<p className={styles.label}>{t("main_page.update_software_desc")}</p>
<p className={styles.label}>{t("update_modal.update_software_desc")}</p>
<div className={styles.button_wrapper}>
<button className={styles.deny_button} onClick={() => updateOpenedQuickSetting("")} >{t("main_page.deny_update_software")}</button>
<button className={styles.accept_button} onClick={onClickUpdateSoftware}>{t("main_page.accept_update_software")}</button>
<button className={styles.deny_button} onClick={() => updateOpenedQuickSetting("")} >{t("update_modal.deny_update_software")}</button>
<button className={styles.accept_button} onClick={onClickUpdateSoftware}>{t("update_modal.accept_update_software")}</button>
</div>
</div>
);