Fixes settings buttons and modal size
This commit is contained in:
parent
707c3848ef
commit
37cec0ef7e
|
@ -1,5 +1,6 @@
|
||||||
import {Config} from "data";
|
import {Config} from "data";
|
||||||
import Utilities from "./utilities";
|
import Utilities from "./utilities";
|
||||||
|
import Logger from "./logger";
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const releaseChannel = DiscordNative.globals ? DiscordNative.globals.releaseChannel : DiscordNative.app ? DiscordNative.app.getReleaseChannel() : "stable";
|
const releaseChannel = DiscordNative.globals ? DiscordNative.globals.releaseChannel : DiscordNative.app ? DiscordNative.app.getReleaseChannel() : "stable";
|
||||||
|
@ -48,9 +49,9 @@ export default new class DataStore {
|
||||||
let customcss = "";
|
let customcss = "";
|
||||||
let favoriteEmotes = {};
|
let favoriteEmotes = {};
|
||||||
try {customcss = oldData.bdcustomcss ? atob(oldData.bdcustomcss) : "";}
|
try {customcss = oldData.bdcustomcss ? atob(oldData.bdcustomcss) : "";}
|
||||||
catch (e) {console.error(e);} // eslint-disable-line no-console
|
catch (e) {Logger.stacktrace("DataStore:convertOldData", "Error decoding custom css", e);}
|
||||||
try {favoriteEmotes = oldData.bdfavemotes ? JSON.parse(atob(oldData.bdfavemotes)) : {};}
|
try {favoriteEmotes = oldData.bdfavemotes ? JSON.parse(atob(oldData.bdfavemotes)) : {};}
|
||||||
catch (e) {console.error(e);} // eslint-disable-line no-console
|
catch (e) {Logger.stacktrace("DataStore:convertOldData", "Error decoding favorite emotes", e);}
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
if (!fs.existsSync(path.resolve(this.baseFolder, channel))) fs.mkdirSync(path.resolve(this.baseFolder, channel));
|
if (!fs.existsSync(path.resolve(this.baseFolder, channel))) fs.mkdirSync(path.resolve(this.baseFolder, channel));
|
||||||
const channelData = oldData.settings[channel];
|
const channelData = oldData.settings[channel];
|
||||||
|
@ -70,8 +71,8 @@ export default new class DataStore {
|
||||||
|
|
||||||
setChannelData(channel, "settings", newSettings); // settingsCookie
|
setChannelData(channel, "settings", newSettings); // settingsCookie
|
||||||
setChannelData(channel, "emotes", newEmotes); // emotes (from settingsCookie)
|
setChannelData(channel, "emotes", newEmotes); // emotes (from settingsCookie)
|
||||||
setChannelData(channel, "plugins", channelData.plugins); // pluginCookie
|
setChannelData(channel, "plugins", channelData.plugins || {}); // pluginCookie
|
||||||
setChannelData(channel, "themes", channelData.themes); // themeCookie
|
setChannelData(channel, "themes", channelData.themes || {}); // themeCookie
|
||||||
setChannelData(channel, "misc", {favoriteEmotes}); // favorite emotes
|
setChannelData(channel, "misc", {favoriteEmotes}); // favorite emotes
|
||||||
fs.writeFileSync(path.resolve(this.baseFolder, channel, "custom.css"), customcss); // customcss
|
fs.writeFileSync(path.resolve(this.baseFolder, channel, "custom.css"), customcss); // customcss
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,8 +97,8 @@ export default class PublicServersConnection {
|
||||||
|
|
||||||
static get windowOptions() {
|
static get windowOptions() {
|
||||||
return {
|
return {
|
||||||
width: 380,
|
width: 490,
|
||||||
height: 450,
|
height: 500,
|
||||||
backgroundColor: "#282b30",
|
backgroundColor: "#282b30",
|
||||||
show: true,
|
show: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
|
|
@ -110,7 +110,7 @@ export default class AddonList extends React.Component {
|
||||||
matches = matches || addon.description.toLocaleLowerCase().includes(this.state.query);
|
matches = matches || addon.description.toLocaleLowerCase().includes(this.state.query);
|
||||||
if (!matches) return null;
|
if (!matches) return null;
|
||||||
}
|
}
|
||||||
const hasSettings = addon.type && typeof(addon.instance.getSettingsPanel) === "function";
|
const hasSettings = addon.instance && typeof(addon.instance.getSettingsPanel) === "function";
|
||||||
const getSettings = hasSettings && addon.instance.getSettingsPanel.bind(addon.instance);
|
const getSettings = hasSettings && addon.instance.getSettingsPanel.bind(addon.instance);
|
||||||
return <ErrorBoundary><AddonCard editAddon={this.editAddon.bind(this, addon.id)} deleteAddon={this.deleteAddon.bind(this, addon.id)} showReloadIcon={showReloadIcon} key={addon.id} enabled={addonState[addon.id]} addon={addon} onChange={onChange} reload={reload} hasSettings={hasSettings} getSettingsPanel={getSettings} /></ErrorBoundary>;
|
return <ErrorBoundary><AddonCard editAddon={this.editAddon.bind(this, addon.id)} deleteAddon={this.deleteAddon.bind(this, addon.id)} showReloadIcon={showReloadIcon} key={addon.id} enabled={addonState[addon.id]} addon={addon} onChange={onChange} reload={reload} hasSettings={hasSettings} getSettingsPanel={getSettings} /></ErrorBoundary>;
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in New Issue