mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
feat: adjust css
This commit is contained in:
parent
4f4dd29e5f
commit
3b828ca0f4
@ -12,10 +12,6 @@ import { UserPreferences } from "./entity";
|
||||
import { RealDebridClient } from "./services/real-debrid";
|
||||
import { HydraApi } from "./services/hydra-api";
|
||||
import { uploadGamesBatch } from "./services/library-sync";
|
||||
import {
|
||||
publishCombinedNewAchievementNotification,
|
||||
publishNewAchievementNotification,
|
||||
} from "./services/notifications";
|
||||
|
||||
const loadState = async (userPreferences: UserPreferences | null) => {
|
||||
import("./events");
|
||||
@ -53,21 +49,5 @@ userPreferencesRepository
|
||||
where: { id: 1 },
|
||||
})
|
||||
.then((userPreferences) => {
|
||||
publishCombinedNewAchievementNotification(1000, 999);
|
||||
|
||||
publishNewAchievementNotification({
|
||||
achievements: [
|
||||
{
|
||||
displayName: "Teste 1",
|
||||
iconUrl:
|
||||
"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/105600/0fbb33098c9da39d1d4771d8209afface9c46e81.jpg",
|
||||
},
|
||||
],
|
||||
unlockedAchievementCount: 10,
|
||||
totalAchievementCount: 34,
|
||||
gameTitle: "Teste",
|
||||
gameIcon: null,
|
||||
});
|
||||
|
||||
loadState(userPreferences);
|
||||
});
|
||||
|
@ -8,10 +8,7 @@ import { HydraApi } from "../hydra-api";
|
||||
import { getUnlockedAchievements } from "@main/events/user/get-unlocked-achievements";
|
||||
import { Game } from "@main/entity";
|
||||
import { achievementsLogger } from "../logger";
|
||||
import {
|
||||
publishCombinedNewAchievementNotification,
|
||||
publishNewAchievementNotification,
|
||||
} from "../notifications";
|
||||
import { publishNewAchievementNotification } from "../notifications";
|
||||
|
||||
const saveAchievementsOnLocal = async (
|
||||
objectId: string,
|
||||
|
@ -73,7 +73,10 @@ export const publishNotificationUpdateReadyToInstall = async (
|
||||
|
||||
export const publishNewFriendRequestNotification = async () => {};
|
||||
|
||||
async function downloadImage(url: string) {
|
||||
async function downloadImage(url: string | null) {
|
||||
if (!url) return null;
|
||||
if (!url.startsWith("http")) return null;
|
||||
|
||||
const fileName = url.split("/").pop()!;
|
||||
const outputPath = path.join(app.getPath("temp"), fileName);
|
||||
const writer = fs.createWriteStream(outputPath);
|
||||
@ -94,13 +97,8 @@ async function downloadImage(url: string) {
|
||||
|
||||
export const publishCombinedNewAchievementNotification = async (
|
||||
achievementCount,
|
||||
gameCount,
|
||||
achievementIcon?: string
|
||||
gameCount
|
||||
) => {
|
||||
const iconPath = achievementIcon
|
||||
? await downloadImage(achievementIcon)
|
||||
: icon;
|
||||
|
||||
const options: NotificationOptions = {
|
||||
title: t("achievement_unlocked", { ns: "achievement" }),
|
||||
body: t("new_achievements_unlocked", {
|
||||
@ -108,7 +106,7 @@ export const publishCombinedNewAchievementNotification = async (
|
||||
gameCount,
|
||||
achievementCount,
|
||||
}),
|
||||
icon: iconPath,
|
||||
icon,
|
||||
silent: true,
|
||||
};
|
||||
|
||||
@ -117,7 +115,9 @@ export const publishCombinedNewAchievementNotification = async (
|
||||
toastXml: toXmlString(options),
|
||||
}).show();
|
||||
|
||||
if (process.platform !== "linux") {
|
||||
sound.play(achievementSoundPath);
|
||||
}
|
||||
};
|
||||
|
||||
export const publishNewAchievementNotification = async (info: {
|
||||
@ -136,12 +136,12 @@ export const publishNewAchievementNotification = async (info: {
|
||||
achievementCount: info.achievements.length,
|
||||
}),
|
||||
body: info.achievements.map((a) => a.displayName).join(", "),
|
||||
icon: info.gameIcon ? await downloadImage(info.gameIcon) : icon,
|
||||
icon: (await downloadImage(info.gameIcon)) ?? icon,
|
||||
}
|
||||
: {
|
||||
title: t("achievement_unlocked", { ns: "achievement" }),
|
||||
body: info.achievements[0].displayName,
|
||||
icon: await downloadImage(info.achievements[0].iconUrl),
|
||||
icon: (await downloadImage(info.achievements[0].iconUrl)) ?? icon,
|
||||
};
|
||||
|
||||
const options: NotificationOptions = {
|
||||
@ -162,5 +162,7 @@ export const publishNewAchievementNotification = async (info: {
|
||||
toastXml: toXmlString(options),
|
||||
}).show();
|
||||
|
||||
if (process.platform !== "linux") {
|
||||
sound.play(achievementSoundPath);
|
||||
}
|
||||
};
|
||||
|
@ -273,7 +273,6 @@ export function AchievementsContent({
|
||||
src={steamUrlBuilder.libraryHero(objectId)}
|
||||
style={{ display: "none" }}
|
||||
alt={gameTitle}
|
||||
className={styles.heroImage}
|
||||
onLoad={handleHeroLoad}
|
||||
/>
|
||||
|
||||
|
@ -23,31 +23,6 @@ export const hero = style({
|
||||
flexDirection: "column",
|
||||
position: "relative",
|
||||
transition: "all ease 0.2s",
|
||||
"@media": {
|
||||
"(min-width: 1250px)": {
|
||||
height: "350px",
|
||||
minHeight: "350px",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const heroImage = style({
|
||||
width: "100%",
|
||||
height: `${HERO_HEIGHT}px`,
|
||||
minHeight: `${HERO_HEIGHT}px`,
|
||||
objectFit: "cover",
|
||||
objectPosition: "top",
|
||||
transition: "all ease 0.2s",
|
||||
position: "absolute",
|
||||
zIndex: "0",
|
||||
filter: "blur(5px)",
|
||||
"@media": {
|
||||
"(min-width: 1250px)": {
|
||||
objectPosition: "center",
|
||||
height: "350px",
|
||||
minHeight: "350px",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const heroContent = style({
|
||||
|
Loading…
Reference in New Issue
Block a user