✨ Add new config format
Should be WAAAAY easier to work with modules now
This commit is contained in:
@@ -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: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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
33
src/pages/tryconfig.tsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user