Add option to hide "Friends" section

This commit is contained in:
redphx
2024-07-07 16:43:56 +07:00
parent d7ed9e1603
commit 938dfa6aaa
7 changed files with 55 additions and 6 deletions

View File

@@ -1,17 +1,25 @@
import { CE } from "@utils/html";
import { PrefKey, getPref } from "@utils/preferences";
import { renderStylus } from "@macros/build" with {type: "macro"};
import { UiSection } from "@/enums/ui-sections";
export function addCss() {
const STYLUS_CSS = renderStylus();
let css = STYLUS_CSS;
// Hide "Play with Friends" section
if (getPref(PrefKey.UI_HIDE_SECTIONS).includes(UiSection.FRIENDS)) {
css += `
div[class^=HomePage-module__bottomSpacing]:has(button[class*=SocialEmptyCard]),
button[class*=SocialEmptyCard] {
display: none;
}
`;
}
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
css += `
/* Hide "Play with friends" section */
div[class^=HomePage-module__bottomSpacing]:has(button[class*=SocialEmptyCard]),
button[class*=SocialEmptyCard],
/* Hide "Start a party" button in the Guide menu */
#gamepass-dialog-root div[class^=AchievementsPreview-module__container] + button[class*=HomeLandingPage-module__button]
{