2019-06-08 08:35:43 +02:00
|
|
|
import {Config} from "data";
|
2019-06-09 22:30:33 +02:00
|
|
|
import {React} from "modules";
|
|
|
|
|
2019-06-10 00:37:46 +02:00
|
|
|
import ContentList from "./contentlist";
|
2019-06-08 08:35:43 +02:00
|
|
|
import SettingsGroup from "../settings/group";
|
2019-06-06 06:28:43 +02:00
|
|
|
import SettingsTitle from "./title";
|
2019-05-28 23:27:25 +02:00
|
|
|
|
2019-05-28 20:19:48 +02:00
|
|
|
export default class V2_SettingsPanel {
|
|
|
|
|
2019-06-09 22:30:33 +02:00
|
|
|
static buildSettingsPanel(title, config, state, onChange, button = null) {
|
2019-06-08 08:35:43 +02:00
|
|
|
config.forEach(section => {
|
|
|
|
section.settings.forEach(item => item.value = state[section.id][item.id]);
|
|
|
|
});
|
2019-06-09 22:30:33 +02:00
|
|
|
return this.getSettingsPanel(title, config, onChange, button);
|
2019-05-28 20:19:48 +02:00
|
|
|
}
|
|
|
|
|
2019-06-09 22:30:33 +02:00
|
|
|
static getSettingsPanel(title, groups, onChange, button = null) {
|
|
|
|
return [React.createElement(SettingsTitle, {text: title, button: button}), groups.map(section => {
|
2019-06-08 08:35:43 +02:00
|
|
|
return React.createElement(SettingsGroup, Object.assign({}, section, {onChange}));
|
2019-06-06 06:28:43 +02:00
|
|
|
})];
|
2019-06-05 06:30:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-10 00:37:46 +02:00
|
|
|
static getContentPanel(title, contentList, contentState, options = {}) {
|
|
|
|
return React.createElement(ContentList, Object.assign({}, {
|
|
|
|
title: title,
|
|
|
|
contentList: contentList,
|
|
|
|
contentState: contentState
|
|
|
|
}, options));
|
2019-05-31 07:53:11 +02:00
|
|
|
}
|
|
|
|
|
2019-06-08 08:35:43 +02:00
|
|
|
static get attribution() {
|
2019-06-21 17:16:49 +02:00
|
|
|
return React.createElement("div", {className: "bd-version", style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
|
2019-06-04 16:21:07 +02:00
|
|
|
`BBD v${Config.bbdVersion} by `,
|
2019-06-21 17:16:49 +02:00
|
|
|
React.createElement("a", {href: "https://github.com/rauenzi/", target: "_blank"}, "Zerebos")
|
2019-06-04 16:21:07 +02:00
|
|
|
);
|
|
|
|
}
|
2019-05-28 20:19:48 +02:00
|
|
|
}
|