feat(wip): del pair
This commit is contained in:
@@ -20,6 +20,7 @@ import Radio from '@mui/material/Radio';
|
|||||||
import RadioGroup from '@mui/material/RadioGroup';
|
import RadioGroup from '@mui/material/RadioGroup';
|
||||||
import { emptyWorkflow } from "../../shared/constants";
|
import { emptyWorkflow } from "../../shared/constants";
|
||||||
import { getActiveWorkflow } from "../../api/workflow";
|
import { getActiveWorkflow } from "../../api/workflow";
|
||||||
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
|
||||||
const fetchWorkflow = (id: string, callback: (response: WorkflowFile) => void) => {
|
const fetchWorkflow = (id: string, callback: (response: WorkflowFile) => void) => {
|
||||||
getActiveWorkflow(id).then(
|
getActiveWorkflow(id).then(
|
||||||
@@ -52,6 +53,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
const [showCaptureScreenshot, setShowCaptureScreenshot] = useState(true);
|
const [showCaptureScreenshot, setShowCaptureScreenshot] = useState(true);
|
||||||
const [showCaptureText, setShowCaptureText] = useState(true);
|
const [showCaptureText, setShowCaptureText] = useState(true);
|
||||||
const [captureStage, setCaptureStage] = useState<'initial' | 'pagination' | 'limit' | 'complete'>('initial');
|
const [captureStage, setCaptureStage] = useState<'initial' | 'pagination' | 'limit' | 'complete'>('initial');
|
||||||
|
const [hoverStates, setHoverStates] = useState<{ [id: string]: boolean }>({});
|
||||||
|
|
||||||
const { lastAction, notify } = useGlobalInfoStore();
|
const { lastAction, notify } = useGlobalInfoStore();
|
||||||
const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, limitType, customLimit, updateLimitType, updateCustomLimit, stopLimitMode, startLimitMode } = useActionContext();
|
const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, limitType, customLimit, updateLimitType, updateCustomLimit, stopLimitMode, startLimitMode } = useActionContext();
|
||||||
@@ -110,6 +112,24 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
setShowCaptureText(!(hasScrapeListAction || hasScreenshotAction));
|
setShowCaptureText(!(hasScrapeListAction || hasScreenshotAction));
|
||||||
}, [workflow]);
|
}, [workflow]);
|
||||||
|
|
||||||
|
const handleMouseEnter = (id: number) => {
|
||||||
|
setHoverStates(prev => ({ ...prev, [id]: true }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseLeave = (id: number) => {
|
||||||
|
setHoverStates(prev => ({ ...prev, [id]: false }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePairDelete = () => {
|
||||||
|
// deletePair(index - 1).then((updatedWorkflow) => {
|
||||||
|
// updateWorkflow(updatedWorkflow);
|
||||||
|
// }).catch((error) => {
|
||||||
|
// console.error(error);
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
console.log("handlePairDelete")
|
||||||
|
}
|
||||||
|
|
||||||
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
||||||
if (listId !== undefined && fieldKey !== undefined) {
|
if (listId !== undefined && fieldKey !== undefined) {
|
||||||
// Prevent editing if the field is confirmed
|
// Prevent editing if the field is confirmed
|
||||||
@@ -453,12 +473,22 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
error={!!errors[step.id]}
|
error={!!errors[step.id]}
|
||||||
helperText={errors[step.id]}
|
helperText={errors[step.id]}
|
||||||
|
onMouseEnter={() => handleMouseEnter(step.id)}
|
||||||
|
onMouseLeave={() => handleMouseLeave(step.id)}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
readOnly: confirmedTextSteps[step.id],
|
readOnly: confirmedTextSteps[step.id],
|
||||||
startAdornment: (
|
startAdornment: (
|
||||||
<InputAdornment position="start">
|
<InputAdornment position="start">
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
endAdornment: confirmedTextSteps[step.id] && hoverStates[step.id] && (
|
||||||
|
<InputAdornment position="end">
|
||||||
|
<DeleteIcon
|
||||||
|
onClick={() => handlePairDelete()}
|
||||||
|
sx={{ cursor: 'pointer', color: 'red' }}
|
||||||
|
/>
|
||||||
|
</InputAdornment>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user