diff --git a/api-editor/gui/src/features/annotations/batchforms/ConfirmAnnotations.tsx b/api-editor/gui/src/features/annotations/batchforms/ConfirmAnnotations.tsx index 6ed63feea..f536ee39a 100644 --- a/api-editor/gui/src/features/annotations/batchforms/ConfirmAnnotations.tsx +++ b/api-editor/gui/src/features/annotations/batchforms/ConfirmAnnotations.tsx @@ -33,7 +33,13 @@ export const ConfirmAnnotations: React.FC = function ({ const useCancelRef = useRef(null); return ( - + diff --git a/api-editor/gui/src/features/annotations/batchforms/DestinationBatchForm.tsx b/api-editor/gui/src/features/annotations/batchforms/DestinationBatchForm.tsx index 58274176c..82715d8e6 100644 --- a/api-editor/gui/src/features/annotations/batchforms/DestinationBatchForm.tsx +++ b/api-editor/gui/src/features/annotations/batchforms/DestinationBatchForm.tsx @@ -1,4 +1,4 @@ -import { FormControl, FormErrorIcon, FormErrorMessage, FormLabel, Input } from '@chakra-ui/react'; +import { FormControl, FormErrorIcon, FormErrorMessage, FormLabel, Input, Text as ChakraText } from '@chakra-ui/react'; import React, { useState } from 'react'; import { useForm } from 'react-hook-form'; import { useAppDispatch } from '../../../app/hooks'; @@ -75,7 +75,7 @@ export const DestinationBatchForm: React.FC = functio - This will annotate classes and global functions. + This will annotate classes and global functions. {confirmWindowVisible && ( = function ({ }, }); - let [confirmWindowVisible, setConfirmWindowVisible] = useState(false); - let [data, setData] = useState({ oldString: '', newString: '' }); + const [confirmWindowVisible, setConfirmWindowVisible] = useState(false); + const [data, setData] = useState({ oldString: '', newString: '' }); + + const filteredTargets = targets.filter((t) => t.name !== t.name.replace(data.oldString, data.newString)); // Event handlers ---------------------------------------------------------- @@ -71,6 +58,7 @@ export const OldNewBatchForm: React.FC = function ({ const handleCancel = () => { dispatch(hideAnnotationForm()); }; + // Rendering ------------------------------------------------------------------------------------------------------- return ( @@ -94,22 +82,17 @@ export const OldNewBatchForm: React.FC = function ({ Replacement String: - + {errors.newString?.message} - This will annotate classes, functions, and parameters. + This will annotate classes, functions, and parameters. {confirmWindowVisible && ( handleSave(data)} setConfirmVisible={setConfirmWindowVisible} /> @@ -117,61 +100,3 @@ export const OldNewBatchForm: React.FC = function ({ ); }; - -interface ConfirmAnnotationsProps { - targets: PythonDeclaration[]; - data: OldNewBatchFormState; - handleSave: () => void; - setConfirmVisible: (visible: boolean) => void; -} - -const ConfirmAnnotations: React.FC = function ({ - targets, - data, - handleSave, - setConfirmVisible, -}) { - const handleCancel = () => { - setConfirmVisible(false); - hideAnnotationForm(); - }; - - const useCancelRef = useRef(null); - - const filteredTargets = targets.filter((t) => t.name !== t.name.replace(data.oldString, data.newString)); - - return ( - - - - - This will annotate these {filteredTargets.length} items - - - - - {filteredTargets.map((target) => ( - {target.id} - ))} - - - - - - - - - - - ); -}; diff --git a/api-editor/gui/src/features/annotations/batchforms/TypeValueBatchForm.tsx b/api-editor/gui/src/features/annotations/batchforms/TypeValueBatchForm.tsx index 233eefe94..ab42c8511 100644 --- a/api-editor/gui/src/features/annotations/batchforms/TypeValueBatchForm.tsx +++ b/api-editor/gui/src/features/annotations/batchforms/TypeValueBatchForm.tsx @@ -13,6 +13,7 @@ import { RadioGroup, Select, Stack, + Text as ChakraText, } from '@chakra-ui/react'; import React, { useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -152,7 +153,7 @@ export const TypeValueBatchForm: React.FC = function ({ )} - This will annotate parameters. + This will annotate parameters. {confirmWindowVisible && (