Skip to content

feat: use dialog instead of custom generic modal#1020

Merged
amhsirak merged 17 commits into
developfrom
sync-del-conf
Apr 10, 2026
Merged

feat: use dialog instead of custom generic modal#1020
amhsirak merged 17 commits into
developfrom
sync-del-conf

Conversation

@amhsirak
Copy link
Copy Markdown
Member

@amhsirak amhsirak commented Apr 2, 2026

Summary by CodeRabbit

  • New Features

    • Enhanced AI Mode: extraction prompt and optional website URL inputs; LLM provider & model selection with provider-specific credential fields
    • Improved Create & Run flow for AI Mode with optimistic creation and navigation on success
  • Style

    • Replaced custom confirmation/save modals with Material Design dialogs across saving, warning, and delete flows (button order/styling updated)

@amhsirak amhsirak marked this pull request as draft April 2, 2026 16:15
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 007dfd92-c8e1-4185-ad2f-ff986677de47

📥 Commits

Reviewing files that changed from the base of the PR and between b3a2f9d and f5a479b.

📒 Files selected for processing (2)
  • src/components/robot/pages/RobotCreate.tsx
  • src/components/run/ColapsibleRow.tsx

Walkthrough

This PR replaces several custom GenericModal confirmations with Material UI Dialog components and adds AI/LLM configuration inputs plus an optimistic create-and-run flow for RobotCreate.tsx. No exported/public signatures changed.

Changes

Cohort / File(s) Summary
Browser save modal
src/components/browser/BrowserRecordingSave.tsx
Replaced GenericModal with MUI Dialog (DialogTitle, DialogActions); adjusted button order/styling and imports; minor whitespace/indent changes.
Recorder save modal
src/components/recorder/SaveRecording.tsx
Replaced GenericModal with Dialog (DialogTitle, DialogContent); moved modal styling into PaperProps; updated imports and removed Typography.
Recordings table modals & handler
src/components/robot/RecordingsTable.tsx
Migrated two confirmation modals to Dialog components (DialogTitle, DialogContentText, DialogActions); changed button styling/order; reformatted a boolean postMessage condition without behavioral change.
Robot creation (AI mode) + modal
src/components/robot/pages/RobotCreate.tsx
Replaced warning modal with Dialog; added AI fields (aiPrompt, url, llmProvider, llmModel, provider-specific llmApiKey/llmBaseUrl); implemented optimistic robot creation and call flow for createLLMRobot + createAndRunRecording; preserved other modes' logic.
Run row delete modal
src/components/run/ColapsibleRow.tsx
Replaced delete confirmation GenericModal with Dialog; moved sizing/styling to PaperProps.sx; adjusted button variants/colors and minor whitespace.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RobotCreate as RobotCreate.tsx
    participant OptState as OptimisticState
    participant LLMAPI as createLLMRobot API
    participant RecordingAPI as createAndRunRecording API
    participant Cache as Cache Invalidation
    participant Nav as Navigation

    User->>RobotCreate: Click "Create & Run"
    RobotCreate->>RobotCreate: Validate name & prompt, check duplicates
    RobotCreate->>OptState: addOptimisticRobot(tempRobot)
    RobotCreate->>LLMAPI: createLLMRobot(provider, model, creds)
    LLMAPI-->>RobotCreate: returns created robot
    RobotCreate->>OptState: removeOptimisticRobot()
    RobotCreate->>Cache: invalidate recordings
    RobotCreate->>OptState: addOptimisticRun(tempRun)
    RobotCreate->>RecordingAPI: createAndRunRecording(robotId)
    RecordingAPI-->>RobotCreate: returns run
    RobotCreate->>Cache: invalidate runs/recordings
    RobotCreate->>Nav: navigate to run page
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Type: Enhancement, Scope: UI/UX

Suggested reviewers

  • amhsirak

Poem

🐰 I hopped from Box to Dialog bright,
Buttons reordered, colors right.
Robots learn from prompts I share,
Optimistic runs take air.
Hooray — the UI hops with delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: replacing custom GenericModal components with Material UI Dialog components across multiple files in the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync-del-conf

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.

@amhsirak amhsirak marked this pull request as ready for review April 2, 2026 18:00
Copy link
Copy Markdown

@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: 3

🧹 Nitpick comments (4)
src/components/recorder/SaveRecording.tsx (1)

214-224: Dead code: modalStyle is no longer used.

After migrating to Dialog, the modalStyle constant is unused. Consider removing it.

🧹 Remove unused code
-const modalStyle = {
-  top: '25%',
-  left: '50%',
-  transform: 'translate(-50%, -50%)',
-  width: '30%',
-  backgroundColor: 'background.paper',
-  p: 4,
-  height: 'fit-content',
-  display: 'block',
-  padding: '20px',
-};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/recorder/SaveRecording.tsx` around lines 214 - 224, Remove the
dead constant modalStyle from the SaveRecording.tsx file: delete the modalStyle
declaration block and ensure there are no remaining references to modalStyle in
the SaveRecording component (or other functions in the file); if any reference
remains, replace it with the Dialog props or styles used by the new Dialog
implementation.
src/components/browser/BrowserRecordingSave.tsx (1)

220-246: Inconsistency: Reset modal still uses GenericModal while discard uses Dialog.

Within the same component, the discard confirmation was migrated to Dialog but the reset confirmation remains on GenericModal. Consider migrating this modal as well for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/browser/BrowserRecordingSave.tsx` around lines 220 - 246, The
reset confirmation still uses GenericModal (openResetModal, setOpenResetModal,
performReset, modalStyle) while the discard flow was migrated to Dialog; replace
GenericModal with the same Dialog-based pattern used for discard: render a
Dialog controlled by openResetModal, move the Box contents into
DialogTitle/DialogContent/DialogActions, wire onClose to
setOpenResetModal(false), call performReset from the confirm Button and keep the
same translations and styles (migrating inline sx into DialogAction Button props
or sx) so behavior and handlers remain identical to the original.
src/components/robot/pages/RobotCreate.tsx (2)

33-33: Dead import: GenericModal is no longer used.

After migrating to Dialog, this import is unused.

🧹 Remove unused import
-import { GenericModal } from '../../ui/GenericModal';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/robot/pages/RobotCreate.tsx` at line 33, Remove the dead
import of GenericModal from the top of RobotCreate (the import line referencing
GenericModal) since the component now uses Dialog; delete the unused import
statement and verify there are no remaining references to GenericModal in
RobotCreate.tsx, then run the linter/TS compile to confirm no unused-import
errors remain.

1253-1263: Dead code: modalStyle is no longer used.

After migrating to Dialog, this constant is unused.

🧹 Remove unused code
-const modalStyle = {
-  top: '50%',
-  left: '50%',
-  transform: 'translate(-50%, -50%)',
-  width: '30%',
-  backgroundColor: 'background.paper',
-  p: 4,
-  height: 'fit-content',
-  display: 'block',
-  padding: '20px',
-};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/robot/pages/RobotCreate.tsx` around lines 1253 - 1263, Remove
the dead constant modalStyle which is no longer used after migrating to Dialog;
locate the top-level const modalStyle declaration in RobotCreate (the object
with top/left/transform/width/backgroundColor/p/height/display/padding) and
delete it and any related unused imports or references so the file no longer
contains this unused constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/robot/pages/RobotCreate.tsx`:
- Around line 604-608: The optimistic run can be left orphaned when the LLM run
fails to start: ensure we call invalidateRuns() whenever robot creation or
run-start fails. Specifically, add invalidateRuns() to the early failure path
around createLLMRobot / the block that checks result and result.robot (the
existing notify('error', ...) return path) and, importantly, add
invalidateRuns() where createAndRunRecording() returns without a runId (the
failure handling after the optimistic run is added) so the UI refreshes and
removes the optimistic run.
- Around line 646-651: The catch block currently calls removeOptimisticRobot,
invalidateRecordings, and notify but forgets to clean up the optimistic run
added earlier (around line 628) which leaves a stale "running" entry; update the
catch to also remove or invalidate that optimistic run by calling the same
cleanup used when adding it (e.g., call removeOptimisticRun(tempRunId) or
queryClient.invalidateQueries(['runs', robotId]) ), ensuring tempRunId (or the
run identifier created when adding the optimistic run) is in scope so the run
cache is removed/invalidated alongside removeOptimisticRobot and
invalidateRecordings.

In `@src/components/robot/RecordingsTable.tsx`:
- Around line 595-604: Wrap the header row in a proper TableHead: replace the
standalone TableRow that renders the column headers (the block rendering
TableRow with columns.map and MemoizedTableCell) by enclosing that TableRow
inside a <TableHead> element and ensure TableHead is imported at the top of the
file; keep the existing TableRow, columns mapping, and MemoizedTableCell
unchanged except for the new TableHead wrapper so accessibility and MUI
structure warnings are resolved.

---

Nitpick comments:
In `@src/components/browser/BrowserRecordingSave.tsx`:
- Around line 220-246: The reset confirmation still uses GenericModal
(openResetModal, setOpenResetModal, performReset, modalStyle) while the discard
flow was migrated to Dialog; replace GenericModal with the same Dialog-based
pattern used for discard: render a Dialog controlled by openResetModal, move the
Box contents into DialogTitle/DialogContent/DialogActions, wire onClose to
setOpenResetModal(false), call performReset from the confirm Button and keep the
same translations and styles (migrating inline sx into DialogAction Button props
or sx) so behavior and handlers remain identical to the original.

In `@src/components/recorder/SaveRecording.tsx`:
- Around line 214-224: Remove the dead constant modalStyle from the
SaveRecording.tsx file: delete the modalStyle declaration block and ensure there
are no remaining references to modalStyle in the SaveRecording component (or
other functions in the file); if any reference remains, replace it with the
Dialog props or styles used by the new Dialog implementation.

In `@src/components/robot/pages/RobotCreate.tsx`:
- Line 33: Remove the dead import of GenericModal from the top of RobotCreate
(the import line referencing GenericModal) since the component now uses Dialog;
delete the unused import statement and verify there are no remaining references
to GenericModal in RobotCreate.tsx, then run the linter/TS compile to confirm no
unused-import errors remain.
- Around line 1253-1263: Remove the dead constant modalStyle which is no longer
used after migrating to Dialog; locate the top-level const modalStyle
declaration in RobotCreate (the object with
top/left/transform/width/backgroundColor/p/height/display/padding) and delete it
and any related unused imports or references so the file no longer contains this
unused constant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca9e65b8-4db0-4c47-bf59-3c01bff40213

📥 Commits

Reviewing files that changed from the base of the PR and between bd818a5 and b3a2f9d.

📒 Files selected for processing (5)
  • src/components/browser/BrowserRecordingSave.tsx
  • src/components/recorder/SaveRecording.tsx
  • src/components/robot/RecordingsTable.tsx
  • src/components/robot/pages/RobotCreate.tsx
  • src/components/run/ColapsibleRow.tsx

Comment thread src/components/robot/pages/RobotCreate.tsx
Comment on lines +646 to +651
} catch (error: any) {
console.error('Error in AI robot creation:', error);
removeOptimisticRobot(tempRobotId);
invalidateRecordings();
notify('error', error?.message || 'Failed to create and run AI robot');
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Orphaned optimistic run on error — run cache not cleaned up.

When robot creation or run execution fails, the error handler removes the optimistic robot and invalidates recordings, but it does not remove or invalidate the optimistic run that was added at line 628. This leaves a stale "running" entry in the runs cache.

🐛 Proposed fix
                       } catch (error: any) {
                         console.error('Error in AI robot creation:', error);
                         removeOptimisticRobot(tempRobotId);
                         invalidateRecordings();
+                        invalidateRuns();
                         notify('error', error?.message || 'Failed to create and run AI robot');
                       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/robot/pages/RobotCreate.tsx` around lines 646 - 651, The catch
block currently calls removeOptimisticRobot, invalidateRecordings, and notify
but forgets to clean up the optimistic run added earlier (around line 628) which
leaves a stale "running" entry; update the catch to also remove or invalidate
that optimistic run by calling the same cleanup used when adding it (e.g., call
removeOptimisticRun(tempRunId) or queryClient.invalidateQueries(['runs',
robotId]) ), ensuring tempRunId (or the run identifier created when adding the
optimistic run) is in scope so the run cache is removed/invalidated alongside
removeOptimisticRobot and invalidateRecordings.

Comment on lines +595 to +604
<TableRow>
{columns.map((column) => (
<MemoizedTableCell
key={column.id}
style={{ minWidth: column.minWidth }}
>
{column.label}
</MemoizedTableCell>
))}
</TableRow>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Table header row should be wrapped in <TableHead>.

The header TableRow is rendered directly inside <Table> without a <TableHead> wrapper. This impacts accessibility (screen readers expect proper table structure) and may cause console warnings from MUI.

🔧 Proposed fix
 <Table stickyHeader aria-label="sticky table">
+  <TableHead>
     <TableRow>
       {columns.map((column) => (
         <MemoizedTableCell
           key={column.id}
           style={{ minWidth: column.minWidth }}
         >
           {column.label}
         </MemoizedTableCell>
       ))}
     </TableRow>
+  </TableHead>
   <TableBody>

You'll need to add TableHead to the imports at the top of the file.

📝 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
<TableRow>
{columns.map((column) => (
<MemoizedTableCell
key={column.id}
style={{ minWidth: column.minWidth }}
>
{column.label}
</MemoizedTableCell>
))}
</TableRow>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<MemoizedTableCell
key={column.id}
style={{ minWidth: column.minWidth }}
>
{column.label}
</MemoizedTableCell>
))}
</TableRow>
</TableHead>
<TableBody>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/robot/RecordingsTable.tsx` around lines 595 - 604, Wrap the
header row in a proper TableHead: replace the standalone TableRow that renders
the column headers (the block rendering TableRow with columns.map and
MemoizedTableCell) by enclosing that TableRow inside a <TableHead> element and
ensure TableHead is imported at the top of the file; keep the existing TableRow,
columns mapping, and MemoizedTableCell unchanged except for the new TableHead
wrapper so accessibility and MUI structure warnings are resolved.

@amhsirak amhsirak merged commit 119c201 into develop Apr 10, 2026
1 check was pending
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