feat: rm workflow in progress logic
This commit is contained in:
@@ -178,14 +178,6 @@
|
|||||||
"limit": "Choose the number of items to extract",
|
"limit": "Choose the number of items to extract",
|
||||||
"complete": "Capture is complete"
|
"complete": "Capture is complete"
|
||||||
},
|
},
|
||||||
"workflow_progress": {
|
|
||||||
"title": "Workflow Progress",
|
|
||||||
"description": "You have completed {{completed}} out of {{total}} possible actions",
|
|
||||||
"completed": "All actions completed!"
|
|
||||||
},
|
|
||||||
"workflow_actions": {
|
|
||||||
"description": "The following actions have been added to your workflow:"
|
|
||||||
},
|
|
||||||
"actions": {
|
"actions": {
|
||||||
"text": "Capture Text",
|
"text": "Capture Text",
|
||||||
"list": "Capture List",
|
"list": "Capture List",
|
||||||
|
|||||||
@@ -49,24 +49,14 @@ const Content = styled.div`
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
const ActionDescriptionBox = ({ isDarkMode }: { isDarkMode: boolean }) => {
|
const ActionDescriptionBox = ({ isDarkMode }: { isDarkMode: boolean }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const {
|
const { getText, getScreenshot, getList, captureStage } = useActionContext() as {
|
||||||
getText,
|
|
||||||
getScreenshot,
|
|
||||||
getList,
|
|
||||||
captureStage,
|
|
||||||
actionsInWorkflow
|
|
||||||
} = useActionContext() as {
|
|
||||||
getText: boolean;
|
getText: boolean;
|
||||||
getScreenshot: boolean;
|
getScreenshot: boolean;
|
||||||
getList: boolean;
|
getList: boolean;
|
||||||
captureStage: 'initial' | 'pagination' | 'limit' | 'complete';
|
captureStage: 'initial' | 'pagination' | 'limit' | 'complete';
|
||||||
actionsInWorkflow: {
|
|
||||||
text: boolean;
|
|
||||||
list: boolean;
|
|
||||||
screenshot: boolean;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const messages = [
|
const messages = [
|
||||||
@@ -128,95 +118,10 @@ const ActionDescriptionBox = ({ isDarkMode }: { isDarkMode: boolean }) => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const actionsInWorkflowCount = Object.values(actionsInWorkflow).filter(Boolean).length;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Typography variant="subtitle2" gutterBottom>
|
<Typography variant="subtitle2" gutterBottom>{t('action_description.default.title')}</Typography>
|
||||||
{actionsInWorkflowCount === 0
|
<Typography variant="body2" gutterBottom>{t('action_description.default.description')}</Typography>
|
||||||
? t('action_description.default.title')
|
|
||||||
: t('action_description.workflow_progress.title')}
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
{actionsInWorkflowCount === 0 ? (
|
|
||||||
<Typography variant="body2" gutterBottom>
|
|
||||||
{t('action_description.default.description')}
|
|
||||||
</Typography>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Typography variant="body2" gutterBottom>
|
|
||||||
{t('action_description.workflow_actions.description')}
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Box mt={2}>
|
|
||||||
{actionsInWorkflow.text && (
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={true}
|
|
||||||
disabled
|
|
||||||
sx={{
|
|
||||||
color: isDarkMode ? 'white' : 'default',
|
|
||||||
'&.Mui-checked': {
|
|
||||||
color: '#ff33cc',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" gutterBottom color={isDarkMode ? 'white' : 'textPrimary'}>
|
|
||||||
{t('action_description.actions.text')}
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{actionsInWorkflow.list && (
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={true}
|
|
||||||
disabled
|
|
||||||
sx={{
|
|
||||||
color: isDarkMode ? 'white' : 'default',
|
|
||||||
'&.Mui-checked': {
|
|
||||||
color: '#ff33cc',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" gutterBottom color={isDarkMode ? 'white' : 'textPrimary'}>
|
|
||||||
{t('action_description.actions.list')}
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{actionsInWorkflow.screenshot && (
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Checkbox
|
|
||||||
checked={true}
|
|
||||||
disabled
|
|
||||||
sx={{
|
|
||||||
color: isDarkMode ? 'white' : 'default',
|
|
||||||
'&.Mui-checked': {
|
|
||||||
color: '#ff33cc',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" gutterBottom color={isDarkMode ? 'white' : 'textPrimary'}>
|
|
||||||
{t('action_description.actions.screenshot')}
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ interface ActionContextProps {
|
|||||||
captureStage: CaptureStage;
|
captureStage: CaptureStage;
|
||||||
showPaginationOptions: boolean;
|
showPaginationOptions: boolean;
|
||||||
showLimitOptions: boolean;
|
showLimitOptions: boolean;
|
||||||
actionsInWorkflow: {
|
|
||||||
text: boolean;
|
|
||||||
list: boolean;
|
|
||||||
screenshot: boolean;
|
|
||||||
};
|
|
||||||
activeAction: 'none' | 'text' | 'list' | 'screenshot';
|
activeAction: 'none' | 'text' | 'list' | 'screenshot';
|
||||||
setActiveAction: (action: 'none' | 'text' | 'list' | 'screenshot') => void;
|
setActiveAction: (action: 'none' | 'text' | 'list' | 'screenshot') => void;
|
||||||
setWorkflow: (workflow: WorkflowFile) => void;
|
setWorkflow: (workflow: WorkflowFile) => void;
|
||||||
@@ -64,11 +59,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
const [captureStage, setCaptureStage] = useState<CaptureStage>('initial');
|
const [captureStage, setCaptureStage] = useState<CaptureStage>('initial');
|
||||||
const [showPaginationOptions, setShowPaginationOptions] = useState(false);
|
const [showPaginationOptions, setShowPaginationOptions] = useState(false);
|
||||||
const [showLimitOptions, setShowLimitOptions] = useState(false);
|
const [showLimitOptions, setShowLimitOptions] = useState(false);
|
||||||
const [actionsInWorkflow, setActionsInWorkflow] = useState({
|
|
||||||
text: false,
|
|
||||||
list: false,
|
|
||||||
screenshot: false
|
|
||||||
});
|
|
||||||
const [activeAction, setActiveAction] = useState<'none' | 'text' | 'list' | 'screenshot'>('none');
|
const [activeAction, setActiveAction] = useState<'none' | 'text' | 'list' | 'screenshot'>('none');
|
||||||
|
|
||||||
const { socket } = useSocketStore();
|
const { socket } = useSocketStore();
|
||||||
@@ -92,11 +82,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
const finishAction = (action: 'text' | 'list' | 'screenshot') => {
|
const finishAction = (action: 'text' | 'list' | 'screenshot') => {
|
||||||
if (activeAction !== action) return;
|
if (activeAction !== action) return;
|
||||||
|
|
||||||
setActionsInWorkflow(prev => ({
|
|
||||||
...prev,
|
|
||||||
[action]: true
|
|
||||||
}));
|
|
||||||
|
|
||||||
setActiveAction('none');
|
setActiveAction('none');
|
||||||
|
|
||||||
if (action === 'text') {
|
if (action === 'text') {
|
||||||
@@ -175,7 +160,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
captureStage,
|
captureStage,
|
||||||
showPaginationOptions,
|
showPaginationOptions,
|
||||||
showLimitOptions,
|
showLimitOptions,
|
||||||
actionsInWorkflow,
|
|
||||||
activeAction,
|
activeAction,
|
||||||
setActiveAction,
|
setActiveAction,
|
||||||
setWorkflow,
|
setWorkflow,
|
||||||
|
|||||||
Reference in New Issue
Block a user