2021-06-19 17:37:12 -04:00
|
|
|
import styles from "./Panes.module.scss";
|
2021-07-05 06:23:23 -04:00
|
|
|
import { Text } from "preact-i18n";
|
|
|
|
|
2021-07-05 05:59:48 -04:00
|
|
|
import { dispatch } from "../../../redux";
|
2021-06-19 17:37:12 -04:00
|
|
|
import { connectState } from "../../../redux/connector";
|
2021-07-05 06:23:23 -04:00
|
|
|
import {
|
2021-07-05 06:25:20 -04:00
|
|
|
AVAILABLE_EXPERIMENTS,
|
|
|
|
ExperimentOptions,
|
2021-07-09 09:48:27 -04:00
|
|
|
EXPERIMENTS,
|
2021-07-05 06:23:23 -04:00
|
|
|
} from "../../../redux/reducers/experiments";
|
|
|
|
|
|
|
|
import Checkbox from "../../../components/ui/Checkbox";
|
2021-06-19 17:37:12 -04:00
|
|
|
|
|
|
|
interface Props {
|
2021-07-05 06:25:20 -04:00
|
|
|
options?: ExperimentOptions;
|
2021-06-19 17:37:12 -04:00
|
|
|
}
|
|
|
|
|
2021-07-05 05:59:48 -04:00
|
|
|
export function Component(props: Props) {
|
2021-07-05 06:25:20 -04:00
|
|
|
return (
|
|
|
|
<div className={styles.experiments}>
|
|
|
|
<h3>
|
|
|
|
<Text id="app.settings.pages.experiments.features" />
|
|
|
|
</h3>
|
|
|
|
{AVAILABLE_EXPERIMENTS.map((key) => (
|
|
|
|
<Checkbox
|
|
|
|
checked={(props.options?.enabled ?? []).indexOf(key) > -1}
|
|
|
|
onChange={(enabled) =>
|
|
|
|
dispatch({
|
|
|
|
type: enabled
|
|
|
|
? "EXPERIMENTS_ENABLE"
|
|
|
|
: "EXPERIMENTS_DISABLE",
|
|
|
|
key,
|
|
|
|
})
|
2021-07-09 15:46:35 -04:00
|
|
|
}
|
2021-07-10 10:57:29 -04:00
|
|
|
description={EXPERIMENTS[key].description}>
|
|
|
|
{EXPERIMENTS[key].title}
|
2021-07-05 06:25:20 -04:00
|
|
|
</Checkbox>
|
|
|
|
))}
|
|
|
|
{AVAILABLE_EXPERIMENTS.length === 0 && (
|
|
|
|
<div className={styles.empty}>
|
|
|
|
<Text id="app.settings.pages.experiments.not_available" />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
2021-06-19 17:37:12 -04:00
|
|
|
}
|
|
|
|
|
2021-07-05 06:23:23 -04:00
|
|
|
export const ExperimentsPage = connectState(Component, (state) => {
|
2021-07-05 06:25:20 -04:00
|
|
|
return {
|
|
|
|
options: state.experiments,
|
|
|
|
};
|
2021-07-05 06:23:23 -04:00
|
|
|
});
|