+
{i18next.t(`theme:${theme.label}`)}
+ {this.props.themeAlgorithm.includes(theme.key) ?
: null}
+
,
+ theme.key, theme.icon));
}
render() {
- const themeItems = this.getOrganizationThemes(this.state.themes);
const onClick = (e) => {
- Setting.setTheme(e.key);
+ let nextTheme;
+ if (e.key === "compact") {
+ if (this.props.themeAlgorithm.includes("compact")) {
+ nextTheme = this.props.themeAlgorithm.filter((theme) => theme !== "compact");
+ } else {
+ nextTheme = [...this.props.themeAlgorithm, "compact"];
+ }
+ } else {
+ if (!this.props.themeAlgorithm.includes(e.key)) {
+ if (e.key === "dark") {
+ nextTheme = [...this.props.themeAlgorithm.filter((theme) => theme !== "default"), e.key];
+ } else {
+ nextTheme = [...this.props.themeAlgorithm.filter((theme) => theme !== "dark"), e.key];
+ }
+ } else {
+ nextTheme = [...this.props.themeAlgorithm];
+ }
+ }
+
+ this.icon = getIcon(nextTheme);
+ this.props.onChange(nextTheme);
};
return (
-