mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature] advancement on steam shortcut
This commit is contained in:
+14
-7
@@ -6,12 +6,13 @@ import { BsmButton } from "renderer/components/shared/bsm-button.component";
|
||||
import { LaunchOption } from "shared/models/bs-launch";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { BSLauncherService } from "renderer/services/bs-launcher.service";
|
||||
import { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { BsNoteFill } from "renderer/components/svgs/icons/bs-note-fill.component";
|
||||
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
|
||||
import { ChevronTopIcon } from "renderer/components/svgs/icons/chevron-top-icon.component";
|
||||
import Tippy from "@tippyjs/react";
|
||||
import { LaunchMod } from "shared/models/bs-launch/launch-option.interface";
|
||||
import { BsStore } from "shared/models/bs-store.enum";
|
||||
|
||||
export const CreateLaunchShortcutModal: ModalComponent<{ steamShortcut: boolean, launchOption: LaunchOption }, BSVersion> = ({resolver, options: {data}}) => {
|
||||
|
||||
@@ -25,6 +26,10 @@ export const CreateLaunchShortcutModal: ModalComponent<{ steamShortcut: boolean,
|
||||
const [additionalArgsString, setAdditionalArgsString] = useState(launchOption.additionalArgs?.join("; ") ?? "");
|
||||
const [steamShortcut, setSteamShortcut] = useState(false);
|
||||
|
||||
const isSteamVersion = useMemo(() => {
|
||||
return data.steam || data.metadata?.store === BsStore.STEAM;
|
||||
}, [data]);
|
||||
|
||||
const completeModal = () => {
|
||||
|
||||
if(advanced) {
|
||||
@@ -97,12 +102,14 @@ export const CreateLaunchShortcutModal: ModalComponent<{ steamShortcut: boolean,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Tippy placement="right" theme="default" content={"Si activé, au lieu de créer un raccourci sur le bureau, celui-ci sera créé dans Steam."}>
|
||||
<div className="h-full flex items-center gap-1.5 mt-3 mb-4 w-fit pr-1">
|
||||
<BsmCheckbox className="h-5 aspect-square relative z-[1]" checked={steamShortcut} onChange={e => setSteamShortcut(() => e)} />
|
||||
<span>Créer un raccourci Steam</span>
|
||||
</div>
|
||||
</Tippy>
|
||||
{isSteamVersion && (
|
||||
<Tippy placement="right" theme="default" content={"Si activé, au lieu de créer un raccourci sur le bureau, celui-ci sera créé dans Steam."}>
|
||||
<div className="h-full flex items-center gap-1.5 mt-3 mb-4 w-fit pr-1">
|
||||
<BsmCheckbox className="h-5 aspect-square relative z-[1]" checked={steamShortcut} onChange={e => setSteamShortcut(() => e)} />
|
||||
<span>Créer un raccourci Steam</span>
|
||||
</div>
|
||||
</Tippy>
|
||||
)}
|
||||
<div className="grid grid-flow-col grid-cols-2 gap-4 mt-2">
|
||||
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({ exitCode: ModalExitCode.CANCELED })} withBar={false} text="misc.cancel" />
|
||||
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={completeModal} withBar={false} text="modals.create-launch-shortcut.valid-btn" />
|
||||
|
||||
@@ -221,7 +221,7 @@ export const DownloadMapsModal: ModalComponent<void, { version: BSVersion; owned
|
||||
handleSearch();
|
||||
}}
|
||||
/>
|
||||
<BsmSelect className="bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-1 pb-0.5 text-center" options={sortOptions} selected={searchParams.sortOrder} onChange={sort => handleSortChange(sort)} />
|
||||
<BsmSelect className="bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-1 pb-0.5 text-center w-min" options={sortOptions} selected={searchParams.sortOrder} onChange={sort => handleSortChange(sort)} />
|
||||
</div>
|
||||
|
||||
{(() => {
|
||||
|
||||
@@ -120,7 +120,7 @@ export function VersionViewer() {
|
||||
const { exitCode, data } = await modalService.openModal(CreateLaunchShortcutModal, {data: state});
|
||||
if(exitCode !== ModalExitCode.COMPLETED){ return; }
|
||||
|
||||
lastValueFrom(bsLauncher.createLaunchShortcut(data.launchOption)).then(() => {
|
||||
lastValueFrom(bsLauncher.createLaunchShortcut(data.launchOption, data.steamShortcut)).then(() => {
|
||||
notification.notifySuccess({
|
||||
title: "notifications.create-launch-shortcut.success.title",
|
||||
desc: "notifications.create-launch-shortcut.success.msg"
|
||||
|
||||
@@ -125,9 +125,9 @@ export class BSLauncherService {
|
||||
|
||||
}
|
||||
|
||||
public createLaunchShortcut(launchOptions: LaunchOption): Observable<boolean>{
|
||||
public createLaunchShortcut(launchOptions: LaunchOption, steamShortcut: boolean): Observable<boolean>{
|
||||
const options: LaunchOption = {...launchOptions, version: {...launchOptions.version, color: launchOptions.version.color || this.theme.getBsmColors()[1]}};
|
||||
return this.ipcService.sendV2("create-launch-shortcut", options);
|
||||
return this.ipcService.sendV2("create-launch-shortcut", { options, steamShortcut });
|
||||
}
|
||||
|
||||
public restoreSteamVR(): Promise<void>{
|
||||
|
||||
Reference in New Issue
Block a user