This commit is contained in:
Mirco Wittrien 2021-01-23 18:50:24 +01:00
parent 96e6d03693
commit da4af4d667
15 changed files with 37 additions and 31 deletions

View File

@ -825,7 +825,7 @@ module.exports = (_ => {
BDFDB.TimeUtils.timeout(_ => { BDFDB.TimeUtils.timeout(_ => {
BDFDB.ModalUtils.open(addon, { BDFDB.ModalUtils.open(addon, {
header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`, header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`,
subheader: "", subHeader: "",
className: BDFDB.disCN._repomodal, className: BDFDB.disCN._repomodal,
headerClassName: BDFDB.disCN._repomodalheader, headerClassName: BDFDB.disCN._repomodalheader,
contentClassName: BDFDB.disCN._repomodalsettings, contentClassName: BDFDB.disCN._repomodalsettings,
@ -3644,7 +3644,7 @@ module.exports = (_ => {
}), }),
BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.TextElement, { BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.TextElement, {
size: InternalComponents.LibraryComponents.TextElement.Sizes.SIZE_12, size: InternalComponents.LibraryComponents.TextElement.Sizes.SIZE_12,
children: typeof config.subheader == "string" || BDFDB.ReactUtils.isValidElement(config.subheader) ? config.subheader : (name || "") children: typeof config.subHeader == "string" || BDFDB.ReactUtils.isValidElement(config.subHeader) ? config.subHeader : (name || "")
}) })
] ]
}), }),
@ -3695,10 +3695,16 @@ module.exports = (_ => {
}; };
BDFDB.ModalUtils.confirm = function (plugin, text, callback) { BDFDB.ModalUtils.confirm = function (plugin, text, callback) {
if (!BDFDB.ObjectUtils.is(plugin) || typeof text != "string") return; if (!BDFDB.ObjectUtils.is(plugin) || typeof text != "string") return;
BDFDB.ModalUtils.open(plugin, {text, header: BDFDB.LanguageUtils.LibraryStrings.confirm, className: BDFDB.disCN.modalconfirmmodal, scroller: false, buttons: [ BDFDB.ModalUtils.open(plugin, {
{contents: BDFDB.LanguageUtils.LanguageStrings.OKAY, close: true, color: "RED", click: typeof callback == "function" ? callback : _ => {}}, text: text,
{contents: BDFDB.LanguageUtils.LanguageStrings.CANCEL, close: true} header: BDFDB.LanguageUtils.LibraryStrings.confirm,
]}); className: BDFDB.disCN.modalconfirmmodal,
scroller: false,
buttons: [
{contents: BDFDB.LanguageUtils.LanguageStrings.OKAY, close: true, color: "RED", onClick: callback},
{contents: BDFDB.LanguageUtils.LanguageStrings.CANCEL, close: true}
]
});
}; };
const RealMenuItems = BDFDB.ModuleUtils.findByProperties("MenuItem", "MenuGroup"); const RealMenuItems = BDFDB.ModuleUtils.findByProperties("MenuItem", "MenuGroup");

View File

@ -509,7 +509,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatAliases"), header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatAliases"),
subheader: "", subHeader: "",
children: [ children: [
this.createInputs(values), this.createInputs(values),
BDFDB.ArrayUtils.remove(Object.keys(this.defaults.configs), "file").map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { BDFDB.ArrayUtils.remove(Object.keys(this.defaults.configs), "file").map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
@ -525,7 +525,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.ADD, contents: BDFDB.LanguageUtils.LanguageStrings.ADD,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
let configs = {}; let configs = {};
for (let key in this.defaults.configs) { for (let key in this.defaults.configs) {
let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`); let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`);

View File

@ -455,7 +455,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatFilter"), header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatFilter"),
subheader: "", subHeader: "",
children: [ children: [
this.createInputs(values), this.createInputs(values),
BDFDB.ArrayUtils.remove(Object.keys(this.defaults.configs), "file").map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { BDFDB.ArrayUtils.remove(Object.keys(this.defaults.configs), "file").map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
@ -471,7 +471,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.ADD, contents: BDFDB.LanguageUtils.LanguageStrings.ADD,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
let newConfigs = {}; let newConfigs = {};
for (let key in this.defaults.configs) { for (let key in this.defaults.configs) {
let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`); let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`);

View File

@ -303,7 +303,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "LARGE", size: "LARGE",
header: BDFDB.LanguageUtils.LanguageStrings.MESSAGE_PREVIEW, header: BDFDB.LanguageUtils.LanguageStrings.MESSAGE_PREVIEW,
subheader: "", subHeader: "",
children: BDFDB.ReactUtils.createElement("div", { children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.messagepopout + BDFDB.disCN._displaylargemessagespreviewmessage, className: BDFDB.disCNS.messagepopout + BDFDB.disCN._displaylargemessagespreviewmessage,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MessageGroup, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MessageGroup, {

View File

@ -610,7 +610,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: this.labels.modal_header, header: this.labels.modal_header,
subheader: channel.name, subHeader: channel.name,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_channelname, title: this.labels.modal_channelname,
@ -700,7 +700,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
let oldData = Object.assign({}, data); let oldData = Object.assign({}, data);
let channelNameInput = modal.querySelector(".input-channelname " + BDFDB.dotCN.input); let channelNameInput = modal.querySelector(".input-channelname " + BDFDB.dotCN.input);

View File

@ -425,7 +425,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: this.labels.modal_header, header: this.labels.modal_header,
subheader: guild.name, subHeader: guild.name,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1, tab: this.labels.modal_tabheader1,
@ -629,7 +629,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
let oldData = Object.assign({}, data); let oldData = Object.assign({}, data);
let guildNameInput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input); let guildNameInput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input);

View File

@ -1167,7 +1167,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: this.labels.modal_header, header: this.labels.modal_header,
subheader: member.nick || user.username, subHeader: member.nick || user.username,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1, tab: this.labels.modal_tabheader1,
@ -1399,7 +1399,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
let oldData = Object.assign({}, data); let oldData = Object.assign({}, data);
let userNameInput = modal.querySelector(".input-username " + BDFDB.dotCN.input); let userNameInput = modal.querySelector(".input-username " + BDFDB.dotCN.input);

View File

@ -806,7 +806,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: "LogIn/-Out Timelog", header: "LogIn/-Out Timelog",
subheader: "", subHeader: "",
className: BDFDB.disCN._friendnotificationstimelogmodal, className: BDFDB.disCN._friendnotificationstimelogmodal,
titleChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, { titleChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
autoFocus: true, autoFocus: true,

View File

@ -883,7 +883,7 @@ module.exports = (_ => {
if (BDFDB.ObjectUtils.is(data) && type) BDFDB.ModalUtils.open(this, { if (BDFDB.ObjectUtils.is(data) && type) BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS, header: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
subheader: data.name, subHeader: data.name,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_NAME, title: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_NAME,
@ -914,7 +914,7 @@ module.exports = (_ => {
contents: isNew ? BDFDB.LanguageUtils.LanguageStrings.CREATE : BDFDB.LanguageUtils.LanguageStrings.SAVE, contents: isNew ? BDFDB.LanguageUtils.LanguageStrings.CREATE : BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
data.name = modal.querySelector(".input-categoryname " + BDFDB.dotCN.input).value.trim() || data.name; data.name = modal.querySelector(".input-categoryname " + BDFDB.dotCN.input).value.trim() || data.name;
data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1); data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);

View File

@ -1034,7 +1034,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: this.labels.serversubmenu_createfolder, header: this.labels.serversubmenu_createfolder,
subheader: "", subHeader: "",
contentClassName: BDFDB.disCN.listscroller, contentClassName: BDFDB.disCN.listscroller,
children: guilds.map((guild, i) => { children: guilds.map((guild, i) => {
return [ return [
@ -1065,7 +1065,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.DONE, contents: BDFDB.LanguageUtils.LanguageStrings.DONE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: (modal, instance) => { onClick: (modal, instance) => {
this.createFolder(BDFDB.ArrayUtils.removeCopies(targetedGuildIds)); this.createFolder(BDFDB.ArrayUtils.removeCopies(targetedGuildIds));
} }
}] }]

View File

@ -215,7 +215,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: this.labels.modal_header, header: this.labels.modal_header,
subheader: "", subHeader: "",
contentClassName: BDFDB.disCN.listscroller, contentClassName: BDFDB.disCN.listscroller,
children: guilds.map((guild, i) => { children: guilds.map((guild, i) => {
let folder = folders.find(folder => folder.guildIds.includes(guild.id) && !foldersAdded.includes(folder.folderId)); let folder = folders.find(folder => folder.guildIds.includes(guild.id) && !foldersAdded.includes(folder.folderId));
@ -286,7 +286,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, contents: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL,
color: "TRANSPARENT", color: "TRANSPARENT",
look: "LINK", look: "LINK",
click: (modal, instance) => { onClick: (modal, instance) => {
let enabled = hiddenGuildIds.includes(guilds[0].id); let enabled = hiddenGuildIds.includes(guilds[0].id);
hiddenGuildIds = [].concat(enabled ? [] : guilds.map(n => n.id)); hiddenGuildIds = [].concat(enabled ? [] : guilds.map(n => n.id));
BDFDB.DataUtils.save(hiddenGuildIds, this, "hidden", "servers"); BDFDB.DataUtils.save(hiddenGuildIds, this, "hidden", "servers");

View File

@ -537,7 +537,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "MEDIUM", size: "MEDIUM",
header: BDFDB.LanguageUtils.LanguageStrings.CHANNEL + " " + BDFDB.LanguageUtils.LanguageStrings.ACCESSIBILITY, header: BDFDB.LanguageUtils.LanguageStrings.CHANNEL + " " + BDFDB.LanguageUtils.LanguageStrings.ACCESSIBILITY,
subheader: "#" + channel.name, subHeader: "#" + channel.name,
className: BDFDB.disCN._showhiddenchannelsaccessmodal, className: BDFDB.disCN._showhiddenchannelsaccessmodal,
contentClassName: BDFDB.disCN.listscroller, contentClassName: BDFDB.disCN.listscroller,
children: [ children: [

View File

@ -619,13 +619,13 @@ module.exports = (_ => {
if (!BDFDB.LibraryModules.SpotifyTrackUtils.hasConnectedAccount()) BDFDB.ModalUtils.open(this, { if (!BDFDB.LibraryModules.SpotifyTrackUtils.hasConnectedAccount()) BDFDB.ModalUtils.open(this, {
size: "SMALL", size: "SMALL",
header: this.name + ": Something is missing...", header: this.name + ": Something is missing...",
subheader: "You need to connect a Spotify account", subHeader: "You need to connect a Spotify account",
text: "You are missing a connected Spotify account, without a connected account you won't be able to use Spotify Controls. To connect a Spotify account with your discord account click the button below.", text: "You are missing a connected Spotify account, without a connected account you won't be able to use Spotify Controls. To connect a Spotify account with your discord account click the button below.",
buttons: [{ buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.CONNECT, contents: BDFDB.LanguageUtils.LanguageStrings.CONNECT,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
BDFDB.LibraryModules.UserSettingsUtils.open(BDFDB.DiscordConstants.UserSettingsSections.CONNECTIONS) BDFDB.LibraryModules.UserSettingsUtils.open(BDFDB.DiscordConstants.UserSettingsSections.CONNECTIONS)
} }
}] }]

View File

@ -99,14 +99,14 @@ module.exports = (_ => {
let open = _ => { let open = _ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`, header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`,
subheader: "", subHeader: "",
className: BDFDB.disCN._repomodal, className: BDFDB.disCN._repomodal,
headerClassName: BDFDB.disCN._repomodalheader, headerClassName: BDFDB.disCN._repomodalheader,
contentClassName: BDFDB.disCN._repomodalsettings, contentClassName: BDFDB.disCN._repomodalsettings,
footerClassName: BDFDB.disCN._repomodalfooter, footerClassName: BDFDB.disCN._repomodalfooter,
size: "MEDIUM", size: "MEDIUM",
children: this.createThemeInputs(addon, imports, vars), children: this.createThemeInputs(addon, imports, vars),
buttons: [{contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, color: "BRAND", click: modal => {this.updateTheme(modal, addon);}}] buttons: [{contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, color: "BRAND", onClick: modal => {this.updateTheme(modal, addon);}}]
}); });
}; };
if (isBeta) { if (isBeta) {

View File

@ -111,7 +111,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, { BDFDB.ModalUtils.open(this, {
size: "LARGE", size: "LARGE",
header: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE, header: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE,
subheader: user.username, subHeader: user.username,
scroller: false, scroller: false,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextArea, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextArea, {
@ -124,7 +124,7 @@ module.exports = (_ => {
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND", color: "BRAND",
close: true, close: true,
click: modal => { onClick: modal => {
note = modal.querySelector("textarea").value; note = modal.querySelector("textarea").value;
if (note) BDFDB.DataUtils.save(note, this, "notes", user.id); if (note) BDFDB.DataUtils.save(note, this, "notes", user.id);
else BDFDB.DataUtils.remove(this, "notes", user.id); else BDFDB.DataUtils.remove(this, "notes", user.id);