From 9c86adf2d44fe18cf6869b64e3b807f164f21d76 Mon Sep 17 00:00:00 2001 From: silentrald Date: Sun, 25 Aug 2024 20:55:50 +0800 Subject: [PATCH] [feat-560] applied PR comments --- .../ask-install-path.component.tsx | 26 +++++++++----- .../shared/bsm-button.component.tsx | 36 +++---------------- src/renderer/services/setup.service.ts | 15 ++++---- src/shared/models/ipc/ipc-routes.ts | 2 +- 4 files changed, 29 insertions(+), 50 deletions(-) diff --git a/src/renderer/components/modal/modal-types/ask-install-path.component.tsx b/src/renderer/components/modal/modal-types/ask-install-path.component.tsx index 347868b6..828c49b9 100644 --- a/src/renderer/components/modal/modal-types/ask-install-path.component.tsx +++ b/src/renderer/components/modal/modal-types/ask-install-path.component.tsx @@ -2,6 +2,7 @@ import { lastValueFrom } from "rxjs"; import { useEffect, useState } from "react"; import { useTranslation } from "renderer/hooks/use-translation.hook"; import { useService } from "renderer/hooks/use-service.hook"; +import Tippy from "@tippyjs/react"; import { IpcService } from "renderer/services/ipc.service"; import { ModalComponent, ModalExitCode } from "renderer/services/modale.service"; @@ -79,17 +80,24 @@ export const AskInstallPathModal: ModalComponent<{ installPath: string }, {}> =
- + + + (({ - className, style, iconStyle, imgClassName, iconClassName, - icon, image, text, type, active, withBar = true, disabled, - onClickOutside, onClick, - typeColor, color, title, iconColor, textClassName, - tooltip, tooltipIcon -}, forwardedRef) => { +export const BsmButton = forwardRef(({ className, style, iconStyle, imgClassName, iconClassName, icon, image, text, type, active, withBar = true, disabled, onClickOutside, onClick, typeColor, color, title, iconColor, textClassName }, forwardedRef) => { const t = useTranslation(); const { firstColor, secondColor } = useThemeColor(); const ref = useRef(null); @@ -93,35 +84,18 @@ export const BsmButton = forwardRef(({ const handleClick = (e: MouseEvent) => !disabled && onClick?.(e); - const renderTooltip = () => { - return ( - -
- -
-
- ); - } - return (
{image && } {icon && } {text && (type === "submit" ? ( - ) : ( - - {t(text)} - {tooltip && renderTooltip()} + + {t(text)} ))} {withBar && ( diff --git a/src/renderer/services/setup.service.ts b/src/renderer/services/setup.service.ts index 316e1710..e2d105d1 100644 --- a/src/renderer/services/setup.service.ts +++ b/src/renderer/services/setup.service.ts @@ -3,7 +3,7 @@ import { logRenderError } from "renderer"; import { BSVersionManagerService } from "./bs-version-manager.service"; import { IpcService } from "./ipc.service"; -import { ModalExitCode, ModalResponse, ModalService } from "./modale.service"; +import { ModalService } from "./modale.service"; import { SteamDownloaderService } from "./bs-version-download/steam-downloader.service"; import { AskInstallPathModal } from "renderer/components/modal/modal-types/ask-install-path.component"; @@ -42,18 +42,15 @@ export class SetupService { private async checkInstallationPath(): Promise { try { - const exists = await lastValueFrom(this.ipcService.sendV2("bs-installer.folder-exists")) + const exists = await lastValueFrom(this.ipcService.sendV2("bs-installer.folder-exists")); if (exists) { return; } - let modalResponse: ModalResponse<{ installPath: string }> = { exitCode: ModalExitCode.NO_CHOICE }; - while (modalResponse.exitCode !== ModalExitCode.COMPLETED) { - modalResponse = await this.modalService.openModal( - AskInstallPathModal, - { closable: false } - ); - } + const modalResponse = await this.modalService.openModal( + AskInstallPathModal, + { closable: false } + ); await lastValueFrom(this.steamDownloaderService.setInstallationFolder(modalResponse.data.installPath)); diff --git a/src/shared/models/ipc/ipc-routes.ts b/src/shared/models/ipc/ipc-routes.ts index 63a128bb..b7871cdd 100644 --- a/src/shared/models/ipc/ipc-routes.ts +++ b/src/shared/models/ipc/ipc-routes.ts @@ -43,7 +43,7 @@ export interface IpcChannelMapping { "bsv-get-playlist-details-by-id": {request: {id: string, page: number}, response: BsvPlaylistPage}; /* ** bs-installer-ipcs ** */ - "bs-installer.folder-exists": { require: void, response: boolean }; + "bs-installer.folder-exists": { request: void, response: boolean }; "bs-installer.default-install-path": { request: void, response: string }; "bs-installer.install-path": { request: void, response: string}; "bs-installer.set-install-path": { request: string, response: string};