From 06f7ab1bafc9afe5acc3077a1f7ebe4a537ee877 Mon Sep 17 00:00:00 2001 From: AbdulWahab3181 Date: Wed, 28 Aug 2024 21:03:29 +0500 Subject: [PATCH 1/2] feat(input): added index to node type creation --- .../BlueprintModal/Body/Editor/index.tsx | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx index 17c0a38ff..1117b80b0 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Button } from '@mui/material' +import { Button, Grid } from '@mui/material' import { useEffect, useMemo, useState } from 'react' import { FieldValues, FormProvider, useForm } from 'react-hook-form' import { ClipLoader } from 'react-spinners' @@ -32,6 +32,7 @@ export type FormData = { attributes?: { [k: string]: string | boolean } + selectedIndex?: string } type Props = { @@ -70,7 +71,7 @@ const handleSubmitForm = async ( mediaOptions: { videoAudio: boolean; image: boolean; sourceLink: boolean }, ): Promise => { try { - const { attributes, ...withoutAttributes } = data + const { attributes, selectedIndex, ...withoutAttributes } = data const updatedAttributes = { ...convertAttributes(attributes), @@ -79,12 +80,14 @@ const handleSubmitForm = async ( const requestData: { attributes: { [key: string]: string } + index?: string media_url?: string image_url?: string source_link?: string } = { ...withoutAttributes, attributes: updatedAttributes, + index: selectedIndex, } if (mediaOptions.videoAudio) { @@ -476,6 +479,20 @@ export const Editor = ({ parent={selectedSchema ? selectedSchema.type : parent} /> + + + + Indexes + + + setValue(`selectedIndex`, val?.value)} + options={attributes.map((attr) => ({ label: attr.key, value: attr.key }))} + /> + + + {selectedSchema && ( @@ -557,3 +574,10 @@ const StyledError = styled(Flex)` margin-top: 12px; padding-top: 20px; ` + +const LineBar = styled.div` + border: 1px solid ${colors.BG2}; + width: calc(100% + 32px); + opacity: 0.5; + margin-left: -16px; +` From 43d1e94857c60e537b15d0f339f94b60732dd291 Mon Sep 17 00:00:00 2001 From: AbdulWahab3181 Date: Thu, 29 Aug 2024 00:57:55 +0500 Subject: [PATCH 2/2] feat(input): removed test id --- .../ModalsContainer/BlueprintModal/Body/Editor/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx index 1117b80b0..22b6b2f64 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx @@ -486,7 +486,6 @@ export const Editor = ({ setValue(`selectedIndex`, val?.value)} options={attributes.map((attr) => ({ label: attr.key, value: attr.key }))} />