feat: rm workflow in progress logic

This commit is contained in:
Rohit
2025-04-30 20:22:37 +05:30
parent f1d0cbdaae
commit 392a5fd60c
3 changed files with 4 additions and 123 deletions

View File

@@ -178,14 +178,6 @@
"limit": "Choose the number of items to extract",
"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": {
"text": "Capture Text",
"list": "Capture List",

View File

@@ -49,24 +49,14 @@ const Content = styled.div`
text-align: left;
`;
const ActionDescriptionBox = ({ isDarkMode }: { isDarkMode: boolean }) => {
const { t } = useTranslation();
const {
getText,
getScreenshot,
getList,
captureStage,
actionsInWorkflow
} = useActionContext() as {
const { getText, getScreenshot, getList, captureStage } = useActionContext() as {
getText: boolean;
getScreenshot: boolean;
getList: boolean;
captureStage: 'initial' | 'pagination' | 'limit' | 'complete';
actionsInWorkflow: {
text: boolean;
list: boolean;
screenshot: boolean;
};
};
const messages = [
@@ -128,95 +118,10 @@ const ActionDescriptionBox = ({ isDarkMode }: { isDarkMode: boolean }) => {
</>
);
} else {
const actionsInWorkflowCount = Object.values(actionsInWorkflow).filter(Boolean).length;
return (
<>
<Typography variant="subtitle2" gutterBottom>
{actionsInWorkflowCount === 0
? 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>
</>
)}
<Typography variant="subtitle2" gutterBottom>{t('action_description.default.title')}</Typography>
<Typography variant="body2" gutterBottom>{t('action_description.default.description')}</Typography>
</>
);
}

View File

@@ -21,11 +21,6 @@ interface ActionContextProps {
captureStage: CaptureStage;
showPaginationOptions: boolean;
showLimitOptions: boolean;
actionsInWorkflow: {
text: boolean;
list: boolean;
screenshot: boolean;
};
activeAction: 'none' | 'text' | 'list' | 'screenshot';
setActiveAction: (action: 'none' | 'text' | 'list' | 'screenshot') => void;
setWorkflow: (workflow: WorkflowFile) => void;
@@ -64,11 +59,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
const [captureStage, setCaptureStage] = useState<CaptureStage>('initial');
const [showPaginationOptions, setShowPaginationOptions] = 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 { socket } = useSocketStore();
@@ -92,11 +82,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
const finishAction = (action: 'text' | 'list' | 'screenshot') => {
if (activeAction !== action) return;
setActionsInWorkflow(prev => ({
...prev,
[action]: true
}));
setActiveAction('none');
if (action === 'text') {
@@ -175,7 +160,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => {
captureStage,
showPaginationOptions,
showLimitOptions,
actionsInWorkflow,
activeAction,
setActiveAction,
setWorkflow,