more strings

This commit is contained in:
Zack Rauen 2019-06-26 15:23:07 -04:00
parent eb4358e626
commit f96c83cc84
9 changed files with 93 additions and 45 deletions

View File

@ -171,6 +171,12 @@
background-color: rgb(46,154,74);
}
.bd-version {
font-size: 12px;
font-weight: 600;
color: #72767d;
padding: 2px 10px;
}

File diff suppressed because one or more lines are too long

View File

@ -165,6 +165,16 @@ export default {
}
}
},
Addons: {
title: "{{name}} v{{version}} by {{author}}",
openFolder: "Open {{type}} Folder",
reload: "Reload",
pluginSettings: "Settings",
website: "Website",
source: "Source",
server: "Support Server",
donate: "Donate"
},
Emotes: {
downloading: "Downloading emotes in the background do not reload.",
downloaded: "All emotes successfully downloaded.",

View File

@ -104,8 +104,8 @@ export default class Modals {
<div class="bd-modal-body">
<div class="tab-bar-container">
<div class="tab-bar TOP">
<div class="tab-bar-item">${Strings.General.plugins}</div>
<div class="tab-bar-item">${Strings.General.themes}</div>
<div class="tab-bar-item">${Strings.Panels.plugins}</div>
<div class="tab-bar-item">${Strings.Panels.themes}</div>
</div>
</div>
<div class="table-header">

View File

@ -1,9 +1,9 @@
import {Config} from "data";
import {React, WebpackModules, Patcher, ReactComponents, Utilities, Settings} from "modules";
import ContentList from "./settings/contentlist";
import SettingsGroup from "./settings/group";
import SettingsTitle from "./settings/title";
import Attribution from "./settings/attribution";
export default new class SettingsRenderer {
@ -41,13 +41,6 @@ export default new class SettingsRenderer {
}, options));
}
get attribution() {
return React.createElement("div", {className: "bd-version", style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
`BBD v${Config.bbdVersion} by `,
React.createElement("a", {href: "https://github.com/rauenzi/", target: "_blank"}, "Zerebos")
);
}
async patchSections() {
Patcher.after("SettingsManager", WebpackModules.getByDisplayName("FluxContainer(GuildSettings)").prototype, "render", (thisObject) => {
thisObject._reactInternalFiber.return.return.return.return.return.return.memoizedProps.id = "guild-settings";
@ -76,7 +69,7 @@ export default new class SettingsRenderer {
if (panel.clickListener) panel.onClick = (event) => panel.clickListener(thisObject, event, returnValue);
insert(panel);
}
insert({section: "CUSTOM", element: () => this.attribution});
insert({section: "CUSTOM", element: Attribution});
});
this.forceUpdate();
}

View File

@ -0,0 +1,22 @@
import {Config} from "data";
import {React, Strings} from "modules";
export default class BBDAttribution extends React.Component {
buildTitle(name, version, author) {
const title = Strings.Addons.title.split(/({{[A-Za-z]+}})/);
const nameIndex = title.findIndex(s => s == "{{name}}");
if (nameIndex) title[nameIndex] = name;
const versionIndex = title.findIndex(s => s == "{{version}}");
if (nameIndex) title[versionIndex] = version;
const authorIndex = title.findIndex(s => s == "{{author}}");
if (nameIndex) title[authorIndex] = author;
return title.flat();
}
render() {
return <div className= "bd-version">
{this.buildTitle("BBD", Config.bbdVersion, <a href="https://github.com/rauenzi" target="_blank" rel="noopener noreferrer">Zerebos</a>)}
</div>;
}
}

View File

@ -1,13 +1,4 @@
// static getPluginsPanel(plugins, state, options = {}) {
// const {folder = "", onChange, reload} = options;
// const titleComponent = React.createElement(SettingsTitle, {text: "Plugins", button: {title: "Open Plugin Folder", onClick: () => { require("electron").shell.openItem(folder); }}});
// const cards = plugins.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())).map(plugin =>
// React.createElement(PluginCard, {key: plugin.id, enabled: state[plugin.id], content: plugin, onChange, reload})
// );
// return [titleComponent, React.createElement("ul", {className: "bda-slist"}, ...cards)];
// }
import {React, Settings} from "modules";
import {React, Settings, Strings} from "modules";
import SettingsTitle from "./title";
import PluginCard from "./plugincard";
@ -24,7 +15,7 @@ export default class ContentList extends React.Component {
render() {
const {title, folder, contentList, contentState, onChange, reload} = this.props;
const showReloadIcon = !Settings.get("settings", "addons", "autoReload");
const button = folder ? {title: `Open ${title} Folder`, onClick: () => {require("electron").shell.openItem(folder);}} : null;
const button = folder ? {title: Strings.Addons.openFolder.format({type: title}), onClick: () => {require("electron").shell.openItem(folder);}} : null;
return [
<SettingsTitle key="title" text={title} button={button} otherChildren={showReloadIcon && <ReloadIcon className="bd-reload" onClick={this.reload.bind(this)} />} />,
<ul key="ContentList" className={"bda-slist"}>

View File

@ -1,5 +1,5 @@
// import {SettingsCookie, PluginCookie, Plugins} from "data";
import {React, Logger, Settings} from "modules";
import {React, Logger, Settings, Strings} from "modules";
import CloseButton from "../icons/close";
import ReloadIcon from "../icons/reload";
@ -58,6 +58,17 @@ export default class PluginCard extends React.Component {
return typeof value == "string" ? value : value.toString();
}
buildTitle(name, version, author) {
const title = Strings.Addons.title.split(/({{[A-Za-z]+}})/);
const nameIndex = title.findIndex(s => s == "{{name}}");
if (nameIndex) title[nameIndex] = React.createElement("span", {className: "bda-name"}, name);
const versionIndex = title.findIndex(s => s == "{{version}}");
if (nameIndex) title[versionIndex] = React.createElement("span", {className: "bda-version"}, version);
const authorIndex = title.findIndex(s => s == "{{author}}");
if (nameIndex) title[authorIndex] = React.createElement("span", {className: "bda-author"}, author);
return title.flat();
}
render() {
const {content} = this.props;
const name = this.getString(content.name);
@ -88,11 +99,7 @@ export default class PluginCard extends React.Component {
return React.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
React.createElement("div", {className: "bda-header"},
React.createElement("span", {className: "bda-header-title"},
React.createElement("span", {className: "bda-name"}, name),
" v",
React.createElement("span", {className: "bda-version"}, version),
" by ",
React.createElement("span", {className: "bda-author"}, author)
this.buildTitle(name, version, author)
),
React.createElement("div", {className: "bda-controls"},
!Settings.get("settings", "addons", "autoReload") && React.createElement(ReloadIcon, {className: "bd-reload bd-reload-card", onClick: this.reload}),
@ -107,11 +114,11 @@ export default class PluginCard extends React.Component {
),
(website || source || this.hasSettings) && React.createElement("div", {className: "bda-footer"},
React.createElement("span", {className: "bda-links"},
website && React.createElement("a", {className: "bda-link bda-link-website", href: website, target: "_blank"}, "Website"),
website && React.createElement("a", {className: "bda-link bda-link-website", href: website, target: "_blank"}, Strings.Addons.website),
website && source && " | ",
source && React.createElement("a", {className: "bda-link bda-link-source", href: source, target: "_blank"}, "Source")
source && React.createElement("a", {className: "bda-link bda-link-source", href: source, target: "_blank"}, Strings.Addons.source)
),
this.hasSettings && React.createElement("button", {onClick: this.showSettings, className: "bd-button bd-button-plugin-settings", disabled: !this.state.checked}, "Settings")
this.hasSettings && React.createElement("button", {onClick: this.showSettings, className: "bd-button bd-button-plugin-settings", disabled: !this.state.checked}, Strings.Addons.pluginSettings)
)
);
}

View File

@ -1,4 +1,4 @@
import {React, Settings} from "modules";
import {React, Settings, Strings} from "modules";
import ReloadIcon from "../icons/reload";
// import Toasts from "../toasts";
@ -20,6 +20,17 @@ export default class ThemeCard extends React.Component {
this.forceUpdate();
}
buildTitle(name, version, author) {
const title = Strings.Addons.title.split(/({{[A-Za-z]+}})/);
const nameIndex = title.findIndex(s => s == "{{name}}");
if (nameIndex) title[nameIndex] = React.createElement("span", {className: "bda-name"}, name);
const versionIndex = title.findIndex(s => s == "{{version}}");
if (nameIndex) title[versionIndex] = React.createElement("span", {className: "bda-version"}, version);
const authorIndex = title.findIndex(s => s == "{{author}}");
if (nameIndex) title[authorIndex] = React.createElement("span", {className: "bda-author"}, author);
return title.flat();
}
render() {
const {content} = this.props;
const name = content.name;
@ -32,11 +43,7 @@ export default class ThemeCard extends React.Component {
return React.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
React.createElement("div", {className: "bda-header"},
React.createElement("span", {className: "bda-header-title"},
React.createElement("span", {className: "bda-name"}, name),
" v",
React.createElement("span", {className: "bda-version"}, version),
" by ",
React.createElement("span", {className: "bda-author"}, author)
this.buildTitle(name, version, author)
),
React.createElement("div", {className: "bda-controls"},
!Settings.get("settings", "addons", "autoReload") && React.createElement(ReloadIcon, {className: "bd-reload bd-reload-card", onClick: this.reload}),