UNPKG

@kitten-science/kitten-scientists

Version:

Add-on for the wonderful incremental browser game: https://kittensgame.com/web/

61 lines 3.08 kB
import { FilterItems, FilterItemsGame, } from "../settings/LogFilterSettings.js"; import { cl } from "../tools/Log.js"; import { Container } from "./components/Container.js"; import { ExplainerListItem } from "./components/ExplainerListItem.js"; import { HeaderListItem } from "./components/HeaderListItem.js"; import stylesLabelListItem from "./components/LabelListItem.module.css"; import { SettingListItem } from "./components/SettingListItem.js"; import { SettingsList } from "./components/SettingsList.js"; import { SettingsPanel } from "./components/SettingsPanel.js"; export class LogFiltersSettingsUi extends SettingsPanel { constructor(parent, settings) { console.debug(...cl(`Constructing ${LogFiltersSettingsUi.name}`)); const label = parent.host.engine.i18n("ui.filter"); super(parent, settings, new SettingListItem(parent, settings, label, { onCheck: (_isBatchProcess) => { parent.host.engine.imessage("status.auto.enable", [label]); }, onUnCheck: (_isBatchProcess) => { parent.host.engine.imessage("status.auto.disable", [label]); }, }).addChildrenHead([new Container(parent, { classes: [stylesLabelListItem.fillSpace] })])); this.addChildContent(new SettingsList(this, { hasDisableAll: false, hasEnableAll: false, }).addChildren([ new HeaderListItem(this, "Kitten Scientists"), new SettingsList(this).addChildren(FilterItems.map(item => { return { label: this.host.engine.i18n(`filter.${item}`), name: item }; }) .sort((a, b) => a.label.localeCompare(b.label)) .map(item => new SettingListItem(this, this.setting.filters[item.name], item.label, { onCheck: () => { this.host.engine.imessage("filter.enable", [item.label]); }, onUnCheck: () => { this.host.engine.imessage("filter.disable", [item.label]); }, }))), ])); this.addChildContent(new SettingsList(this, { hasDisableAll: false, hasEnableAll: false, }).addChildren([ new HeaderListItem(this, "Kittens Game"), new SettingsList(this).addChildren(FilterItemsGame.map(item => { return { label: this.host.engine.i18n(`$console.filter.${item}`), name: item }; }) .sort((a, b) => a.label.localeCompare(b.label)) .map(item => new SettingListItem(this, this.setting.filtersGame[item.name], item.label, { onCheck: () => { this.host.engine.imessage("filter.enable", [item.label]); }, onUnCheck: () => { this.host.engine.imessage("filter.disable", [item.label]); }, }))), ])); this.addChildContent(new ExplainerListItem(this, "filter.explainer")); } } //# sourceMappingURL=LogFilterSettingsUi.js.map