This commit is contained in:
Mirco Wittrien 2019-12-18 19:32:01 +01:00
parent 219ec5d2e3
commit a859116ef1
3 changed files with 107 additions and 9 deletions

View File

@ -4267,6 +4267,8 @@
settingsPanelInner: "settingsInner-zw1xAY",
settingsPanelList: "settingsList-eZjkXj",
settingsPanelTitle: "title-GTF_8J",
settingsTableCard: "settingsTableCard-628t52",
settingsTableList: "settingsTableList-f6sW2y",
svgIcon: "icon-GhnIRB",
table: "table-moqjM0",
tableBodyCell: "bodyCell-dQam9V",
@ -5719,6 +5721,8 @@
settingstableheadername: ["SettingsTable", "headerName"],
settingstableheaderoption: ["SettingsTable", "headerOption"],
settingstableheadersize: ["SettingsTable", "headerSize"],
settingstablecard: ["BDFDB", "settingsTableCard"],
settingstablelist: ["BDFDB", "settingsTableList"],
sidebarregion: ["SettingsWindow", "sidebarRegion"],
sinkinteractions: ["Message", "disableInteraction"],
size10: ["TextSize", "size10"],
@ -6452,6 +6456,7 @@
var NativeSubComponents = {}, LibraryComponents = {}, reactInitialized = LibraryModules.React && LibraryModules.React.Component;
NativeSubComponents.Button = BDFDB.ModuleUtils.findByProperties("Colors", "Hovers", "Looks");
NativeSubComponents.Checkbox = BDFDB.ModuleUtils.findByName("Checkbox");
NativeSubComponents.ContextMenuSliderItem = BDFDB.ModuleUtils.findByName("SliderMenuItem");
NativeSubComponents.ContextMenuToggleItem = BDFDB.ModuleUtils.findByName("ToggleMenuItem");
NativeSubComponents.FavButton = BDFDB.ModuleUtils.findByName("GIFFavButton");
@ -6697,6 +6702,17 @@
}
};
LibraryComponents.Checkbox = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.Checkbox") || reactInitialized && class BDFDB_Checkbox extends LibraryModules.React.Component {
handleChange() {
this.props.value = !this.props.value;
if (typeof this.props.onChange == "function") this.props.onChange(this.props.value, this);
BDFDB.ReactUtils.forceUpdate(this);
}
render() {
return BDFDB.ReactUtils.createElement(NativeSubComponents.Checkbox, Object.assign({}, this.props, {onChange: this.handleChange.bind(this)}));
}
};
LibraryComponents.Clickable = BDFDB.ModuleUtils.findByName("Clickable");
LibraryComponents.CollapseContainer = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.CollapseContainer") || reactInitialized && class BDFDB_CollapseContainer extends LibraryModules.React.Component {
@ -7374,7 +7390,7 @@
popoutProps: {position: "bottom", zIndexBoost: 1000},
value: selectedOption,
options: options,
renderOption: typeof this.props.renderOption == "function" ? this.props.renderOption : option => {return option.label;},
renderOption: typeof this.props.renderOption == "function" ? this.props.renderOption : option => option.label,
onChange: this.handleChange.bind(this)
})) : BDFDB.ReactUtils.createElement(LibraryComponents.PopoutContainer, Object.assign({}, this.props, {
children: BDFDB.ReactUtils.createElement("div", {
@ -7589,6 +7605,80 @@
}
};
LibraryComponents.SettingsList = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.SettingsList") || reactInitialized && class BDFDB_SettingsList extends LibraryModules.React.Component {
componentDidMount() {
let list = BDFDB.ReactUtils.findDOMNode(this);
if (list && !this.props.maxWidth) {
let headers = Array.from(list.querySelectorAll(BDFDB.dotCN.settingstableheader));
headers.shift();
let toobig = false, maxWidth = 0, minwidth = this.props.checkboxWidth + 12;
if (!maxWidth) {
for (let header of headers) {
let width = BDFDB.DOMUtils.getRects(header).width;
maxWidth = width > maxWidth ? width : maxWidth;
}
maxWidth += 4;
}
if (headers.length * maxWidth > 300) {
toobig = true;
maxWidth = parseInt(290 / headers.length);
}
else if (maxWidth < minwidth) maxWidth = minwidth;
this.props.maxWidth = maxWidth;
BDFDB.ReactUtils.forceUpdate(this);
}
}
render() {
this.props.settings = BDFDB.ArrayUtils.is(this.props.settings) ? this.props.settings : [];
this.props.renderLabel = typeof this.props.renderLabel == "function" ? this.props.renderLabel : data => data.label;
return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.settingstablelist, this.props.className),
children: [
BDFDB.ReactUtils.createElement(LibraryComponents.Flex, {
align: LibraryComponents.Flex.Align.STRETCH,
children: [].concat(this.props.title || "", this.props.settings).map((setting, i) => BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(i == 0 ? BDFDB.disCN.settingstableheadername : BDFDB.disCN.settingstableheaderoption, BDFDB.disCN.settingstableheader, BDFDB.disCN.settingstableheadersize, BDFDB.disCN.primary, BDFDB.disCN.weightbold),
children: setting,
style: i != 0 && this.props.maxWidth ? {
maxWidth: this.props.maxWidth,
width: this.props.maxWidth,
flex: `0 0 ${this.props.maxWidth}px`
} : {}
}))
}),
(BDFDB.ArrayUtils.is(this.props.data) ? this.props.data : [{}]).filter(n => n).map(data => BDFDB.ReactUtils.createElement(LibraryComponents.Card, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.cardprimaryoutline, BDFDB.disCN.settingstablecard, this.props.cardClassName),
backdrop: false,
children: [
BDFDB.ReactUtils.createElement(LibraryComponents.Flex, {
children: this.props.renderLabel(data)
}),
BDFDB.ReactUtils.createElement(LibraryComponents.Flex, {
justify: LibraryComponents.Flex.Justify.AROUND,
align: LibraryComponents.Flex.Align.CENTER,
grow: 0,
shrink: 0,
basis: this.props.maxWidth && this.props.maxWidth * this.props.settings.length || "auto",
children: this.props.settings.map(setting => BDFDB.ReactUtils.createElement(LibraryComponents.Flex.Child, {
className: BDFDB.disCN.checkboxcontainer,
grow: 0,
shrink: 0,
wrap: true,
children: BDFDB.ReactUtils.createElement(LibraryComponents.Checkbox, {
shape: LibraryComponents.Checkbox.Shapes.ROUND,
type: LibraryComponents.Checkbox.Types.INVERTED,
value: data[setting],
onChange: this.props.onCheckboxChange
})
})).flat(10).filter(n => n)
})
]
}), "title", "data", "settings", "renderLabel", "cardClassName", "onCheckboxChange", "maxWidth")))
]
});
}
};
LibraryComponents.SettingsSaveItem = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.SettingsSaveItem") || reactInitialized && class BDFDB_SettingsSaveItem extends LibraryModules.React.Component {
saveSettings(value) {
if (!BDFDB.ArrayUtils.is(this.props.keys) || !BDFDB.ObjectUtils.is(this.props.plugin)) return;
@ -8012,8 +8102,8 @@
${BDFDB.dotCNS.hovercardwrapper + BDFDB.dotCN.hovercardbutton} {
position: absolute;
top: -3px;
right: -3px;
top: -6px;
right: -6px;
opacity: 0;
}
${BDFDB.dotCNS.hovercardwrapper + BDFDB.dotCN.hovercard + BDFDB.dotCN.hovercardbutton} {
@ -8078,6 +8168,15 @@
font-size: 15px;
}
${BDFDB.dotCNS.settingstablelist + BDFDB.dotCN.checkboxcontainer}:before {
display: none;
}
${BDFDB.dotCN.settingstablecard} {
height: 60px;
margin-bottom: 10px;
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.quickselectpopoutwrapper},
${BDFDB.dotCNS.themedark + BDFDB.dotCN.quickselectpopoutwrapper} {
border-radius: 4px;
@ -8246,7 +8345,6 @@
display: none !important;
}
${BDFDB.dotCN.noticewrapper} {
transition: height 0.5s ease !important;
border-radius: 0 !important;

File diff suppressed because one or more lines are too long

View File

@ -1932,8 +1932,8 @@
</div>
<div class="REPLACE_CLASS_namecontainersubtext">
<div class="REPLACE_CLASS_memberactivity">
<img src="https://discordapp.com/assets/ebc2b7d9c497f0e4663d46c13e35fe23.svg" alt="⛑" draggable="false" class="REPLACE_CLASS_emojiold REPLACE_CLASS_emoji REPLACE_CLASS_memberactivityemoji">
<div class="REPLACE_CLASS_memberactivitytext">Helping</div>
<img src="https://discordapp.com/assets/ebc2b7d9c497f0e4663d46c13e35fe23.svg" alt="⛑" draggable="false" class="REPLACE_CLASS_emojiold REPLACE_CLASS_emoji REPLACE_CLASS_dmchannelactivityemoji">
<div class="REPLACE_CLASS_dmchannelactivitytext">Helping</div>
</div>
</div>
</div>
@ -1960,7 +1960,7 @@
</div>
<div class="REPLACE_CLASS_namecontainersubtext">
<div class="REPLACE_CLASS_memberactivity">
<div class="REPLACE_CLASS_memberactivitytext">Playing <strong>with Themes</strong></div>
<div class="REPLACE_CLASS_dmchannelactivitytext">Playing <strong>with Themes</strong></div>
</div>
</div>
</div>
@ -1988,7 +1988,7 @@
</div>
<div class="REPLACE_CLASS_namecontainersubtext">
<div class="REPLACE_CLASS_memberactivity">
<div class="REPLACE_CLASS_memberactivitytext">Streaming <strong>Bad Puns</strong></div>
<div class="REPLACE_CLASS_dmchannelactivitytext">Streaming <strong>Bad Puns</strong></div>
<svg name="RichActivity" class="REPLACE_CLASS_customstatusicon" width="16" height="16" viewBox="0 0 16 16">
<path fill="currentColor" d="M6,7 L2,7 L2,6 L6,6 L6,7 Z M8,5 L2,5 L2,4 L8,4 L8,5 Z M8,3 L2,3 L2,2 L8,2 L8,3 Z M8.88888889,0 L1.11111111,0 C0.494444444,0 0,0.494444444 0,1.11111111 L0,8.88888889 C0,9.50253861 0.497461389,10 1.11111111,10 L8.88888889,10 C9.50253861,10 10,9.50253861 10,8.88888889 L10,1.11111111 C10,0.494444444 9.5,0 8.88888889,0 Z" transform="translate(3 3)"></path>
</svg>