2025-12-14 19:30:56 +01:00
|
|
|
/*
|
|
|
|
|
* Vencord, a Discord client mod
|
|
|
|
|
* Copyright (c) 2025 Vendicated and contributors
|
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-29 15:20:59 -05:00
|
|
|
import { isPluginEnabled } from "@api/PluginManager";
|
2026-03-02 03:06:15 +01:00
|
|
|
import declutter from "@equicordplugins/declutter";
|
2026-02-04 14:16:50 -05:00
|
|
|
import { Devs } from "@utils/constants";
|
2025-12-14 19:30:56 +01:00
|
|
|
import definePlugin from "@utils/types";
|
2026-01-23 16:40:17 -05:00
|
|
|
import { findCssClassesLazy } from "@webpack";
|
|
|
|
|
|
2026-02-08 15:10:39 +01:00
|
|
|
const { iconForeground } = findCssClassesLazy("iconForeground", "accountPopoutButtonWrapper");
|
2025-12-14 19:30:56 +01:00
|
|
|
|
|
|
|
|
export default definePlugin({
|
|
|
|
|
name: "UserAreaAPI",
|
|
|
|
|
description: "API to add buttons to the user area panel.",
|
2026-02-04 14:16:50 -05:00
|
|
|
authors: [Devs.prism],
|
2025-12-14 19:30:56 +01:00
|
|
|
|
|
|
|
|
patches: [
|
|
|
|
|
{
|
2026-03-19 07:59:20 -04:00
|
|
|
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
|
2026-02-08 15:10:39 +01:00
|
|
|
replacement: [
|
|
|
|
|
{
|
2026-04-14 14:33:23 +01:00
|
|
|
match: /children:\[(?=.{0,50}accountContainerRef:\i)/,
|
|
|
|
|
replace: "children:[...$self.renderButtons(arguments[0]),"
|
2026-02-08 15:10:39 +01:00
|
|
|
},
|
|
|
|
|
// fix discord weird shrink with extra buttons
|
|
|
|
|
{
|
2026-02-17 14:47:21 -05:00
|
|
|
match: /(?<=\{ref:\i,)style:(\i)/,
|
2026-02-08 15:10:39 +01:00
|
|
|
replace: "style:{...$1,minWidth:0}"
|
|
|
|
|
}
|
|
|
|
|
]
|
2025-12-14 19:30:56 +01:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
|
2026-01-23 16:40:17 -05:00
|
|
|
renderButtons(props: { nameplate?: any; }) {
|
2025-12-14 19:30:56 +01:00
|
|
|
return Vencord.Api.UserArea._renderButtons({
|
|
|
|
|
nameplate: props.nameplate,
|
2026-01-23 16:40:17 -05:00
|
|
|
iconForeground: props.nameplate != null ? iconForeground : void 0,
|
2025-12-14 19:30:56 +01:00
|
|
|
hideTooltips: this.shouldHideTooltips()
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
shouldHideTooltips() {
|
2026-03-02 03:06:15 +01:00
|
|
|
return isPluginEnabled(declutter.name) && declutter.settings.store.removeButtonTooltips;
|
2025-12-14 19:30:56 +01:00
|
|
|
}
|
|
|
|
|
});
|