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 { RealDebridClient } from "./services/real-debrid";
|
||||||
import { HydraApi } from "./services/hydra-api";
|
import { HydraApi } from "./services/hydra-api";
|
||||||
import { uploadGamesBatch } from "./services/library-sync";
|
import { uploadGamesBatch } from "./services/library-sync";
|
||||||
import {
|
|
||||||
publishCombinedNewAchievementNotification,
|
|
||||||
publishNewAchievementNotification,
|
|
||||||
} from "./services/notifications";
|
|
||||||
|
|
||||||
const loadState = async (userPreferences: UserPreferences | null) => {
|
const loadState = async (userPreferences: UserPreferences | null) => {
|
||||||
import("./events");
|
import("./events");
|
||||||
@ -53,21 +49,5 @@ userPreferencesRepository
|
|||||||
where: { id: 1 },
|
where: { id: 1 },
|
||||||
})
|
})
|
||||||
.then((userPreferences) => {
|
.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);
|
loadState(userPreferences);
|
||||||
});
|
});
|
||||||
|
@ -8,10 +8,7 @@ import { HydraApi } from "../hydra-api";
|
|||||||
import { getUnlockedAchievements } from "@main/events/user/get-unlocked-achievements";
|
import { getUnlockedAchievements } from "@main/events/user/get-unlocked-achievements";
|
||||||
import { Game } from "@main/entity";
|
import { Game } from "@main/entity";
|
||||||
import { achievementsLogger } from "../logger";
|
import { achievementsLogger } from "../logger";
|
||||||
import {
|
import { publishNewAchievementNotification } from "../notifications";
|
||||||
publishCombinedNewAchievementNotification,
|
|
||||||
publishNewAchievementNotification,
|
|
||||||
} from "../notifications";
|
|
||||||
|
|
||||||
const saveAchievementsOnLocal = async (
|
const saveAchievementsOnLocal = async (
|
||||||
objectId: string,
|
objectId: string,
|
||||||
|
@ -73,7 +73,10 @@ export const publishNotificationUpdateReadyToInstall = async (
|
|||||||
|
|
||||||
export const publishNewFriendRequestNotification = 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 fileName = url.split("/").pop()!;
|
||||||
const outputPath = path.join(app.getPath("temp"), fileName);
|
const outputPath = path.join(app.getPath("temp"), fileName);
|
||||||
const writer = fs.createWriteStream(outputPath);
|
const writer = fs.createWriteStream(outputPath);
|
||||||
@ -94,13 +97,8 @@ async function downloadImage(url: string) {
|
|||||||
|
|
||||||
export const publishCombinedNewAchievementNotification = async (
|
export const publishCombinedNewAchievementNotification = async (
|
||||||
achievementCount,
|
achievementCount,
|
||||||
gameCount,
|
gameCount
|
||||||
achievementIcon?: string
|
|
||||||
) => {
|
) => {
|
||||||
const iconPath = achievementIcon
|
|
||||||
? await downloadImage(achievementIcon)
|
|
||||||
: icon;
|
|
||||||
|
|
||||||
const options: NotificationOptions = {
|
const options: NotificationOptions = {
|
||||||
title: t("achievement_unlocked", { ns: "achievement" }),
|
title: t("achievement_unlocked", { ns: "achievement" }),
|
||||||
body: t("new_achievements_unlocked", {
|
body: t("new_achievements_unlocked", {
|
||||||
@ -108,7 +106,7 @@ export const publishCombinedNewAchievementNotification = async (
|
|||||||
gameCount,
|
gameCount,
|
||||||
achievementCount,
|
achievementCount,
|
||||||
}),
|
}),
|
||||||
icon: iconPath,
|
icon,
|
||||||
silent: true,
|
silent: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,7 +115,9 @@ export const publishCombinedNewAchievementNotification = async (
|
|||||||
toastXml: toXmlString(options),
|
toastXml: toXmlString(options),
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
sound.play(achievementSoundPath);
|
if (process.platform !== "linux") {
|
||||||
|
sound.play(achievementSoundPath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const publishNewAchievementNotification = async (info: {
|
export const publishNewAchievementNotification = async (info: {
|
||||||
@ -136,12 +136,12 @@ export const publishNewAchievementNotification = async (info: {
|
|||||||
achievementCount: info.achievements.length,
|
achievementCount: info.achievements.length,
|
||||||
}),
|
}),
|
||||||
body: info.achievements.map((a) => a.displayName).join(", "),
|
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" }),
|
title: t("achievement_unlocked", { ns: "achievement" }),
|
||||||
body: info.achievements[0].displayName,
|
body: info.achievements[0].displayName,
|
||||||
icon: await downloadImage(info.achievements[0].iconUrl),
|
icon: (await downloadImage(info.achievements[0].iconUrl)) ?? icon,
|
||||||
};
|
};
|
||||||
|
|
||||||
const options: NotificationOptions = {
|
const options: NotificationOptions = {
|
||||||
@ -162,5 +162,7 @@ export const publishNewAchievementNotification = async (info: {
|
|||||||
toastXml: toXmlString(options),
|
toastXml: toXmlString(options),
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
sound.play(achievementSoundPath);
|
if (process.platform !== "linux") {
|
||||||
|
sound.play(achievementSoundPath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -273,7 +273,6 @@ export function AchievementsContent({
|
|||||||
src={steamUrlBuilder.libraryHero(objectId)}
|
src={steamUrlBuilder.libraryHero(objectId)}
|
||||||
style={{ display: "none" }}
|
style={{ display: "none" }}
|
||||||
alt={gameTitle}
|
alt={gameTitle}
|
||||||
className={styles.heroImage}
|
|
||||||
onLoad={handleHeroLoad}
|
onLoad={handleHeroLoad}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -23,31 +23,6 @@ export const hero = style({
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
position: "relative",
|
position: "relative",
|
||||||
transition: "all ease 0.2s",
|
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({
|
export const heroContent = style({
|
||||||
|
Loading…
Reference in New Issue
Block a user