Equicord/src/equicordplugins/_api/userArea.ts

49 lines
1.6 KiB
TypeScript
Raw Normal View History

/*
* 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";
import betterUserArea from "@equicordplugins/betterUserArea";
2026-02-04 14:16:50 -05:00
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
2026-01-23 16:40:17 -05:00
import { findCssClassesLazy } from "@webpack";
const { iconForeground } = findCssClassesLazy("iconForeground", "accountPopoutButtonWrapper");
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],
patches: [
{
2026-02-20 14:24:01 -05:00
find: ".WIDGETS_RTC_UPSELL_COACHMARK),",
replacement: [
{
match: /(?<=className:(\i)\.\i,style:\i,)children:\[/,
replace: "children:[...$self.renderButtons(arguments[0],$1),"
},
// fix discord weird shrink with extra buttons
{
2026-02-17 14:47:21 -05:00
match: /(?<=\{ref:\i,)style:(\i)/,
replace: "style:{...$1,minWidth:0}"
}
]
}
],
2026-01-23 16:40:17 -05:00
renderButtons(props: { nameplate?: any; }) {
return Vencord.Api.UserArea._renderButtons({
nameplate: props.nameplate,
2026-01-23 16:40:17 -05:00
iconForeground: props.nameplate != null ? iconForeground : void 0,
hideTooltips: this.shouldHideTooltips()
});
},
shouldHideTooltips() {
2025-12-29 15:20:59 -05:00
return isPluginEnabled(betterUserArea.name) && betterUserArea.settings.store.removeButtonTooltips;
}
});