Update CustomStatusPresets.plugin.js
This commit is contained in:
parent
a590fae2cb
commit
dfb33957eb
|
@ -68,7 +68,7 @@ module.exports = (_ => {
|
||||||
var _this;
|
var _this;
|
||||||
var presets = {};
|
var presets = {};
|
||||||
|
|
||||||
const CustomStatusInput = class CustomStatusInput extends BdApi.React.Component {
|
const CustomStatusInputComponent = class CustomStatusInput extends BdApi.React.Component {
|
||||||
handleChange() {
|
handleChange() {
|
||||||
this.props.onChange(this.props);
|
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) {
|
createDragPreview(div, event) {
|
||||||
if (!Node.prototype.isPrototypeOf(div)) return;
|
if (!Node.prototype.isPrototypeOf(div)) return;
|
||||||
let dragPreview = div.cloneNode(true);
|
let dragPreview = div.cloneNode(true);
|
||||||
|
@ -131,7 +131,9 @@ module.exports = (_ => {
|
||||||
this.props.dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
|
this.props.dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
|
||||||
}
|
}
|
||||||
render() {
|
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", {
|
this.props.hovered == id && BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCN._customstatuspresetssortdivider
|
className: BDFDB.disCN._customstatuspresetssortdivider
|
||||||
}),
|
}),
|
||||||
|
@ -190,7 +192,7 @@ module.exports = (_ => {
|
||||||
children: [
|
children: [
|
||||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
|
||||||
wrap: true,
|
wrap: true,
|
||||||
children: BDFDB.ReactUtils.createElement(CustomStatusInput, {
|
children: BDFDB.ReactUtils.createElement(CustomStatusInputComponent, {
|
||||||
text: presets[id].text,
|
text: presets[id].text,
|
||||||
emoji: presets[id].emojiInfo,
|
emoji: presets[id].emojiInfo,
|
||||||
onChange: value => {
|
onChange: value => {
|
||||||
|
@ -308,7 +310,7 @@ module.exports = (_ => {
|
||||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
||||||
title: "Custom Status Presets:",
|
title: "Custom Status Presets:",
|
||||||
dividerTop: true,
|
dividerTop: true,
|
||||||
children: BDFDB.ReactUtils.createElement(SortableList, {
|
children: BDFDB.ReactUtils.createElement(SortableListComponent, {
|
||||||
entries: presets,
|
entries: presets,
|
||||||
sortKey: "pos"
|
sortKey: "pos"
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue