Skip to content

Conversation

@amhsirak
Copy link
Member

@amhsirak amhsirak commented Oct 27, 2025

ref: #847

Summary by CodeRabbit

  • Style & Refactor

    • Reorganized input display into clear groups (Texts, Screenshots, Lists) with per-group subtitles, improved typography, and refined spacing for better readability.
    • Adjusted section headings and margins to strengthen visual hierarchy and layout consistency.
    • Added a guard to hide the inputs area when there are no inputs, simplifying the UI.
  • Bug Fixes

    • Removed a viewport height constraint so the page can scroll naturally when content exceeds the screen.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Walkthrough

Refactors the input handling in RobotEditPage component by replacing a single inputs array with three separate collections (textInputs, screenshotInputs, listInputs), introduces categorization logic using switch statements, and updates rendering to display inputs grouped by type with conditional subtitles and margin adjustments. Additionally, removes a maxHeight constraint from RobotConfigPage to allow height expansion and rely on internal scrolling.

Changes

Cohort / File(s) Summary
RobotEditPage Input Refactoring
src/components/robot/pages/RobotEditPage.tsx
Refactors input state from a single array into three separate typed collections; adds switch-based categorization for actions into textInputs, screenshotInputs, and listInputs; replaces unified input rendering with conditional rendering blocks per input type; updates heading typography and margin spacing on inputs and actions sections; adds a hasAnyInputs guard for efficient rendering checks.
RobotConfigPage Layout Adjustment
src/components/robot/pages/RobotConfigPage.tsx
Removes maxHeight: '100vh' from the Box component wrapping the page, allowing the container to grow beyond viewport height and rely on internal overflow for scrolling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring attention:
    • Confirm that the new input categorization covers all expected action types correctly.
    • Validate UI render behavior for empty and mixed input groups, ensuring subtitles and margins function as intended.
    • Review the removal of maxHeight for any unintended layout or scrolling regressions in RobotConfigPage.
    • Assess typography and spacing consistency in RobotEditPage headings and sections.

Possibly related PRs

Suggested labels

Type: Feature, Scope: UI/UX

Suggested reviewers

  • RohitR311

Poem

🐰 Inputs sorted, three by three,
Text and screenshots, organized!
Lists now grouped for all to see,
The UI redesigned, neatly prized.
With margins fine-tuned, hop hooray! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: group action inputs by type" directly and accurately summarizes the primary change in this pull request. The main modification in RobotEditPage.tsx implements exactly this feature by introducing separate input collections (textInputs, screenshotInputs, listInputs), distributing fields based on action type, and rendering grouped input sections with type-specific subtitles (Texts, Screenshots, Lists). The title is concise, clear, and specific enough for a teammate scanning the commit history to understand the primary change. The minor modification to RobotConfigPage.tsx (removing maxHeight constraint) is secondary and not expected to be covered by the title.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edit-page

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/components/robot/pages/RobotEditPage.tsx (1)

591-616: Use i18n for subtitle strings.

The subtitle strings "Texts", "Screenshots", and "Lists" are hard-coded, which breaks consistency with the rest of the component that uses t() for internationalization.

Consider applying this pattern:

-            <Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
-              Texts
-            </Typography>
+            <Typography variant="subtitle1" style={{ marginBottom: '8px' }}>
+              {t('Texts')}
+            </Typography>

Apply similar changes for "Screenshots" (line 603) and "Lists" (line 612).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acba072 and 6692de2.

📒 Files selected for processing (1)
  • src/components/robot/pages/RobotEditPage.tsx (3 hunks)
🔇 Additional comments (4)
src/components/robot/pages/RobotEditPage.tsx (4)

509-511: LGTM! Improved spacing consistency.

The added top margin enhances the visual separation of the List Limits section.


542-579: Well-structured refactor for grouping inputs by action type.

The categorization logic correctly maps each action type to its corresponding collection. The switch statement appropriately handles all three editable action types without requiring a default case.


582-583: LGTM! Correctly adapted empty check for new structure.

The hasAnyInputs check appropriately replaces the previous inputs.length check to work with the three separate collections.


587-589: LGTM! Better semantic heading hierarchy.

Changing from body1 to h6 improves the semantic structure, making the "Actions" heading more accessible and better styled as a section header.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/robot/pages/RobotEditPage.tsx (1)

558-566: Consider adding labels to TextFields for accessibility.

The TextFields lack explicit label props, relying on group subtitles for context. Adding labels would improve accessibility for screen reader users and provide clearer input identification.

Example approach - add a label based on action type:

         const textField = (
           <TextField
             key={`action-name-${pairIndex}-${actionIndex}`}
+            label={`${t(`actions.${action.action}`)} ${textInputs.length + screenshotInputs.length + listInputs.length + 1}`}
             type="text"
             value={currentName}
             onChange={(e) => handleActionNameChange(pairIndex, actionIndex, e.target.value)}
             style={{ marginBottom: '12px' }}
             fullWidth
           />
         );

Note: This would require tracking indices per group or generating labels differently.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6692de2 and f5e9cec.

📒 Files selected for processing (2)
  • src/components/robot/pages/RobotConfigPage.tsx (0 hunks)
  • src/components/robot/pages/RobotEditPage.tsx (3 hunks)
💤 Files with no reviewable changes (1)
  • src/components/robot/pages/RobotConfigPage.tsx
🔇 Additional comments (2)
src/components/robot/pages/RobotEditPage.tsx (2)

509-511: LGTM! Improved visual hierarchy.

The typography upgrade to h6 and added top margin improve the section hierarchy and spacing.


542-580: Well-structured categorization logic.

The refactoring successfully separates action inputs by type using clear switch-case logic. The filtering at line 550 ensures only relevant actions are processed, making the absence of a default case acceptable.

Comment on lines +591 to +616
{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}
</>
)}
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants