diff --git a/components/Config/LoadConfig.tsx b/components/Config/LoadConfig.tsx index a590e20ac..d36fecd19 100644 --- a/components/Config/LoadConfig.tsx +++ b/components/Config/LoadConfig.tsx @@ -4,6 +4,7 @@ import { DropzoneStatus, FullScreenDropzone } from '@mantine/dropzone'; import { showNotification } from '@mantine/notifications'; import { useRef } from 'react'; import { useRouter } from 'next/router'; +import { setCookies } from 'cookies-next'; import { useConfig } from '../../tools/state'; import { Config } from '../../tools/types'; @@ -69,15 +70,21 @@ export default function LoadConfigComponent(props: any) { }); return; } + const newConfig: Config = JSON.parse(e); showNotification({ autoClose: 5000, radius: 'md', - title: Config loaded successfully, + title: ( + + Config {newConfig.name} loaded successfully + + ), color: 'green', icon: , message: undefined, }); - setConfig(JSON.parse(e)); + setCookies('config-name', newConfig.name, { maxAge: 60 * 60 * 24 * 30 }); + setConfig(newConfig); }); }} accept={['application/json']} diff --git a/components/Config/SaveConfig.tsx b/components/Config/SaveConfig.tsx index d12f7ad22..cfaf196d4 100644 --- a/components/Config/SaveConfig.tsx +++ b/components/Config/SaveConfig.tsx @@ -7,7 +7,7 @@ export default function SaveConfigComponent(props: any) { const { config } = useConfig(); function onClick(e: any) { if (config) { - fileDownload(JSON.stringify(config, null, '\t'), 'config.json'); + fileDownload(JSON.stringify(config, null, '\t'), `${config.name}.json`); } } return (