2022-08-02 05:17:19 +02:00
|
|
|
import { Checkbox, SimpleGrid, Stack, Title } from '@mantine/core';
|
2022-07-23 22:22:55 +02:00
|
|
|
import * as Modules from '../../modules';
|
2022-05-10 20:33:11 +02:00
|
|
|
import { useConfig } from '../../tools/state';
|
|
|
|
|
|
|
|
|
|
export default function ModuleEnabler(props: any) {
|
|
|
|
|
const { config, setConfig } = useConfig();
|
2022-05-10 20:56:48 +02:00
|
|
|
const modules = Object.values(Modules).map((module) => module);
|
2022-05-10 20:33:11 +02:00
|
|
|
return (
|
2022-08-02 02:21:04 +02:00
|
|
|
<Stack>
|
2022-06-11 19:43:01 +02:00
|
|
|
<Title order={4}>Module enabler</Title>
|
2022-08-02 02:21:04 +02:00
|
|
|
<SimpleGrid cols={3} spacing="xs">
|
2022-06-11 19:43:01 +02:00
|
|
|
{modules.map((module) => (
|
|
|
|
|
<Checkbox
|
|
|
|
|
key={module.title}
|
2022-08-02 05:17:19 +02:00
|
|
|
size="lg"
|
2022-06-11 19:43:01 +02:00
|
|
|
checked={config.modules?.[module.title]?.enabled ?? false}
|
|
|
|
|
label={`${module.title}`}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
setConfig({
|
|
|
|
|
...config,
|
|
|
|
|
modules: {
|
|
|
|
|
...config.modules,
|
|
|
|
|
[module.title]: {
|
|
|
|
|
...config.modules?.[module.title],
|
|
|
|
|
enabled: e.currentTarget.checked,
|
|
|
|
|
},
|
2022-05-10 20:33:11 +02:00
|
|
|
},
|
2022-06-11 19:43:01 +02:00
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</SimpleGrid>
|
2022-08-02 02:21:04 +02:00
|
|
|
</Stack>
|
2022-05-10 20:33:11 +02:00
|
|
|
);
|
|
|
|
|
}
|