From dfb33957eb612cb60e8c1e04ec599f22b5f130a4 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sat, 3 Apr 2021 17:25:09 +0200 Subject: [PATCH] Update CustomStatusPresets.plugin.js --- .../CustomStatusPresets.plugin.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js index b79a31a73a..32e1bf3a99 100644 --- a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js +++ b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js @@ -68,7 +68,7 @@ module.exports = (_ => { var _this; var presets = {}; - const CustomStatusInput = class CustomStatusInput extends BdApi.React.Component { + const CustomStatusInputComponent = class CustomStatusInput extends BdApi.React.Component { handleChange() { this.props.onChange(this.props); } @@ -112,7 +112,7 @@ module.exports = (_ => { } }; - const SortableList = class SortableList extends BdApi.React.Component { + const SortableListComponent = class SortableList extends BdApi.React.Component { createDragPreview(div, event) { if (!Node.prototype.isPrototypeOf(div)) return; let dragPreview = div.cloneNode(true); @@ -131,7 +131,9 @@ module.exports = (_ => { this.props.dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important"); } render() { - return Object.keys(BDFDB.ObjectUtils.sort(this.props.entries, this.props.sortKey)).map(id => [ + return !this.props.entries.length ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, { + children: "You haven't added any Custom Status Presets. You can add some via the Custom Status Modal, where you usually configure your Custom Status." + }) : Object.keys(BDFDB.ObjectUtils.sort(this.props.entries, this.props.sortKey)).map(id => [ this.props.hovered == id && BDFDB.ReactUtils.createElement("div", { className: BDFDB.disCN._customstatuspresetssortdivider }), @@ -190,7 +192,7 @@ module.exports = (_ => { children: [ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, { wrap: true, - children: BDFDB.ReactUtils.createElement(CustomStatusInput, { + children: BDFDB.ReactUtils.createElement(CustomStatusInputComponent, { text: presets[id].text, emoji: presets[id].emojiInfo, onChange: value => { @@ -308,7 +310,7 @@ module.exports = (_ => { settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { title: "Custom Status Presets:", dividerTop: true, - children: BDFDB.ReactUtils.createElement(SortableList, { + children: BDFDB.ReactUtils.createElement(SortableListComponent, { entries: presets, sortKey: "pos" })