mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature] can now login to Steam with QRCode + ipc management optimization
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { useState, memo } from "react";
|
||||
import { BsDownloaderService } from "renderer/services/bs-downloader.service";
|
||||
import { distinctUntilChanged, map } from "rxjs/operators";
|
||||
import { useState, memo, ComponentProps } from "react";
|
||||
import defaultImage from "../../../../assets/images/default-version-img.jpg";
|
||||
import dateFormat from "dateformat";
|
||||
import { BsmImage } from "../shared/bsm-image.component";
|
||||
@@ -11,51 +9,38 @@ import { LinkOpenerService } from "renderer/services/link-opener.service";
|
||||
import { motion } from "framer-motion";
|
||||
import { GlowEffect } from "../shared/glow-effect.component";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import equal from "fast-deep-equal";
|
||||
|
||||
export const AvailableVersionItem = memo(function AvailableVersionItem(props: { version: BSVersion }) {
|
||||
const bsDownloaderService = useService(BsDownloaderService)
|
||||
type Props = {
|
||||
version: BSVersion;
|
||||
selected: boolean;
|
||||
onClick: ComponentProps<"li">["onClick"];
|
||||
}
|
||||
|
||||
export const AvailableVersionItem = memo(function AvailableVersionItem({version, selected, onClick}: Props) {
|
||||
const linkOpener = useService(LinkOpenerService)
|
||||
|
||||
const selected = useObservable(
|
||||
bsDownloaderService.selectedBsVersion$.pipe(distinctUntilChanged(), map(version => version?.BSVersion === props.version.BSVersion)),
|
||||
false
|
||||
);
|
||||
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const t = useTranslation();
|
||||
|
||||
const formatedDate = (() => {
|
||||
return dateFormat(+props.version.ReleaseDate * 1000, "ddd. d mmm yyyy");
|
||||
})();
|
||||
|
||||
const toggleSelect = () => {
|
||||
if (bsDownloaderService.isDownloading) {
|
||||
return;
|
||||
}
|
||||
if (selected) {
|
||||
bsDownloaderService.selectedBsVersion$.next(null);
|
||||
} else {
|
||||
bsDownloaderService.selectedBsVersion$.next(props.version);
|
||||
}
|
||||
};
|
||||
|
||||
const openReleasePage = () => {
|
||||
linkOpener.open(props.version.ReleaseURL);
|
||||
linkOpener.open(version.ReleaseURL);
|
||||
};
|
||||
|
||||
const formatedDate = (() => dateFormat(+version.ReleaseDate * 1000, "ddd. d mmm yyyy"))();
|
||||
|
||||
return (
|
||||
<motion.li className="group relative w-72 h-60 transition-transform active:scale-[.98]" onClick={toggleSelect} onHoverStart={() => setHovered(true)} onHoverEnd={() => setHovered(false)}>
|
||||
<motion.li className="group relative w-72 h-60 transition-transform active:scale-[.98]" onClick={onClick} onHoverStart={() => setHovered(true)} onHoverEnd={() => setHovered(false)}>
|
||||
<GlowEffect visible={hovered || selected} className="absolute" />
|
||||
<div className={`relative flex flex-col overflow-hidden rounded-md w-72 h-60 cursor-pointer group-hover:shadow-none duration-300 bg-light-main-color-2 dark:bg-main-color-2 ${!selected && "shadow-lg shadow-gray-900"}`}>
|
||||
<BsmImage image={props.version.ReleaseImg ? props.version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="absolute top-0 right-0 w-full h-full opacity-40 blur-xl object-cover" loading="lazy" />
|
||||
<BsmImage image={props.version.ReleaseImg ? props.version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" loading="lazy" />
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="absolute top-0 right-0 w-full h-full opacity-40 blur-xl object-cover" loading="lazy" />
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" loading="lazy" />
|
||||
<div className="z-[1] p-2 w-full flex items-center justify-between grow">
|
||||
<div>
|
||||
<h2 className="block text-xl font-bold text-white tracking-wider">{props.version.BSVersion}</h2>
|
||||
<h2 className="block text-xl font-bold text-white tracking-wider">{version.BSVersion}</h2>
|
||||
<span className="text-sm text-gray-700 dark:text-gray-400">{formatedDate}</span>
|
||||
</div>
|
||||
{props.version.ReleaseURL && (
|
||||
{version.ReleaseURL && (
|
||||
// eslint-disable-next-line jsx-a11y/anchor-is-valid -- link will be reworked
|
||||
<a
|
||||
onClickCapture={e => {
|
||||
@@ -72,4 +57,4 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {
|
||||
</div>
|
||||
</motion.li>
|
||||
);
|
||||
});
|
||||
}, equal);
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
import { BSVersionManagerService } from "renderer/services/bs-version-manager.service";
|
||||
import { filter, map } from "rxjs/operators";
|
||||
import { useContext } from "react";
|
||||
import { AvailableVersionItem } from "./available-version-item.component";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { AvailableVersionsContext } from "renderer/pages/available-versions-list.components";
|
||||
import equal from "fast-deep-equal";
|
||||
|
||||
export function AvailableVersionsSlide(props: { year: string }) {
|
||||
|
||||
const versionsService = useService(BSVersionManagerService);
|
||||
|
||||
const availableVersions = useObservable(
|
||||
versionsService.availableVersions$.pipe(filter(versions => !!versions?.length), map(() => versionsService.getAvaibleVersionsOfYear(props.year))),
|
||||
[]
|
||||
);
|
||||
type Props = {
|
||||
versions: BSVersion[]
|
||||
}
|
||||
|
||||
export function AvailableVersionsSlide({ versions }: Props) {
|
||||
|
||||
const context = useContext(AvailableVersionsContext);
|
||||
|
||||
const setSelectedVersion = (version: BSVersion) => {
|
||||
if(equal(version, context.selectedVersion)){
|
||||
return context.setSelectedVersion(null);
|
||||
}
|
||||
context.setSelectedVersion(version);
|
||||
}
|
||||
|
||||
return (
|
||||
<ol className="w-full flex items-start justify-center gap-6 shrink-0 content-start flex-wrap p-4 overflow-x-hidden overflow-y-scroll scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900">
|
||||
{availableVersions.map(version => (
|
||||
<AvailableVersionItem key={version.BSManifest} version={version} />
|
||||
{versions.map(version => (
|
||||
<AvailableVersionItem key={version.BSManifest} version={version} selected={equal(version, context.selectedVersion)} onClick={() => setSelectedVersion(version)}/>
|
||||
))}
|
||||
</ol>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { BSVersionManagerService } from "../../services/bs-version-manager.service";
|
||||
import { AvailableVersionsSlide } from "./available-versions-slide.component";
|
||||
import { filter, map } from "rxjs/operators";
|
||||
import { TabNavBar } from "../shared/tab-nav-bar.component";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
@@ -9,22 +8,28 @@ import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
export function AvailableVersionsSlider() {
|
||||
const versionManagerService = useService(BSVersionManagerService);
|
||||
|
||||
const availableVersions = useObservable(versionManagerService.availableVersions$);
|
||||
const [yearIndex, setYearIndex] = useState(0);
|
||||
const availableYears = useObservable(
|
||||
versionManagerService.availableVersions$.pipe(filter(versions => !!versions?.length), map(() => versionManagerService.getAvailableYears())),
|
||||
[]
|
||||
);
|
||||
|
||||
const availableYears = (() => {
|
||||
if(!availableVersions?.length) { return []; }
|
||||
return [...new Set(availableVersions.map(v => v.year))].sort((a, b) => b.localeCompare(a))
|
||||
})();
|
||||
|
||||
const setSelectedYear = (index: number) => {
|
||||
setYearIndex(index);
|
||||
};
|
||||
|
||||
const getVersionOfYear = (year: string) => {
|
||||
return availableVersions.filter(v => v.year === year).sort((a, b) => +b.ReleaseDate - +a.ReleaseDate);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full h-fit max-h-full flex flex-col items-center grow min-h-0 gap-3">
|
||||
<TabNavBar tabIndex={yearIndex} tabsText={availableYears} onTabChange={setSelectedYear} />
|
||||
<ol className="w-full min-h-0 flex transition-transform duration-300" style={{ transform: `translate(${-(yearIndex * 100)}%, 0)` }}>
|
||||
{availableYears.map(year => (
|
||||
<AvailableVersionsSlide key={year} year={year} />
|
||||
<AvailableVersionsSlide key={year} versions={getVersionOfYear(year)} />
|
||||
))}
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { BsmButton } from "renderer/components/shared/bsm-button.component";
|
||||
import { BsmImage } from "renderer/components/shared/bsm-image.component";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import { ModalComponent, ModalExitCode, ModalService } from "renderer/services/modale.service";
|
||||
import BeatImpatient from "../../../../../assets/images/apngs/beat-impatient.png";
|
||||
import { WhyCredentialsModal } from "./why-credentials-modal.component";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { Observable } from "rxjs";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { QRCodeSVG } from "qrcode.react";
|
||||
import { BsmCheckbox } from "renderer/components/shared/bsm-checkbox.component";
|
||||
import { BsmBasicSpinner } from "renderer/components/shared/bsm-basic-spinner/bsm-basic-spinner.component";
|
||||
|
||||
export const LoginModal: ModalComponent<{ username: string; password: string; stay: boolean }> = ({ resolver }) => {
|
||||
export const LoginModal: ModalComponent<
|
||||
{ username: string; password: string; stay: boolean, method: "form"|"qr" },
|
||||
{ qrCode$: Observable<string>, logged$: Observable<string> }
|
||||
> = ({ resolver, data }) => {
|
||||
|
||||
const modal = useService(ModalService);
|
||||
|
||||
@@ -15,13 +21,29 @@ export const LoginModal: ModalComponent<{ username: string; password: string; st
|
||||
const [password, setPassword] = useState("");
|
||||
const [stay, setStay] = useState(false);
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const qrCodeUrl = useObservable(data.qrCode$);
|
||||
const t = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
const sub = data.logged$.subscribe({
|
||||
next: logged => {
|
||||
if(!logged) return;
|
||||
// If the logged event is emitted, it means that the user is logged in by the QR code
|
||||
resolver({ exitCode: ModalExitCode.COMPLETED, data: { username, password, stay, method: "qr" } });
|
||||
},
|
||||
error: () => resolver({ exitCode: ModalExitCode.NO_CHOICE}),
|
||||
complete: () => resolver({ exitCode: ModalExitCode.NO_CHOICE})
|
||||
});
|
||||
|
||||
return () => sub.unsubscribe();
|
||||
}, []);
|
||||
|
||||
const loggin = () => {
|
||||
if (!username || !password) {
|
||||
return;
|
||||
}
|
||||
resolver({ exitCode: ModalExitCode.COMPLETED, data: { username, password, stay } });
|
||||
resolver({ exitCode: ModalExitCode.COMPLETED, data: { username, password, stay, method: "form" } });
|
||||
};
|
||||
|
||||
const whyCredentials = () => {
|
||||
@@ -29,48 +51,48 @@ export const LoginModal: ModalComponent<{ username: string; password: string; st
|
||||
};
|
||||
|
||||
return (
|
||||
<form
|
||||
className="max-w-xs"
|
||||
onSubmit={e => {
|
||||
e.preventDefault();
|
||||
loggin();
|
||||
}}
|
||||
>
|
||||
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.steam-login.title")}</h1>
|
||||
<BsmImage className="mx-auto h-20" image={BeatImpatient} />
|
||||
|
||||
<div className="mb-2">
|
||||
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="username">
|
||||
{t("modals.steam-login.inputs.username.label")}
|
||||
</label>
|
||||
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none h-8" onChange={e => setUsername(e.target.value)} value={username} type="text" name="username" id="username" placeholder={t("modals.steam-login.inputs.username.placeholder")} />
|
||||
</div>
|
||||
<div className="mb-2 flex flex-col w-full">
|
||||
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="password">
|
||||
{t("modals.steam-login.inputs.password.label")}
|
||||
</label>
|
||||
<div className="bg-light-main-color-1 dark:bg-main-color-1 rounded-md flex box-border h-8">
|
||||
<input className="grow px-1 py-[2px] outline-none bg-transparent" onChange={e => setPassword(e.target.value)} value={password} type={showPassword ? "text" : "password"} name="password" id="password" placeholder={t("modals.steam-login.inputs.password.placeholder")} />
|
||||
<BsmButton className="shrink-0 m-1 rounded-md p-0.5 !bg-light-main-color-3 dark:!bg-main-color-3" icon={showPassword ? "eye-cross" : "eye"} withBar={false} onClick={() => setShowPassword(prev => !prev)} />
|
||||
<form className="w-[40rem] text-gray-800 dark:text-gray-200" onSubmit={e => {e.preventDefault(); loggin()}}>
|
||||
<h1 className="text-3xl uppercase tracking-wide w-full text-center mb-5">{t("modals.steam-login.title")}</h1>
|
||||
<div className="flex justify-center items-stretch gap-5 min-w-0">
|
||||
<div className="grow flex flex-col gap-2">
|
||||
<div>
|
||||
<label className="block font-bold cursor-pointer tracking-wide" htmlFor="username">
|
||||
{t("modals.steam-login.inputs.username.label")}
|
||||
</label>
|
||||
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none h-9" onChange={e => setUsername(e.target.value)} value={username} type="text" name="username" id="username" placeholder={t("modals.steam-login.inputs.username.placeholder")} />
|
||||
</div>
|
||||
<div>
|
||||
<label className="block font-bold cursor-pointer tracking-wide" htmlFor="password">
|
||||
{t("modals.steam-login.inputs.password.label")}
|
||||
</label>
|
||||
<div className="bg-light-main-color-1 dark:bg-main-color-1 rounded-md flex box-border h-9">
|
||||
<input className="grow px-1 py-[2px] outline-none bg-transparent" onChange={e => setPassword(e.target.value)} value={password} type={showPassword ? "text" : "password"} name="password" id="password" placeholder={t("modals.steam-login.inputs.password.placeholder")} />
|
||||
<BsmButton className="shrink-0 m-1 rounded-md p-0.5 !bg-light-main-color-3 dark:!bg-main-color-3" icon={showPassword ? "eye-cross" : "eye"} withBar={false} onClick={() => setShowPassword(prev => !prev)} />
|
||||
</div>
|
||||
{password?.length > 64 && <span className="text-orange-700 dark:text-orange-400 text-xs whitespace-normal min-w-0">{t("modals.steam-login.inputs.password.max-length-warning")}</span>}
|
||||
</div>
|
||||
<div className="flex flex-row justify-start items-center gap-1.5 py-3">
|
||||
<BsmCheckbox className="relative z-[1] w-6 aspect-square" checked={stay} onChange={enable => setStay(() => enable)}/>
|
||||
<span>{t("modals.steam-login.inputs.stay")}</span>
|
||||
</div>
|
||||
<BsmButton typeColor="primary" className="rounded-md text-center transition-all h-10" type="submit" withBar={false} text="modals.steam-login.buttons.submit" />
|
||||
<div className="grow flex justify-center items-center gap-1 flex-col">
|
||||
<a className="flex justify-center items-center text-[.85rem] underline" href="https://help.steampowered.com/wizard/HelpWithLogin" target="_blank">{t("modals.steam-login.need-help-to-connect")}</a>
|
||||
<span className="flex justify-center items-center text-[.85rem] underline cursor-pointer" onClick={whyCredentials}>{t("modals.steam-login.why-credentials")}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col max-w-[13rem]">
|
||||
<span className="block font-bold cursor-pointer tracking-wide ">{t("modals.steam-login.inputs.qr.label")}</span>
|
||||
<div className="w-52 h-52 p-3 bg-white rounded-md max-w-xs mb-1 flex items-center justify-center">
|
||||
{(qrCodeUrl ?
|
||||
<QRCodeSVG className="w-full h-full" value={qrCodeUrl} level="H"/> :
|
||||
<BsmBasicSpinner className="w-full h-full p-11 text-neutral-300" />
|
||||
)}
|
||||
</div>
|
||||
<span className="text-center whitespace-break-spaces text-[.85rem]">
|
||||
{t("modals.steam-login.inputs.qr.note.use-the")}<a className="underline" href="https://store.steampowered.com/mobile" target="_blank">{t("modals.steam-login.inputs.qr.note.steam-mobile-app")}</a> {t("modals.steam-login.inputs.qr.note.to-connect-with-qr")}
|
||||
</span>
|
||||
</div>
|
||||
{password?.length > 64 && <span className="text-orange-700 dark:text-orange-400 text-xs whitespace-normal max-w-full w-full overflow-hidden">{t("modals.steam-login.inputs.password.max-length-warning")}</span>}
|
||||
</div>
|
||||
|
||||
<span onClick={whyCredentials} className="underline my-4 block cursor-pointer">
|
||||
{t("modals.steam-login.why-credentials")}
|
||||
</span>
|
||||
|
||||
<div className="grid grid-flow-col grid-cols-2 gap-4">
|
||||
<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" type="submit" withBar={false} text="modals.steam-login.buttons.submit" />
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { BsDownloaderService } from "renderer/services/bs-downloader.service";
|
||||
import { useEffect, useState } from "react";
|
||||
import { combineLatest, Subscription } from "rxjs";
|
||||
import { useState } from "react";
|
||||
import { distinctUntilChanged, map, of, Subscription, switchMap } from "rxjs";
|
||||
import { BSLauncherService, LaunchMods } from "renderer/services/bs-launcher.service";
|
||||
import { ConfigurationService } from "renderer/services/configuration.service";
|
||||
import { BSUninstallerService } from "renderer/services/bs-uninstaller.service";
|
||||
@@ -13,6 +13,8 @@ import { NavBarItem } from "./nav-bar-item.component";
|
||||
import useFitText from "use-fit-text";
|
||||
import Tippy from "@tippyjs/react";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import equal from "fast-deep-equal";
|
||||
import { useOnUpdate } from "renderer/hooks/use-on-update.hook";
|
||||
|
||||
export function BsVersionItem(props: { version: BSVersion }) {
|
||||
const downloaderService = useService(BsDownloaderService);
|
||||
@@ -24,10 +26,28 @@ export function BsVersionItem(props: { version: BSVersion }) {
|
||||
const { state } = useLocation() as { state: BSVersion };
|
||||
const { fontSize, ref } = useFitText();
|
||||
|
||||
const [downloading, setDownloading] = useState(false);
|
||||
const [downloadPercent, setDownloadPercent] = useState(0);
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
const [downloadProgress, setDownloadProgress] = useState(0);
|
||||
const secondColor = useThemeColor("second-color");
|
||||
|
||||
useOnUpdate(() => {
|
||||
const subs: Subscription[] = []
|
||||
|
||||
subs.push(downloaderService.currentBsVersionDownload$.pipe(map(download => equal(download, props.version)), distinctUntilChanged()).subscribe(isDownloading => {
|
||||
setIsDownloading(() => isDownloading);
|
||||
}));
|
||||
|
||||
subs.push(downloaderService.currentBsVersionDownload$.pipe(
|
||||
map(download => equal(download, props.version)),
|
||||
distinctUntilChanged(),
|
||||
switchMap(isDownloading => isDownloading ? downloaderService.downloadProgress$ : of(0)),
|
||||
).subscribe(progress => {
|
||||
setDownloadProgress(() => progress);
|
||||
}));
|
||||
|
||||
return () => subs.forEach(sub => sub.unsubscribe());
|
||||
}, [props.version]);
|
||||
|
||||
const isActive = (): boolean => {
|
||||
return props.version?.BSVersion === state?.BSVersion && props?.version.steam === state?.steam && props?.version.oculus === state?.oculus && props?.version.name === state?.name;
|
||||
};
|
||||
@@ -44,33 +64,12 @@ export function BsVersionItem(props: { version: BSVersion }) {
|
||||
const cancel = () => {
|
||||
const versionDownload = downloaderService.currentBsVersionDownload$.value;
|
||||
const wasVerification = downloaderService.isVerification;
|
||||
downloaderService.cancelDownload().then(async res => {
|
||||
if (!res.success) {
|
||||
return;
|
||||
}
|
||||
if (!wasVerification) {
|
||||
bsUninstallerService.uninstall(versionDownload).then(res => res && verionManagerService.askInstalledVersions());
|
||||
}
|
||||
downloaderService.stopDownload().then(() => {
|
||||
if(wasVerification){ return; }
|
||||
bsUninstallerService.uninstall(versionDownload).then(res => res && verionManagerService.askInstalledVersions());
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const subs: Subscription[] = [];
|
||||
const downloadSub = combineLatest([downloaderService.currentBsVersionDownload$, downloaderService.downloadProgress$]).subscribe(vals => {
|
||||
if (vals[0]?.BSVersion === props.version.BSVersion && vals[0]?.steam === props.version.steam && vals[0].oculus === props.version.oculus && vals[0]?.name === props.version.name) {
|
||||
setDownloading(true);
|
||||
setDownloadPercent(vals[1]);
|
||||
} else {
|
||||
setDownloading(false);
|
||||
setDownloadPercent(0);
|
||||
}
|
||||
});
|
||||
subs.push(downloadSub);
|
||||
return () => {
|
||||
subs.forEach(s => s.unsubscribe());
|
||||
};
|
||||
}, []);
|
||||
|
||||
const renderIcon = () => {
|
||||
const classes = "w-[19px] h-[19px] mr-[5px] shrink-0";
|
||||
if (props.version.steam) {
|
||||
@@ -100,7 +99,7 @@ export function BsVersionItem(props: { version: BSVersion }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<NavBarItem onCancel={cancel} progress={downloading ? downloadPercent : 0} isActive={isActive() && !downloading} isDownloading={downloading}>
|
||||
<NavBarItem onCancel={cancel} progress={downloadProgress} isActive={isActive() && !isDownloading} isDownloading={isDownloading}>
|
||||
{props.version.name ? (
|
||||
<Tippy content={props.version.BSVersion} placement="right-end" arrow={false} className="font-bold !bg-neutral-900" duration={[100, 0]} animation="shift-away-subtle">
|
||||
<Link onDoubleClick={handleDoubleClick} to={`/bs-version/${props.version.BSVersion}`} state={props.version} className="w-full flex items-center justify-start content-center max-w-full">
|
||||
|
||||
Reference in New Issue
Block a user