feat: handle pagination selection
This commit is contained in:
@@ -180,13 +180,24 @@ export const BrowserWindow = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paginationMode && getList) {
|
||||||
|
// Set the pagination selector
|
||||||
|
const paginationType = 'clickNext'; // You can get this from user selection or UI
|
||||||
|
addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector });
|
||||||
|
console.log(
|
||||||
|
`Pagination mode: ${paginationType} with selector: ${highlighterData.selector}`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getList === true && !listSelector) {
|
if (getList === true && !listSelector) {
|
||||||
|
// Set listSelector
|
||||||
setListSelector(highlighterData.selector);
|
setListSelector(highlighterData.selector);
|
||||||
setCurrentListId(Date.now());
|
setCurrentListId(Date.now());
|
||||||
setFields({});
|
setFields({});
|
||||||
} else if (getList === true && listSelector && currentListId) {
|
} else if (getList === true && listSelector && currentListId) {
|
||||||
|
// Add fields to the list
|
||||||
if (options.length === 1) {
|
if (options.length === 1) {
|
||||||
// Handle directly without showing the modal
|
|
||||||
const attribute = options[0].value;
|
const attribute = options[0].value;
|
||||||
const newField: TextStep = {
|
const newField: TextStep = {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
@@ -199,20 +210,17 @@ export const BrowserWindow = () => {
|
|||||||
attribute
|
attribute
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setFields(prevFields => {
|
setFields(prevFields => ({
|
||||||
const updatedFields = {
|
...prevFields,
|
||||||
...prevFields,
|
[newField.label]: newField
|
||||||
[newField.label]: newField
|
}));
|
||||||
};
|
|
||||||
return updatedFields;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (listSelector) {
|
if (listSelector) {
|
||||||
addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0);
|
addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector });
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Show the modal if there are multiple options
|
|
||||||
setAttributeOptions(options);
|
setAttributeOptions(options);
|
||||||
setSelectedElement({
|
setSelectedElement({
|
||||||
selector: highlighterData.selector,
|
selector: highlighterData.selector,
|
||||||
|
|||||||
Reference in New Issue
Block a user