Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/robot/pages/RobotConfigPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const RobotConfigPage: React.FC<RobotConfigPageProps> = ({
<Box sx={{
maxWidth: 1000,
margin: '50px auto',
maxHeight: '100vh',
display: 'flex',
flexDirection: 'column',
width: '1000px',
Expand Down
55 changes: 47 additions & 8 deletions src/components/robot/pages/RobotEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {

return (
<>
<Typography variant="body1" style={{ marginBottom: "20px" }}>
<Typography variant="h6" style={{ marginBottom: "20px", marginTop: "20px" }}>
{t("List Limits")}
</Typography>

Expand Down Expand Up @@ -539,22 +539,22 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
if (!robot || !robot.recording || !robot.recording.workflow) return null;

const editableActions = new Set(['screenshot', 'scrapeList', 'scrapeSchema']);
const inputs: JSX.Element[] = [];
const textInputs: JSX.Element[] = [];
const screenshotInputs: JSX.Element[] = [];
const listInputs: JSX.Element[] = [];

robot.recording.workflow.forEach((pair, pairIndex) => {
if (!pair.what) return;

pair.what.forEach((action, actionIndex) => {
// Only show editable name inputs for meaningful action types
if (!editableActions.has(String(action.action))) return;

// derive current name from possible fields
const currentName =
action.name ||
(action.args && action.args[0] && typeof action.args[0] === 'object' && action.args[0].__name) ||
'';

inputs.push(
const textField = (
<TextField
key={`action-name-${pairIndex}-${actionIndex}`}
type="text"
Expand All @@ -564,17 +564,56 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
fullWidth
/>
);

switch (action.action) {
case 'scrapeSchema':
textInputs.push(textField);
break;
case 'screenshot':
screenshotInputs.push(textField);
break;
case 'scrapeList':
listInputs.push(textField);
break;
}
});
});

if (inputs.length === 0) return null;
const hasAnyInputs = textInputs.length > 0 || screenshotInputs.length > 0 || listInputs.length > 0;
if (!hasAnyInputs) return null;

return (
<>
<Typography variant="body1" style={{ marginBottom: '10px' }}>
<Typography variant="h6" style={{ marginBottom: '20px', marginTop: '20px' }}>
{t('Actions')}
</Typography>
{inputs}

{textInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
Texts
</Typography>
{textInputs}
</>
)}

{screenshotInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: textInputs.length > 0 ? '16px' : '0' }}>
Screenshots
</Typography>
{screenshotInputs}
</>
)}

{listInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: (textInputs.length > 0 || screenshotInputs.length > 0) ? '16px' : '0' }}>
Lists
</Typography>
{listInputs}
</>
)}
Comment on lines +591 to +616
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use translations for subtitle strings.

The subtitle strings "Texts", "Screenshots", and "Lists" are hardcoded instead of using the t() function, breaking i18n consistency with the rest of the component.

Apply this diff to use translations:

-            <Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
-              Texts
+            <Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
+              {t('actions.texts')}
             </Typography>
-            <Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: textInputs.length > 0 ? '16px' : '0' }}>
-              Screenshots
+            <Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: textInputs.length > 0 ? '16px' : '0' }}>
+              {t('actions.screenshots')}
             </Typography>
-            <Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: (textInputs.length > 0 || screenshotInputs.length > 0) ? '16px' : '0' }}>
-              Lists
+            <Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: (textInputs.length > 0 || screenshotInputs.length > 0) ? '16px' : '0' }}>
+              {t('actions.lists')}
             </Typography>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{textInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
Texts
</Typography>
{textInputs}
</>
)}
{screenshotInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: textInputs.length > 0 ? '16px' : '0' }}>
Screenshots
</Typography>
{screenshotInputs}
</>
)}
{listInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: (textInputs.length > 0 || screenshotInputs.length > 0) ? '16px' : '0' }}>
Lists
</Typography>
{listInputs}
</>
)}
{textInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
{t('actions.texts')}
</Typography>
{textInputs}
</>
)}
{screenshotInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: textInputs.length > 0 ? '16px' : '0' }}>
{t('actions.screenshots')}
</Typography>
{screenshotInputs}
</>
)}
{listInputs.length > 0 && (
<>
<Typography variant="subtitle1" style={{ marginBottom: '8px', marginTop: (textInputs.length > 0 || screenshotInputs.length > 0) ? '16px' : '0' }}>
{t('actions.lists')}
</Typography>
{listInputs}
</>
)}
🤖 Prompt for AI Agents
In src/components/robot/pages/RobotEditPage.tsx around lines 591 to 616, the
subtitles "Texts", "Screenshots", and "Lists" are hardcoded; replace them with
translation calls (e.g. t('texts'), t('screenshots'), t('lists')) using the
component's i18n hook/namespace (or the existing translation keys if present) so
the Typography labels use t(...) instead of raw strings; ensure the file
imports/uses the same t from useTranslation already used elsewhere in the
component and keep existing conditional spacing logic unchanged.

</>
);
};
Expand Down