mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-21 10:03:56 +00:00
Merge branch 'main' of https://github.com/hydralauncher/hydra
This commit is contained in:
@@ -31,7 +31,7 @@ export function AchievementNotificationItem({
|
||||
[`${baseClassName}--platinum`]: achievement.isPlatinum,
|
||||
})}
|
||||
>
|
||||
{achievement.points && (
|
||||
{achievement.points !== undefined && (
|
||||
<div className="achievement-notification__chip">
|
||||
<HydraIcon className="achievement-notification__chip__icon" />
|
||||
<span className="achievement-notification__chip__label">
|
||||
|
||||
5
src/renderer/src/declaration.d.ts
vendored
5
src/renderer/src/declaration.d.ts
vendored
@@ -139,10 +139,7 @@ declare global {
|
||||
verifyExecutablePathInUse: (executablePath: string) => Promise<Game>;
|
||||
getLibrary: () => Promise<LibraryGame[]>;
|
||||
openGameInstaller: (shop: GameShop, objectId: string) => Promise<boolean>;
|
||||
openGameInstallerPath: (
|
||||
shop: GameShop,
|
||||
objectId: string
|
||||
) => Promise<boolean>;
|
||||
openGameInstallerPath: (shop: GameShop, objectId: string) => Promise<void>;
|
||||
openGameExecutablePath: (shop: GameShop, objectId: string) => Promise<void>;
|
||||
openGame: (
|
||||
shop: GameShop,
|
||||
|
||||
@@ -164,7 +164,7 @@ export function AchievementNotification() {
|
||||
<style type="text/css">
|
||||
{app} {styles}
|
||||
</style>
|
||||
<section ref={(ref) => setShadowRootRef(ref)}>
|
||||
<section ref={setShadowRootRef}>
|
||||
{isVisible && currentAchievement && (
|
||||
<AchievementNotificationItem
|
||||
achievement={currentAchievement}
|
||||
|
||||
@@ -38,6 +38,7 @@ export function SettingsGeneral() {
|
||||
downloadNotificationsEnabled: false,
|
||||
repackUpdatesNotificationsEnabled: false,
|
||||
friendRequestNotificationsEnabled: false,
|
||||
friendStartGameNotificationsEnabled: true,
|
||||
achievementNotificationsEnabled: true,
|
||||
achievementCustomNotificationsEnabled: true,
|
||||
achievementCustomNotificationPosition:
|
||||
@@ -111,6 +112,8 @@ export function SettingsGeneral() {
|
||||
userPreferences.achievementCustomNotificationPosition ?? "top-left",
|
||||
friendRequestNotificationsEnabled:
|
||||
userPreferences.friendRequestNotificationsEnabled ?? false,
|
||||
friendStartGameNotificationsEnabled:
|
||||
userPreferences.friendStartGameNotificationsEnabled ?? true,
|
||||
language: language ?? "en",
|
||||
}));
|
||||
}
|
||||
@@ -248,6 +251,17 @@ export function SettingsGeneral() {
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_friend_start_game_notifications")}
|
||||
checked={form.friendStartGameNotificationsEnabled}
|
||||
onChange={() =>
|
||||
handleChange({
|
||||
friendStartGameNotificationsEnabled:
|
||||
!form.friendStartGameNotificationsEnabled,
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_achievement_notifications")}
|
||||
checked={form.achievementNotificationsEnabled}
|
||||
|
||||
@@ -11,6 +11,9 @@ import { injectCustomCss } from "@renderer/helpers";
|
||||
import { AchievementNotificationItem } from "@renderer/components/achievements/notification/achievement-notification";
|
||||
import { generateAchievementCustomNotificationTest } from "@shared";
|
||||
import { CollapsedMenu } from "@renderer/components/collapsed-menu/collapsed-menu";
|
||||
import app from "../../app.scss?inline";
|
||||
import styles from "../../components/achievements/notification/achievement-notification.scss?inline";
|
||||
import root from "react-shadow";
|
||||
|
||||
const notificationVariations = {
|
||||
default: "default",
|
||||
@@ -36,14 +39,15 @@ export default function ThemeEditor() {
|
||||
const [notificationAlignment, setNotificationAlignment] =
|
||||
useState<AchievementCustomNotificationPosition>("top-left");
|
||||
|
||||
const [shadowRootRef, setShadowRootRef] = useState<HTMLElement | null>(null);
|
||||
|
||||
const achievementPreview = useMemo(() => {
|
||||
return {
|
||||
achievement: {
|
||||
...generateAchievementCustomNotificationTest(t, i18n.language),
|
||||
achievement: generateAchievementCustomNotificationTest(t, i18n.language, {
|
||||
isRare: notificationVariation === "rare",
|
||||
isHidden: notificationVariation === "hidden",
|
||||
isPlatinum: notificationVariation === "platinum",
|
||||
},
|
||||
}),
|
||||
position: notificationAlignment,
|
||||
};
|
||||
}, [t, i18n.language, notificationVariation, notificationAlignment]);
|
||||
@@ -58,10 +62,13 @@ export default function ThemeEditor() {
|
||||
if (loadedTheme) {
|
||||
setTheme(loadedTheme);
|
||||
setCode(loadedTheme.code);
|
||||
if (shadowRootRef) {
|
||||
injectCustomCss(loadedTheme.code, shadowRootRef);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [themeId]);
|
||||
}, [themeId, shadowRootRef]);
|
||||
|
||||
const handleSave = useCallback(async () => {
|
||||
if (theme) {
|
||||
@@ -69,11 +76,14 @@ export default function ThemeEditor() {
|
||||
setHasUnsavedChanges(false);
|
||||
setIsClosingNotifications(true);
|
||||
setTimeout(() => {
|
||||
injectCustomCss(code);
|
||||
if (shadowRootRef) {
|
||||
injectCustomCss(code, shadowRootRef);
|
||||
}
|
||||
|
||||
setIsClosingNotifications(false);
|
||||
}, 450);
|
||||
}
|
||||
}, [code, theme]);
|
||||
}, [code, theme, shadowRootRef]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
@@ -185,11 +195,18 @@ export default function ThemeEditor() {
|
||||
/>
|
||||
|
||||
<div className="theme-editor__notification-preview-wrapper">
|
||||
<AchievementNotificationItem
|
||||
position={achievementPreview.position}
|
||||
achievement={achievementPreview.achievement}
|
||||
isClosing={isClosingNotifications}
|
||||
/>
|
||||
<root.div>
|
||||
<style type="text/css">
|
||||
{app} {styles}
|
||||
</style>
|
||||
<section ref={setShadowRootRef}>
|
||||
<AchievementNotificationItem
|
||||
position={achievementPreview.position}
|
||||
achievement={achievementPreview.achievement}
|
||||
isClosing={isClosingNotifications}
|
||||
/>
|
||||
</section>
|
||||
</root.div>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsedMenu>
|
||||
|
||||
Reference in New Issue
Block a user