diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 8991aec4c1..e46cb7693e 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -3989,6 +3989,7 @@ module.exports = (_ => { separator: config.headerSeparator || false, children: [ BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Flex.Child, { + style: {flex: 1}, children: [ BDFDB.ReactUtils.createElement(Internal.LibraryComponents.FormComponents.FormTitle, { tag: Internal.LibraryComponents.FormComponents.FormTags && Internal.LibraryComponents.FormComponents.FormTags.H4, diff --git a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js index c732df60ed..65c8d15be3 100644 --- a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js +++ b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js @@ -2,7 +2,7 @@ * @name CustomStatusPresets * @author DevilBro * @authorId 278543574059057154 - * @version 1.1.9 + * @version 1.2.0 * @description Allows you to save Custom Statuses as Quick Select * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -14,9 +14,7 @@ module.exports = (_ => { const changeLog = { - fixed: { - "New Style": "If Discord updated for you and you no longer got the old Custom Status Entry in the UserPopup, then you'll need to right click the Custom Status Bubble next to your avatar to pick a preset Custom Status" - } + }; return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { @@ -234,9 +232,6 @@ module.exports = (_ => { _this = this; this.modulePatches = { - before: [ - "Menu" - ], after: [ "CustomStatusModal", "UserPopoutCustomStatusPicker" @@ -319,7 +314,36 @@ module.exports = (_ => { } processUserPopoutCustomStatusPicker (e) { - if (e.instance.props.profileType != "BITE_SIZE") return; + if (!BDFDB.DataUtils.load(this, "readFlags", "newStyleLayout") && !BDFDB.DataUtils.load(this, "readFlags", "newStyleLayoutModalOpen")) { + BDFDB.DataUtils.save(true, this, "readFlags", "newStyleLayoutModalOpen"); + BDFDB.ModalUtils.open(this, { + size: "SMALL", + header: "READ THIS", + text: "You now change your custom status presets, by right clicking the status bubble next to your avatar.", + onClose: _ => BDFDB.DataUtils.remove(this, "readFlags", "newStyleLayoutModalOpen"), + buttons: [{ + contents: "I HAVE READ THIS", + color: "BRAND", + onClick: parentInstance => { + BDFDB.ModalUtils.open(this, { + size: "SMALL", + header: "ARE YOU SURE?", + text: "Are you sure you now know how to change your status with CustomStatusPresets? I will not answer this question again.", + buttons: [{ + contents: "YES", + color: "RED", + close: true, + onClick: _ => { + parentInstance.props.onClose(); + BDFDB.DataUtils.save(true, this, "readFlags", "newStyleLayout") + } + }] + }); + } + }] + }); + } + if (e.instance.props.profileType != BDFDB.DiscordConstants.ProfileTypes.BITE_SIZE) return; let container = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.userpopoutcustomstatuspickervisiblecontainer]]}); if (!container) return; let onContextMenu = container.props.onContextMenu; @@ -385,76 +409,6 @@ module.exports = (_ => { }, "", this); } - processMenu (e) { - if (e.instance.props.navId != "account" && e.instance.props.navId != "status") return; - let enabledPresets = BDFDB.ObjectUtils.filter(presets, id => !presets[id].disabled, true); - if (!Object.keys(enabledPresets).length) return; - let [children, index] = BDFDB.ContextMenuUtils.findItem(e.instance, {id: ["custom-status", "set-custom-status", "edit-custom-status", "add-custom-status"]}); - if (index > -1 && children[index].props && !children[index].props.children) { - let render = children[index].props.render || children[index].props.label; - delete children[index].props.render; - delete children[index].props.label; - children[index].props.icon = children[index].props.hint; - delete children[index].props.hint; - children[index] = BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, Object.assign({}, children[index].props, { - label: typeof render == "function" ? render() : render, - children: Object.keys(BDFDB.ObjectUtils.sort(enabledPresets, "pos")).map(id => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { - id: BDFDB.ContextMenuUtils.createItemId(this.name, "custom-status-preset", id), - label: BDFDB.ReactUtils.createElement("div", { - className: BDFDB.disCN._customstatuspresetscustomstatusitem, - children: [ - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { - text: BDFDB.LanguageUtils.LanguageStrings.CUSTOM_STATUS_CLEAR_CUSTOM_STATUS, - tooltipConfig: { - zIndex: 2001 - }, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, { - className: BDFDB.disCN._customstatuspresetsdeletebutton, - onClick: _ => { - delete presets[id]; - let pos = 0, sortedPresets = BDFDB.ObjectUtils.sort(presets, "pos"); - for (let id in sortedPresets) presets[id].pos = pos++; - BDFDB.DataUtils.save(presets, this, "presets"); - }, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - className: BDFDB.disCN._customstatuspresetsdeleteicon, - name: BDFDB.LibraryComponents.SvgIcon.Names.CLOSE_CIRCLE, - width: 14, - height: 14 - }) - }) - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, { - className: BDFDB.disCN._customstatuspresetsstatus, - status: presets[id].status || BDFDB.LibraryComponents.StatusComponents.Types.ONLINE - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, { - children: presets[id].text - }) - ] - }), - imageUrl: presets[id].emojiInfo && (presets[id].emojiInfo.id ? BDFDB.LibraryModules.IconUtils.getEmojiURL(presets[id].emojiInfo) : BDFDB.LibraryModules.EmojiStateUtils.getURL(presets[id].emojiInfo.name)), - hint: !presets[id].clearAfter ? BDFDB.LanguageUtils.LanguageStrings.DISPLAY_OPTION_NEVER : presets[id].clearAfter == ClearAfterValues.TODAY ? BDFDB.LanguageUtils.LanguageStrings.CUSTOM_STATUS_TODAY : BDFDB.LanguageUtils.LanguageStringsFormat("CUSTOM_STATUS_HOURS", presets[id].clearAfter/3600000), - action: _ => { - if (!presets[id]) return; - let expiresAt = presets[id].clearAfter ? presets[id].clearAfter : null; - if (presets[id].clearAfter === ClearAfterValues.TODAY) { - let date = new Date; - expiresAt = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1).getTime() - date.getTime(); - } - if (presets[id].status) BDFDB.DiscordUtils.setSetting("status", "status", presets[id].status); - BDFDB.DiscordUtils.setSetting("status", "customStatus", { - text: presets[id].text && presets[id].text.length > 0 ? presets[id].text : "", - expiresAtMs: expiresAt ? BDFDB.DiscordObjects.Timestamp().add(expiresAt, "ms").toDate().getTime().toString() : "0", - emojiId: presets[id].emojiInfo ? presets[id].emojiInfo.id : "0", - emojiName: presets[id].emojiInfo ? presets[id].emojiInfo.name : "" - }); - } - })) - })); - } - } - processCustomStatusModal (e) { let footer = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ModalFooter"}); if (!footer) return;