feat: match states
This commit is contained in:
@@ -28,10 +28,10 @@ interface RightSidePanelProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture }) => {
|
export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture }) => {
|
||||||
const [textLabels, setTextLabels] = useState<{ [id: number]: string }>({});
|
const [textLabels, setTextLabels] = useState<{ [id: string]: string }>({});
|
||||||
const [errors, setErrors] = useState<{ [id: number]: string }>({});
|
const [errors, setErrors] = useState<{ [id: string]: string }>({});
|
||||||
const [confirmedTextSteps, setConfirmedTextSteps] = useState<{ [id: number]: boolean }>({});
|
const [confirmedTextSteps, setConfirmedTextSteps] = useState<{ [id: string]: boolean }>({});
|
||||||
const [confirmedListTextFields, setConfirmedListTextFields] = useState<{ [listId: number]: { [fieldKey: string]: boolean } }>({});
|
const [confirmedListTextFields, setConfirmedListTextFields] = useState<{ [listId: string]: { [fieldKey: string]: boolean } }>({});
|
||||||
const [showPaginationOptions, setShowPaginationOptions] = useState(false);
|
const [showPaginationOptions, setShowPaginationOptions] = useState(false);
|
||||||
const [showLimitOptions, setShowLimitOptions] = useState(false);
|
const [showLimitOptions, setShowLimitOptions] = useState(false);
|
||||||
const [captureStage, setCaptureStage] = useState<'initial' | 'pagination' | 'limit' | 'complete'>('initial');
|
const [captureStage, setCaptureStage] = useState<'initial' | 'pagination' | 'limit' | 'complete'>('initial');
|
||||||
@@ -90,13 +90,18 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
|
|
||||||
const handleListTextFieldDiscard = (listId: number, fieldKey: string) => {
|
const handleListTextFieldDiscard = (listId: number, fieldKey: string) => {
|
||||||
removeListTextField(listId, fieldKey);
|
removeListTextField(listId, fieldKey);
|
||||||
setConfirmedListTextFields(prev => ({
|
setConfirmedListTextFields(prev => {
|
||||||
...prev,
|
const updatedListFields = { ...(prev[listId] || {}) };
|
||||||
[listId]: {
|
delete updatedListFields[fieldKey];
|
||||||
...(prev[listId] || {}),
|
return {
|
||||||
[fieldKey]: false
|
...prev,
|
||||||
}
|
[listId]: updatedListFields
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
|
setErrors(prev => {
|
||||||
|
const { [fieldKey]: _, ...rest } = prev;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTextSettingsObject = useCallback(() => {
|
const getTextSettingsObject = useCallback(() => {
|
||||||
@@ -159,6 +164,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}, [browserSteps, paginationType, limitType, customLimit]);
|
}, [browserSteps, paginationType, limitType, customLimit]);
|
||||||
|
|
||||||
|
|
||||||
const resetListState = useCallback(() => {
|
const resetListState = useCallback(() => {
|
||||||
setShowPaginationOptions(false);
|
setShowPaginationOptions(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user