Add new config format

Should be WAAAAY easier to work with modules now
This commit is contained in:
ajnart
2022-05-22 20:42:10 +02:00
parent bf85818f8b
commit af2e0235bf
12 changed files with 99 additions and 65 deletions

View File

@@ -20,12 +20,12 @@ export async function getServerSideProps(
return {
props: {
config: {
name: '',
name: 'Default config',
services: [],
settings: {
enabledModules: [],
searchUrl: 'https://www.google.com/search?q=',
},
modules: {},
},
},
};

View File

@@ -27,10 +27,9 @@ export async function getServerSideProps({
name: cookie.toString(),
services: [],
settings: {
enabledModules: [],
searchBar: true,
searchUrl: 'https://www.google.com/search?q=',
},
modules: {},
},
},
};

33
src/pages/tryconfig.tsx Normal file
View File

@@ -0,0 +1,33 @@
import { Button } from '@mantine/core';
import { Prism } from '@mantine/prism';
import { useState } from 'react';
import { DateModule } from '../components/modules';
import { useConfig } from '../tools/state';
export default function TryConfig(props: any) {
const { config } = useConfig();
const [tempConfig, setTempConfig] = useState(config);
return (
<>
<Prism language="json">{JSON.stringify(tempConfig, null, 2)}</Prism>
<Button
onClick={() => {
setTempConfig({
...tempConfig,
modules: {
[DateModule.title]: {
enabled: true,
title: DateModule.title,
options: {
...DateModule.options,
},
},
},
});
}}
>
Add a module to the modules thingy
</Button>
</>
);
}