Skip to content

Commit

Permalink
add config, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTallJerry committed Apr 2, 2024
1 parent 423c6f1 commit cfb37ce
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
45 changes: 27 additions & 18 deletions demo/src/MemoryModelsSample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,39 @@ 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,
...tempFileContents,
});
}, []);

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 (
Expand All @@ -48,7 +53,11 @@ export default function MemoryModelsSample(props: MemoryModelsSamplePropTypes) {
<Button
variant="contained"
onClick={() =>
handleButtonClick(file[0], file[1])
handleButtonClick(
file[0],
file[1][0],
file[1][1]
)
}
>
{file[0]}
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions demo/src/sample/automation/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
"isClass": true,
"name": "__main__",
"id": null,
"value": {
"lst1": 82,
"lst2": 84,
"p": 99,
"d": 10,
"t": 11
},
"value": { "lst1": 82, "lst2": 84, "p": 99, "d": 10, "t": 11 },
"stack_frame": true
},
{
Expand All @@ -22,10 +16,7 @@
"isClass": true,
"name": "func",
"id": null,
"value": {
"age": 12,
"name": 17
},
"value": { "age": 12, "name": 17 },
"stack_frame": true
},
{
Expand Down
1 change: 1 addition & 0 deletions demo/src/sample/blankspace/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions demo/src/sample/manual/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"useAutomation": false
}
File renamed without changes.
1 change: 1 addition & 0 deletions demo/src/sample/simple/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
"isClass": true,
"name": "__main__",
"id": null,
"value": {
"lst1": 82,
"lst2": 84,
"p": 99,
"d": 10,
"t": 11
},
"value": { "lst1": 82, "lst2": 84, "p": 99, "d": 10, "t": 11 },
"stack_frame": true
},
{
Expand Down

0 comments on commit cfb37ce

Please sign in to comment.