feat: refactoring notification window

This commit is contained in:
Zamitto 2024-10-02 18:01:58 -03:00
parent d5b1bcdc7f
commit beaa919c80
7 changed files with 17 additions and 15 deletions

View File

@ -85,12 +85,6 @@ export const mergeAchievements = async (
shop,
achievementsInfo
);
WindowManager.notificationWindow?.setBounds({ y: 50 });
setTimeout(() => {
WindowManager.notificationWindow?.setBounds({ y: -9999 });
}, 4000);
}
const mergedLocalAchievements = unlockedAchievements.concat(newAchievements);

View File

@ -104,19 +104,21 @@ export class WindowManager {
maximizable: false,
autoHideMenuBar: true,
minimizable: false,
focusable: true,
focusable: false,
skipTaskbar: true,
frame: false,
width: 240,
height: 60,
x: 25,
y: -9999,
y: 25,
webPreferences: {
preload: path.join(__dirname, "../preload/index.mjs"),
sandbox: false,
},
});
this.notificationWindow.setIgnoreMouseEvents(true);
this.notificationWindow.webContents.openDevTools();
this.notificationWindow.setVisibleOnAllWorkspaces(true, {
visibleOnFullScreen: true,
});

View File

@ -9,7 +9,7 @@
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: local: *; media-src 'self' local: data: *;"
/>
</head>
<body style="background-color: #1c1c1c">
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

View File

@ -35,7 +35,6 @@ globalStyle("body", {
userSelect: "none",
fontFamily: "Noto Sans, sans-serif",
fontSize: vars.size.body,
background: vars.color.background,
color: vars.color.body,
margin: "0",
});

View File

@ -28,7 +28,7 @@ import {
import { store } from "./store";
import resources from "@locales";
import { Achievemnt } from "./pages/achievement/achievement";
import { Achievement } from "./pages/achievement/achievement";
import "./workers";
import { RepacksContextProvider } from "./context";
@ -70,7 +70,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<Route path="/settings" Component={Settings} />
<Route path="/profile/:userId" Component={Profile} />
</Route>
<Route path="/achievement-notification" Component={Achievemnt} />
<Route path="/achievement-notification" Component={Achievement} />
</Routes>
</HashRouter>
</RepacksContextProvider>

View File

@ -1,8 +1,9 @@
import { useEffect, useMemo, useState } from "react";
import achievementSound from "@renderer/assets/audio/achievement.wav";
import { useTranslation } from "react-i18next";
import { vars } from "@renderer/theme.css";
export function Achievemnt() {
export function Achievement() {
const { t } = useTranslation("achievement");
const [achievementInfo, setAchievementInfo] = useState<{
@ -39,7 +40,7 @@ export function Achievemnt() {
};
}, [audio]);
if (!achievementInfo) return <p>Nada</p>;
if (!achievementInfo) return null;
return (
<div
@ -48,6 +49,7 @@ export function Achievemnt() {
flexDirection: "row",
gap: "8px",
alignItems: "center",
background: vars.color.background,
}}
>
<img

View File

@ -4021,6 +4021,11 @@ delayed-stream@~1.0.0:
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
delegates@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==
detect-libc@^2.0.0, detect-libc@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700"
@ -7230,7 +7235,7 @@ read-binary-file-arch@^1.0.6:
dependencies:
debug "^4.3.4"
readable-stream@^3.1.1, readable-stream@^3.4.0:
readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
version "3.6.2"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==