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.ModalUtils.open(addon, {
header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`,
subheader: "",
subHeader: "",
className: BDFDB.disCN._repomodal,
headerClassName: BDFDB.disCN._repomodalheader,
contentClassName: BDFDB.disCN._repomodalsettings,
@ -3644,7 +3644,7 @@ module.exports = (_ => {
}),
BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.TextElement, {
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) {
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: [
{contents: BDFDB.LanguageUtils.LanguageStrings.OKAY, close: true, color: "RED", click: typeof callback == "function" ? callback : _ => {}},
{contents: BDFDB.LanguageUtils.LanguageStrings.CANCEL, close: true}
]});
BDFDB.ModalUtils.open(plugin, {
text: text,
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");

View File

@ -509,7 +509,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatAliases"),
subheader: "",
subHeader: "",
children: [
this.createInputs(values),
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,
color: "BRAND",
close: true,
click: modal => {
onClick: modal => {
let configs = {};
for (let key in this.defaults.configs) {
let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`);

View File

@ -455,7 +455,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: BDFDB.LanguageUtils.LibraryStringsFormat("add_to", "ChatFilter"),
subheader: "",
subHeader: "",
children: [
this.createInputs(values),
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,
color: "BRAND",
close: true,
click: modal => {
onClick: modal => {
let newConfigs = {};
for (let key in this.defaults.configs) {
let configInput = modal.querySelector(`.input-config${key} ${BDFDB.dotCN.switchinner}`);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -215,7 +215,7 @@ module.exports = (_ => {
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: this.labels.modal_header,
subheader: "",
subHeader: "",
contentClassName: BDFDB.disCN.listscroller,
children: guilds.map((guild, i) => {
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,
color: "TRANSPARENT",
look: "LINK",
click: (modal, instance) => {
onClick: (modal, instance) => {
let enabled = hiddenGuildIds.includes(guilds[0].id);
hiddenGuildIds = [].concat(enabled ? [] : guilds.map(n => n.id));
BDFDB.DataUtils.save(hiddenGuildIds, this, "hidden", "servers");

View File

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

View File

@ -619,13 +619,13 @@ module.exports = (_ => {
if (!BDFDB.LibraryModules.SpotifyTrackUtils.hasConnectedAccount()) BDFDB.ModalUtils.open(this, {
size: "SMALL",
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.",
buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.CONNECT,
color: "BRAND",
close: true,
click: modal => {
onClick: modal => {
BDFDB.LibraryModules.UserSettingsUtils.open(BDFDB.DiscordConstants.UserSettingsSections.CONNECTIONS)
}
}]

View File

@ -99,14 +99,14 @@ module.exports = (_ => {
let open = _ => {
BDFDB.ModalUtils.open(this, {
header: `${addon.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`,
subheader: "",
subHeader: "",
className: BDFDB.disCN._repomodal,
headerClassName: BDFDB.disCN._repomodalheader,
contentClassName: BDFDB.disCN._repomodalsettings,
footerClassName: BDFDB.disCN._repomodalfooter,
size: "MEDIUM",
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) {

View File

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