Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BluePrint] - Create Type Modal when there is no parent selected then Attributes, Types and Required header and Indexes shoud be invisible #2237

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ export const Editor = ({

const IconComponent = Icons[selectedIcon as keyof typeof Icons]

const parentType = selectedSchema ? selectedSchema.type : parent

return (
<Flex>
<HeaderRow>
Expand Down Expand Up @@ -591,29 +593,37 @@ export const Editor = ({
</>
)}
</Flex>
<CreateCustomNodeAttribute
onDelete={handleDeleteAttribute}
parent={selectedSchema ? selectedSchema.type : parent}
/>

{parentType && (
<CreateCustomNodeAttribute
onDelete={handleDeleteAttribute}
parent={selectedSchema ? selectedSchema.type : parent}
/>
)}
<MediaOptions
initialOptions={mediaOptions}
setMediaOptions={setMediaOptions}
setSubmitDisabled={setSubmitDisabled}
/>
<Flex>
<LineBar />
<Flex mb={12} mt={12}>
<Text>Indexes</Text>
{parentType && (
<Flex>
<LineBar />
<Flex mb={12} mt={12}>
<Text>Indexes</Text>
</Flex>
<Grid item mb={2} width="70%">
<AutoComplete
onSelect={(val) => setValue('selectedIndex', val?.value || '')}
options={attributes
.filter((attr) => attr.key)
.map((attr) => ({ label: attr.key, value: attr.key }))}
selectedValue={resolvedSelectedIndexValue}
/>
</Grid>
<LineBar />
</Flex>
<Grid item mb={2} width="70%">
<AutoComplete
onSelect={(val) => setValue('selectedIndex', val?.value || '')}
options={attributes.filter((attr) => attr.key).map((attr) => ({ label: attr.key, value: attr.key }))}
selectedValue={resolvedSelectedIndexValue}
/>
</Grid>
<LineBar />
</Flex>
)}

<Flex direction="row" justify="space-between" mt={20}>
{selectedSchema && (
<Flex direction="column">
Expand Down Expand Up @@ -660,7 +670,7 @@ export const Editor = ({
}

const CustomButton = styled(Button)`
width: 100% !important;
width: 400px !important;
margin: 0 auto !important;
`

Expand Down Expand Up @@ -765,4 +775,4 @@ const InputIconWrapper = styled(Flex)`

const InputWrapper = styled(Flex)`
width: 320px;
`
`
Loading