diff --git a/demo/src/MemoryModelsSample.tsx b/demo/src/MemoryModelsSample.tsx index 6a41dafc..92c8d551 100644 --- a/demo/src/MemoryModelsSample.tsx +++ b/demo/src/MemoryModelsSample.tsx @@ -9,19 +9,22 @@ type MemoryModelsSamplePropTypes = { }; export default function MemoryModelsSample(props: MemoryModelsSamplePropTypes) { - const [fileContents, setFileContents] = useState<{ [key: string]: string }>( - {} - ); + const [fileContents, setFileContents] = useState<{ + [key: string]: [string, Object]; + }>({}); useEffect(() => { - const sampleFiles = ["automation", "blankspace", "manual", "simple"]; + const samples = ["automation", "blankspace", "manual", "simple"]; const tempFileContents = {}; - for (const fileName of sampleFiles) { - tempFileContents[fileName] = JSON.stringify( - require(`./sample_json/${fileName}.json`), - null, - 2 - ); + for (const sample of samples) { + tempFileContents[sample] = [ + JSON.stringify( + require(`./sample/${sample}/${sample}.json`), + null, + 2 + ), + require(`./sample/${sample}/config.json`), + ]; } setFileContents({ ...fileContents, @@ -29,14 +32,16 @@ export default function MemoryModelsSample(props: MemoryModelsSamplePropTypes) { }); }, []); - const handleButtonClick = (name: string, content: string) => { + const handleButtonClick = ( + name: string, + content: string, + config: Object + ) => { props.setTextData(content); - if (name === "manual") { - props.setConfigData({ - ...props.configData, - useAutomation: false, - }); - } + props.setConfigData({ + ...props.configData, + ...config, + }); }; return ( @@ -48,7 +53,11 @@ export default function MemoryModelsSample(props: MemoryModelsSamplePropTypes) {