fix: fixing window on macos

This commit is contained in:
Chubby Granny Chaser 2024-11-02 14:44:42 +00:00
parent 238d207590
commit 3e33e1f4b3
No known key found for this signature in database
10 changed files with 57 additions and 2823 deletions

View File

@ -63,7 +63,7 @@ export class WindowManager {
minWidth: 1024,
minHeight: 540,
backgroundColor: "#1c1c1c",
titleBarStyle: process.platform === "win32" ? "hidden" : "default",
titleBarStyle: process.platform === "linux" ? "default" : "hidden",
...(process.platform === "linux" ? { icon } : {}),
trafficLightPosition: { x: 16, y: 16 },
titleBarOverlay: {

View File

@ -5,6 +5,8 @@ import { workerData } from "node:worker_threads";
const { binaryPath } = workerData;
let backupGameProcess: cp.ChildProcess | null = null;
export const backupGame = ({
title,
backupPath,
@ -16,15 +18,32 @@ export const backupGame = ({
preview?: boolean;
winePrefix?: string;
}) => {
const args = ["backup", title, "--api", "--force"];
if (backupGameProcess && !backupGameProcess.killed) {
backupGameProcess.kill();
backupGameProcess = null;
}
if (preview) args.push("--preview");
if (backupPath) args.push("--path", backupPath);
if (winePrefix) args.push("--wine-prefix", winePrefix);
return new Promise((resolve, reject) => {
const args = ["backup", title, "--api", "--force"];
const result = cp.execFileSync(binaryPath, args);
if (preview) args.push("--preview");
if (backupPath) args.push("--path", backupPath);
if (winePrefix) args.push("--wine-prefix", winePrefix);
return JSON.parse(result.toString("utf-8")) as LudusaviBackup;
backupGameProcess = cp.execFile(
binaryPath,
args,
(err: cp.ExecFileException | null, stdout: string) => {
if (err) {
backupGameProcess = null;
return reject(err);
}
backupGameProcess = null;
return resolve(JSON.parse(stdout) as LudusaviBackup);
}
);
});
};
export const restoreBackup = (backupPath: string) => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@ import { store } from "./store";
import resources from "@locales";
import { AchievementNotification } from "./pages/achievements/notification/achievement-notification";
import "./workers";
import { RepacksContextProvider } from "./context";
import { SuspenseWrapper } from "./components";

View File

@ -68,3 +68,10 @@ export const buttonsList = style({
padding: "0",
gap: `${SPACING_UNIT}px`,
});
export const flameIcon = style({
width: "30px",
top: "-10px",
left: "-5px",
position: "absolute",
});

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
@ -7,12 +7,12 @@ import Skeleton, { SkeletonTheme } from "react-loading-skeleton";
import { Button, GameCard, Hero } from "@renderer/components";
import type { Steam250Game, CatalogueEntry } from "@types";
import starsAnimation from "@renderer/assets/lottie/stars.json";
import flameAnimation from "@renderer/assets/lottie/flame.json";
import flameIconStatic from "@renderer/assets/icons/flame-static.png";
import flameIconAnimated from "@renderer/assets/icons/flame-animated.gif";
import starsIconAnimated from "@renderer/assets/icons/stars-animated.gif";
import * as styles from "./home.css";
import { SPACING_UNIT, vars } from "@renderer/theme.css";
import Lottie, { type LottieRefCurrentProps } from "lottie-react";
import { buildGameDetailsPath } from "@renderer/helpers";
import { CatalogueCategory } from "@shared";
@ -20,8 +20,7 @@ export default function Home() {
const { t } = useTranslation("home");
const navigate = useNavigate();
const flameAnimationRef = useRef<LottieRefCurrentProps>(null);
const [animateFlame, setAnimateFlame] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
@ -88,13 +87,13 @@ export default function Home() {
const handleMouseEnterCategory = (category: CatalogueCategory) => {
if (category === CatalogueCategory.Hot) {
flameAnimationRef?.current?.play();
setAnimateFlame(true);
}
};
const handleMouseLeaveCategory = (category: CatalogueCategory) => {
if (category === CatalogueCategory.Hot) {
flameAnimationRef?.current?.stop();
setAnimateFlame(false);
}
};
@ -123,17 +122,17 @@ export default function Home() {
<div
style={{ width: 16, height: 16, position: "relative" }}
>
<Lottie
lottieRef={flameAnimationRef}
animationData={flameAnimation}
loop={false}
autoplay={false}
style={{
width: 30,
top: -10,
left: -5,
position: "absolute",
}}
<img
src={flameIconStatic}
alt="Flame icon"
className={styles.flameIcon}
style={{ display: animateFlame ? "none" : "block" }}
/>
<img
src={flameIconAnimated}
alt="Flame animation"
className={styles.flameIcon}
style={{ display: animateFlame ? "block" : "none" }}
/>
</div>
)}
@ -150,10 +149,10 @@ export default function Home() {
disabled={!randomGame}
>
<div style={{ width: 16, height: 16, position: "relative" }}>
<Lottie
animationData={starsAnimation}
<img
src={starsIconAnimated}
alt="Stars animation"
style={{ width: 70, position: "absolute", top: -28, left: -27 }}
loop={false}
/>
</div>
{t("surprise_me")}
@ -163,10 +162,9 @@ export default function Home() {
<h2 style={{ display: "flex", gap: SPACING_UNIT }}>
{currentCatalogueCategory === CatalogueCategory.Hot && (
<div style={{ width: 24, height: 24, position: "relative" }}>
<Lottie
animationData={flameAnimation}
loop={false}
autoplay
<img
src={flameIconAnimated}
alt="Flame animation"
style={{
width: 40,
top: -10,