This repository was archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCommandInspector.tsx
More file actions
64 lines (60 loc) · 1.84 KB
/
CommandInspector.tsx
File metadata and controls
64 lines (60 loc) · 1.84 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { FormikValues } from 'formik';
import CommandMapping from '../../../mappings/CommandMapping';
import { useStoreActions } from '../../../state/Hooks';
import { DefinitionModel } from '../../../state/Store';
import InspectorProperty from '../../atoms/form/InspectorProperty';
import ListProperty from '../../atoms/form/ListProperty';
import StepPropertiesMenu from '../../menus/definitions/StepDefinitionMenu';
import StepTypePageNav from '../../menus/definitions/subtypes/StepTypePage';
import SubTypeMenuNav from '../../menus/SubTypeMenu';
const NewButton = (
props: FormikValues & {
definitions: DefinitionModel;
},
) => {
const navigateTo = useStoreActions((actions) => actions.navigateTo);
return (
<button
type="button"
onClick={() => {
navigateTo({
component: SubTypeMenuNav,
props: {
typePage: StepTypePageNav,
menuPage: StepPropertiesMenu,
passThrough: { dataType: CommandMapping },
},
values: props.values,
});
}}
className="ml-auto tracking-wide hover:underline leading-6 text-sm text-circle-blue font-medium"
>
New
</button>
);
};
const CommandInspector = (
props: FormikValues & { definitions: DefinitionModel },
) => {
return (
<div>
<InspectorProperty
name="name"
label="Name"
required
value={props.values.name}
/>
<InspectorProperty name="description" label="Description" as="textarea" />
<ListProperty
label="Steps"
name="steps"
values={props.values.steps}
expanded
required
emptyText="No steps defined yet. At least one step is required."
titleExpanded={<NewButton values={props.values} definitions={props.definitions} />}
/>
</div>
);
};
export default CommandInspector;