This commit is contained in:
Mirco Wittrien 2020-09-01 10:12:22 +02:00
parent 97d8c6ef1a
commit 4a65c185b4
3 changed files with 13 additions and 4 deletions

View File

@ -7322,12 +7322,16 @@
InternalComponents.LibraryComponents.BotTag = InternalBDFDB.loadPatchedComp("BotTag") || reactInitialized && class BDFDB_BotTag extends LibraryModules.React.Component {
handleClick(e) {if (typeof this.props.onClick == "function") this.props.onClick(e, this);}
handleContextMenu(e) {if (typeof this.props.onContextMenu == "function") this.props.onContextMenu(e, this);}
handleMouseEnter(e) {if (typeof this.props.onMouseEnter == "function") this.props.onMouseEnter(e, this);}
handleMouseLeave(e) {if (typeof this.props.onMouseLeave == "function") this.props.onMouseLeave(e, this);}
render() {
return BDFDB.ReactUtils.createElement("span", {
className: BDFDB.DOMUtils.formatClassName(this.props.className, this.props.invertColor ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular, this.props.useRemSizes ? BDFDB.disCN.bottagrem : BDFDB.disCN.bottagpx),
style: this.props.style,
onClick: this.handleClick.bind(this),
onContextMenu: this.handleContextMenu.bind(this),
onMouseEnter: this.handleMouseEnter.bind(this),
onMouseLeave: this.handleMouseLeave.bind(this),
children: BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.bottagtext,
children: this.props.tag || BDFDB.LanguageUtils.LanguageStrings.BOT_TAG_BOT

File diff suppressed because one or more lines are too long

View File

@ -254,14 +254,14 @@ var OwnerTag = (_ => {
injectOwnerTag (children, user, userType, insertIndex, config = {}) {
if (!BDFDB.ArrayUtils.is(children) || !user) return;
if (settings.useCrown || settings.hideNativeCrown) {
if (!settings.useCrown || settings.hideNativeCrown) {
let [_, index] = BDFDB.ReactUtils.findParent(children, {props: [["text",[BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER, BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER]]]});
if (index > -1) children[index] = null;
}
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, user.id) || {}) : {};
let tag = null;
if (settings.useCrown) {
if (!settings.useCrown) {
let label, className;
switch (userType) {
case userTypes.OWNER:
@ -287,7 +287,7 @@ var OwnerTag = (_ => {
});
}
else {
let input;
let input, label;
switch (userType) {
case userTypes.OWNER:
input = "ownTagName";
@ -297,6 +297,7 @@ var OwnerTag = (_ => {
break;
case userTypes.MANAGEMENT:
input = "ownManagementTagName";
label = [BDFDB.UserUtils.can("MANAGE_GUILD", user.id) && BDFDB.LanguageUtils.LibraryStrings.server, BDFDB.UserUtils.can("MANAGE_CHANNELS", user.id) && BDFDB.LanguageUtils.LanguageStrings.CHANNELS, BDFDB.UserUtils.can("MANAGE_ROLES", user.id) && BDFDB.LanguageUtils.LanguageStrings.ROLES].filter(n => n).join(", ");
break;
}
let tagColor = BDFDB.ColorUtils.convert(member.colorString, "RGBA");
@ -312,6 +313,10 @@ var OwnerTag = (_ => {
},
tag: inputs[input]
});
if (label) tag = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: label,
children: tag
});
}
children.splice(insertIndex, 0, tag);
}