From 599161b7b241fcc9338cc780d19010467e16a1e7 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:44:31 +0100 Subject: [PATCH] [578] Some adjustments --- assets/jsons/translations/de.json | 9 +-- assets/jsons/translations/en.json | 9 +-- assets/jsons/translations/es.json | 9 +-- assets/jsons/translations/fr.json | 9 +-- assets/jsons/translations/ja.json | 9 +-- assets/jsons/translations/ru.json | 9 +-- assets/jsons/translations/zh-tw.json | 9 +-- assets/jsons/translations/zh.json | 9 +-- ... choose-proton-folder-modal.component.tsx} | 60 +++++++++---------- .../shared/bsm-button.component.tsx | 2 +- src/renderer/services/setup.service.ts | 4 +- 11 files changed, 70 insertions(+), 68 deletions(-) rename src/renderer/components/modal/modal-types/setup/{linux-setup-modal.component.tsx => choose-proton-folder-modal.component.tsx} (63%) diff --git a/assets/jsons/translations/de.json b/assets/jsons/translations/de.json index 0cab3ff4..0e9b6733 100644 --- a/assets/jsons/translations/de.json +++ b/assets/jsons/translations/de.json @@ -835,10 +835,11 @@ "default": "Standard", "default-tooltip": "Standardmäßig in Ihrem persönlichen Ordner" }, - "linux-setup": { - "title": "Linux-Setup", - "proton-folder": "Proton-Ordner", - "proton-folder-description": "Wählen Sie den Ordner zum Proton-Pfad aus. (z. B. Proton - Experimental)" + "choose-proton-folder": { + "title": "Proton-Ordner", + "proton-folder-description": "Unter Linux benötigt BSManager Proton, um zu funktionieren. Wählen Sie den Installationsordner von Proton, um fortzufahren.", + "proton-folder-placeholder": "Proton-Installationsordner", + "where-is-proton-installed": "Wo ist Proton installiert?" } }, "maps": { diff --git a/assets/jsons/translations/en.json b/assets/jsons/translations/en.json index 97e09bbe..14700dbb 100644 --- a/assets/jsons/translations/en.json +++ b/assets/jsons/translations/en.json @@ -835,10 +835,11 @@ "default": "Default", "default-tooltip": "Defaults to your home folder" }, - "linux-setup": { - "title": "Linux Setup", - "proton-folder": "Proton folder", - "proton-folder-description": "Choose the folder to the Proton path. (eg. Proton - Experimental)" + "choose-proton-folder": { + "title": "Proton Folder", + "proton-folder-description": "On Linux, BSManager requires Proton to work. Choose the Proton installation folder to continue.", + "proton-folder-placeholder": "Proton installation folder", + "where-is-proton-installed": "Where is Proton installed?" } }, "maps": { diff --git a/assets/jsons/translations/es.json b/assets/jsons/translations/es.json index 81b83425..5d9aac3a 100644 --- a/assets/jsons/translations/es.json +++ b/assets/jsons/translations/es.json @@ -835,10 +835,11 @@ "default": "Predeterminado", "default-tooltip": "Por defecto, en su carpeta personal" }, - "linux-setup": { - "title": "Configuración de Linux", - "proton-folder": "Carpeta de Proton", - "proton-folder-description": "Elige la carpeta en la ruta de Proton. (por ejemplo, Proton - Experimental)" + "choose-proton-folder": { + "title": "Carpeta de Proton", + "proton-folder-description": "En Linux, BSManager necesita Proton para funcionar. Elija la carpeta de instalación de Proton para continuar.", + "proton-folder-placeholder": "Carpeta de instalación de Proton", + "where-is-proton-installed": "¿Dónde está instalado Proton?" } }, "maps": { diff --git a/assets/jsons/translations/fr.json b/assets/jsons/translations/fr.json index af85490d..efb6f15c 100644 --- a/assets/jsons/translations/fr.json +++ b/assets/jsons/translations/fr.json @@ -836,10 +836,11 @@ "default": "Par défaut", "default-tooltip": "Par défaut, dans votre dossier personnel" }, - "linux-setup": { - "title": "Configuration de Linux", - "proton-folder": "Dossier Proton", - "proton-folder-description": "Choisissez le dossier vers le chemin de Proton. (par exemple, Proton - Experimental)" + "choose-proton-folder": { + "title": "Dossier Proton", + "proton-folder-description": "Sous Linux, BSManager a besoin de Proton pour fonctionner. Choisissez le dossier d'installation de Proton pour continuer.", + "proton-folder-placeholder": "Dossier d'installation de Proton", + "where-is-proton-installed": "Où est installé Proton ?" } }, "maps": { diff --git a/assets/jsons/translations/ja.json b/assets/jsons/translations/ja.json index f0165941..2e1ea01b 100644 --- a/assets/jsons/translations/ja.json +++ b/assets/jsons/translations/ja.json @@ -835,10 +835,11 @@ "default": "デフォルト", "default-tooltip": "デフォルトでは、ホームフォルダに設定されます" }, - "linux-setup": { - "title": "Linuxセットアップ", - "proton-folder": "Protonフォルダー", - "proton-folder-description": "Protonのパスにフォルダーを選択してください。(例:Proton - Experimental)" + "choose-proton-folder": { + "title": "Protonフォルダ", + "proton-folder-description": "Linuxでは、BSManagerを動作させるためにProtonが必要です。続行するには、Protonのインストールフォルダを選択してください。", + "proton-folder-placeholder": "Protonのインストールフォルダ", + "where-is-proton-installed": "Protonはどこにインストールされていますか?" } }, "maps": { diff --git a/assets/jsons/translations/ru.json b/assets/jsons/translations/ru.json index 3dcbe6da..b3bdcf7a 100644 --- a/assets/jsons/translations/ru.json +++ b/assets/jsons/translations/ru.json @@ -834,10 +834,11 @@ "default": "По умолчанию", "default-tooltip": "По умолчанию в вашей домашней папке" }, - "linux-setup": { - "title": "Настройка Linux", - "proton-folder": "Папка Proton", - "proton-folder-description": "Выберите папку для пути к Proton. (например, Proton - Experimental)" + "choose-proton-folder": { + "title": "Папка Proton", + "proton-folder-description": "В Linux BSManager требует Proton для работы. Выберите папку установки Proton, чтобы продолжить.", + "proton-folder-placeholder": "Папка установки Proton", + "where-is-proton-installed": "Где установлен Proton?" } }, "maps": { diff --git a/assets/jsons/translations/zh-tw.json b/assets/jsons/translations/zh-tw.json index fbb9f613..7f15df35 100644 --- a/assets/jsons/translations/zh-tw.json +++ b/assets/jsons/translations/zh-tw.json @@ -835,10 +835,11 @@ "default": "預設", "default-tooltip": "預設為您的主資料夾" }, - "linux-setup": { - "title": "Linux設置", - "proton-folder": "Proton資料夾", - "proton-folder-description": "選擇資料夾作為Proton路徑。(例如:Proton - Experimental)" + "choose-proton-folder": { + "title": "Proton資料夾", + "proton-folder-description": "在Linux上,BSManager需要Proton才能運行。請選擇Proton的安裝資料夾以繼續。", + "proton-folder-placeholder": "Proton安裝資料夾", + "where-is-proton-installed": "Proton安裝在哪裡?" } }, "maps": { diff --git a/assets/jsons/translations/zh.json b/assets/jsons/translations/zh.json index f171d84e..a2a2ba6f 100644 --- a/assets/jsons/translations/zh.json +++ b/assets/jsons/translations/zh.json @@ -835,10 +835,11 @@ "default": "默认", "default-tooltip": "默认为您的主文件夹" }, - "linux-setup": { - "title": "Linux设置", - "proton-folder": "Proton文件夹", - "proton-folder-description": "选择文件夹作为Proton路径。(例如:Proton - Experimental)" + "choose-proton-folder": { + "title": "Proton文件夹", + "proton-folder-description": "在Linux上,BSManager需要Proton才能运行。请选择Proton的安装文件夹以继续。", + "proton-folder-placeholder": "Proton安装文件夹", + "where-is-proton-installed": "Proton安装在哪里?" } }, "maps": { diff --git a/src/renderer/components/modal/modal-types/setup/linux-setup-modal.component.tsx b/src/renderer/components/modal/modal-types/setup/choose-proton-folder-modal.component.tsx similarity index 63% rename from src/renderer/components/modal/modal-types/setup/linux-setup-modal.component.tsx rename to src/renderer/components/modal/modal-types/setup/choose-proton-folder-modal.component.tsx index 98a725fa..c0af536f 100644 --- a/src/renderer/components/modal/modal-types/setup/linux-setup-modal.component.tsx +++ b/src/renderer/components/modal/modal-types/setup/choose-proton-folder-modal.component.tsx @@ -9,20 +9,15 @@ import { NotificationService } from "renderer/services/notification.service"; import { StaticConfigurationService } from "renderer/services/static-configuration.service"; import { BsmButton } from "renderer/components/shared/bsm-button.component"; -import { SettingContainer } from "renderer/components/settings/setting-container.component"; -export const LinuxSetupModal: ModalComponent<{}, {}> = ({ resolver }) => { +export const ChooseProtonFolderModal: ModalComponent<{}, {}> = ({ resolver }) => { const t = useTranslation(); const ipcService = useService(IpcService); const notificationService = useService(NotificationService); const staticConfigService = useService(StaticConfigurationService); - const [protonFolder, setProtonFolder] = useState(""); - - const validateFields = () => { - return !!protonFolder; - } + const [protonFolder, setProtonFolder] = useState(null); const selectProtonPath = async () => { const response = await lastValueFrom(ipcService.sendV2("choose-folder", { @@ -30,23 +25,23 @@ export const LinuxSetupModal: ModalComponent<{}, {}> = ({ resolver }) => { defaultPath: ".local/share/Steam/steamapps/common", showHidden: true, })); + if (response.canceled || !response.filePaths?.length) { return; } const path = response.filePaths[0]; - try { - await staticConfigService.set("proton-folder", path); + + await staticConfigService.set("proton-folder", path).then(() => { setProtonFolder(path); - validateFields(); - } catch (error: any) { + }).catch(err => { notificationService.notifyError({ title: "pages.settings.proton-folder.errors.title", - desc: ["invalid-folder"].includes(error?.code) - ? `pages.settings.proton-folder.errors.${error.code}` + desc: ["invalid-folder"].includes(err?.code) + ? `pages.settings.proton-folder.errors.${err.code}` : "misc.unknown" }); - } + }); } const onConfirmButtonPressed = async () => { @@ -57,36 +52,35 @@ export const LinuxSetupModal: ModalComponent<{}, {}> = ({ resolver }) => { return (
{ event.preventDefault(); onConfirmButtonPressed(); }}> -

- {t("modals.linux-setup.title")} -

+

{t("modals.choose-proton-folder.title")}

- -
- - {protonFolder} - +

{t("modals.choose-proton-folder.proton-folder-description")}

+ + {t("modals.choose-proton-folder.where-is-proton-installed")} +
+ {protonFolder ? ( + + {protonFolder} + + ) : ( + {t("modals.choose-proton-folder.proton-folder-placeholder")} + )} -
- +
= ({ resolver }) => { type="submit" withBar={false} text="misc.confirm" - disabled={!validateFields()} + disabled={!protonFolder} />
diff --git a/src/renderer/components/shared/bsm-button.component.tsx b/src/renderer/components/shared/bsm-button.component.tsx index 5723d1ef..7883a869 100644 --- a/src/renderer/components/shared/bsm-button.component.tsx +++ b/src/renderer/components/shared/bsm-button.component.tsx @@ -90,7 +90,7 @@ export const BsmButton = forwardRef(({ className, style, iconSty {icon && } {text && (type === "submit" ? ( - ) : ( diff --git a/src/renderer/services/setup.service.ts b/src/renderer/services/setup.service.ts index 0c871836..474cf38b 100644 --- a/src/renderer/services/setup.service.ts +++ b/src/renderer/services/setup.service.ts @@ -7,7 +7,7 @@ import { IpcService } from "./ipc.service"; import { ModalService } from "./modale.service"; import { AskInstallPathModal } from "renderer/components/modal/modal-types/setup/ask-install-path.component"; -import { LinuxSetupModal } from "renderer/components/modal/modal-types/setup/linux-setup-modal.component"; +import { ChooseProtonFolderModal } from "renderer/components/modal/modal-types/setup/choose-proton-folder-modal.component"; // Handle setup modals/prompts, ordering of the modals/prompts may be done here export class SetupService { @@ -74,7 +74,7 @@ export class SetupService { } await this.modalService.openModal( - LinuxSetupModal, + ChooseProtonFolderModal, { closable: false } ); } catch (error) {