2021-06-19 17:37:12 -04:00
|
|
|
import { Text } from "preact-i18n";
|
|
|
|
import styles from "./Panes.module.scss";
|
2021-07-05 05:59:48 -04:00
|
|
|
import { dispatch } from "../../../redux";
|
2021-06-19 17:37:12 -04:00
|
|
|
import Checkbox from "../../../components/ui/Checkbox";
|
|
|
|
import { connectState } from "../../../redux/connector";
|
|
|
|
import { AVAILABLE_EXPERIMENTS, ExperimentOptions } from "../../../redux/reducers/experiments";
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
options?: ExperimentOptions;
|
|
|
|
}
|
|
|
|
|
2021-07-05 05:59:48 -04:00
|
|
|
export function Component(props: Props) {
|
2021-06-19 17:37:12 -04:00
|
|
|
return (
|
2021-06-28 04:32:55 -04:00
|
|
|
<div className={styles.experiments}>
|
2021-06-19 17:37:12 -04:00
|
|
|
<h3>
|
|
|
|
<Text id="app.settings.pages.experiments.features" />
|
|
|
|
</h3>
|
|
|
|
{
|
|
|
|
(AVAILABLE_EXPERIMENTS).map(
|
|
|
|
key =>
|
|
|
|
<Checkbox
|
|
|
|
checked={(props.options?.enabled ?? []).indexOf(key) > -1}
|
2021-07-05 05:59:48 -04:00
|
|
|
onChange={enabled =>
|
|
|
|
dispatch({
|
2021-06-19 17:37:12 -04:00
|
|
|
type: enabled ? 'EXPERIMENTS_ENABLE' : 'EXPERIMENTS_DISABLE',
|
|
|
|
key
|
2021-07-05 05:59:48 -04:00
|
|
|
})
|
|
|
|
}
|
2021-06-19 17:37:12 -04:00
|
|
|
>
|
|
|
|
<Text id={`app.settings.pages.experiments.titles.${key}`} />
|
|
|
|
<p>
|
|
|
|
<Text id={`app.settings.pages.experiments.descriptions.${key}`} />
|
|
|
|
</p>
|
|
|
|
</Checkbox>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
AVAILABLE_EXPERIMENTS.length === 0 &&
|
2021-06-28 03:55:05 -04:00
|
|
|
<div className={styles.empty}>
|
|
|
|
<Text id="app.settings.pages.experiments.not_available" />
|
|
|
|
</div>
|
|
|
|
|
2021-06-19 17:37:12 -04:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ExperimentsPage = connectState(
|
|
|
|
Component,
|
|
|
|
state => {
|
|
|
|
return {
|
|
|
|
options: state.experiments
|
|
|
|
};
|
2021-07-05 05:59:48 -04:00
|
|
|
}
|
2021-06-19 17:37:12 -04:00
|
|
|
);
|