-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.jsx
48 lines (44 loc) · 1.37 KB
/
main.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from "react";
import { render } from "ink";
import { FormInput } from "./components/form/FormInput.jsx";
import { FormSelect } from "./components/form/FormSelect.jsx";
import { WizWelcome } from "./components/form/WizWelcome.jsx";
const filename = Deno.args[0] || "assistants/templates/demo.json";
// send a copy of the original data through the pipeline
const recipeDataTemplate = JSON.parse(Deno.readTextFileSync(filename));
// this will be the data that can and will be mutated
const recipeData = JSON.parse(Deno.readTextFileSync(filename));
const elemCount = 0;
const start = recipeData.recipe[elemCount];
const { attr, inputType, details } = start;
if (inputType === "input") {
render(
<>
<WizWelcome recipe={recipeDataTemplate} />
<FormInput
assistant={recipeData.assistant}
recipe={recipeData.recipe}
recipeDataTemplate={recipeDataTemplate}
keyCount={elemCount}
attr={attr}
prevProps={new Object()}
config={details}
/>
</>,
);
} else if (inputType === "select") {
render(
<>
<WizWelcome recipe={recipeData} />
<FormSelect
assistant={recipeData.assistant}
recipe={recipeData.recipe}
recipeDataTemplate={recipeDataTemplate}
keyCount={elemCount}
attr={attr}
prevProps={new Object()}
config={details}
/>
</>,
);
}