Skip to content

Open rules in modal instead of switching page#516

Merged
elie222 merged 4 commits intomainfrom
feat/rule-modal
Jun 22, 2025
Merged

Open rules in modal instead of switching page#516
elie222 merged 4 commits intomainfrom
feat/rule-modal

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jun 22, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a dialog-based interface for creating and editing rules, allowing users to manage rules without leaving the current page.
    • Added a new modal dialog for rule management with improved usability and streamlined workflow.
    • Added a custom hook to manage dialog open/close state with associated data.
  • Improvements

    • Updated rule-related navigation to use the assistant section instead of the automation section across the app.
    • Enhanced rule forms with more flexible submission handling and improved layout spacing.
    • Refined onboarding flow to conditionally redirect based on feature flag status.
  • Other

    • Updated app version to v1.7.1.

@vercel
Copy link

vercel bot commented Jun 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview Jun 22, 2025 6:35pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 22, 2025

Warning

Rate limit exceeded

@elie222 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fccb4e9 and af8f74d.

📒 Files selected for processing (1)
  • apps/web/utils/schedule.test.ts (16 hunks)

"""

Walkthrough

This update replaces all rule-related links from /automation to /assistant paths across the application. It introduces a dialog-based interface for creating and editing rules, centralizing these interactions within modal dialogs instead of separate pages. New components and hooks are added to manage dialog state and streamline rule management workflows.

Changes

File(s) Change Summary
.../assistant/ProcessResultDisplay.tsx
.../assistant/group/Groups.tsx
.../assistant/rule/[ruleId]/examples/page.tsx
components/GroupedTable.tsx
utils/ai/assistant/process-user-request.ts
Updated all rule-related URLs from /automation to /assistant while preserving query parameters.
.../assistant/RuleDialog.tsx Added new RuleDialog component for modal-based rule creation and editing.
.../assistant/RuleForm.tsx Extended RuleForm with onSuccess and isDialog props; changed form submission flow to support dialog usage.
.../assistant/Rules.tsx Refactored to use dialog-based rule creation/editing; integrated RuleDialog and new dialog state logic.
hooks/useDialogState.ts Introduced generic useDialogState hook for managing dialog open/close state and associated data.
.../onboarding/draft-replies/page.tsx Added feature flag check to conditionally redirect after enabling draft replies.
version.txt Updated version from v1.7.0 to v1.7.1.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RulesPage
    participant RuleDialog
    participant RuleForm
    participant Backend

    User->>RulesPage: Click "Add Rule" or "Edit Rule"
    RulesPage->>RuleDialog: Open dialog (with optional ruleId)
    RuleDialog->>RuleForm: Render form (create or edit mode)
    User->>RuleForm: Fill and submit form
    RuleForm->>Backend: Create or update rule
    Backend-->>RuleForm: Respond with success
    RuleForm->>RuleDialog: Call onSuccess (if dialog mode)
    RuleDialog->>RulesPage: Close dialog and refresh list
Loading

Possibly related PRs

Poem

A bunny hopped with gentle pride,
Swapping links from side to side.
From "automation" now we go,
To "assistant"—let the dialogs flow!
With modals bright and forms anew,
Rule-making’s now a breeze to do.
🐇✨
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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)
apps/web/hooks/useDialogState.ts (1)

1-32: Generic dialog state hook is well-implemented
The hook provides clear, type-safe open/close/toggle handlers with stable callbacks and correctly preserves or resets associated data. Consider adding JSDoc for public methods and unit tests to validate state transitions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 363446a and 39854d9.

📒 Files selected for processing (10)
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessResultDisplay.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/RuleDialog.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/RuleForm.tsx (5 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/Rules.tsx (9 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/group/Groups.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/rule/[ruleId]/examples/page.tsx (1 hunks)
  • apps/web/components/GroupedTable.tsx (1 hunks)
  • apps/web/hooks/useDialogState.ts (1 hunks)
  • apps/web/utils/ai/assistant/process-user-request.ts (1 hunks)
  • version.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (18)
version.txt (1)

1-1: Verify version bump and release documentation.
The version was updated to v1.6.9 to coincide with the new modal-based rule UI flow. Please confirm that:

  1. CHANGELOG.md or release notes include an entry for this bump.
  2. Any other version metadata (e.g., in package.json or CI configs) has been updated to v1.6.9.
apps/web/utils/ai/assistant/process-user-request.ts (1)

108-108: Corrected system prompt URL to /assistant route
This aligns the assistant responses with the updated routing scheme, ensuring links now point to the assistant’s rules tab instead of the automation page.

apps/web/app/(app)/[emailAccountId]/assistant/group/Groups.tsx (1)

99-102: Updated group rule link to use assistant route
The navigation URL now correctly points to /assistant with the tab=rule and ruleId query parameters, maintaining context when opening a rule.

apps/web/app/(app)/[emailAccountId]/assistant/rule/[ruleId]/examples/page.tsx (1)

45-48: Redirect "View Rule" button to assistant route
The button now links to the assistant’s rule details tab, aligning with the modal-driven editing interface in the assistant section.

apps/web/app/(app)/[emailAccountId]/assistant/ProcessResultDisplay.tsx (1)

90-93: Link in process result updated to assistant route
The external link now opens the matched rule in the assistant tab instead of the automation page, ensuring consistent navigation across the assistant UI.

apps/web/components/GroupedTable.tsx (1)

437-437: URL path update looks good.

The change from /automation to /assistant aligns with the overall transition to assistant-focused routing.

apps/web/app/(app)/[emailAccountId]/assistant/RuleForm.tsx (4)

113-119: Well-implemented dialog support.

The new props onSuccess and isDialog provide clean support for modal dialog usage while maintaining backward compatibility.


330-330: Form styling adjustment is appropriate.

Removing explicit width constraints makes sense for dialog usage where the dialog container controls the width.


346-346: Reduced margin improves dialog layout.

The change from mt-8 to mt-4 provides better spacing within the dialog container.


217-251: Let’s broaden the search to include both .ts and .tsx files via globs:

#!/bin/bash
# Find any remaining “/automation” references in TypeScript files
rg -n "/automation" -g "*.ts" -g "*.tsx"
apps/web/app/(app)/[emailAccountId]/assistant/RuleDialog.tsx (3)

15-22: Well-designed interface.

The props interface is clean and provides good flexibility for both create and edit scenarios.


32-37: Good separation of concerns.

The handleSuccess function properly coordinates between the success callback and dialog closure.


41-78: Solid dialog implementation.

The component handles both create and edit modes well:

  • Proper loading states for existing rules
  • Sensible defaults for new rules
  • Good accessibility with dialog constraints
  • Appropriate scroll behavior for large forms
apps/web/app/(app)/[emailAccountId]/assistant/Rules.tsx (5)

57-65: Clean dialog state management.

The integration of useDialogState and RuleDialog provides a clean separation between state management and UI rendering.


215-246: Improved user experience with dialog approach.

Converting the rule name from a link to a button that opens a dialog (or new tab for cold email blocker) provides better UX by keeping users in context while viewing rule details.


297-311: Consistent edit flow.

The Edit dropdown now uses the same dialog pattern, providing a consistent user experience across different entry points.


438-447: Well-integrated dialog component.

The RuleDialog is properly connected to the dialog state and includes appropriate success handling that refreshes the data and closes the dialog.


481-515: Consistent dialog usage across components.

Both NoRules and AddRuleButtons components properly use the dialog callback pattern, maintaining consistency throughout the rule management flow.

@elie222 elie222 merged commit 54dbb32 into main Jun 22, 2025
10 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jul 16, 2025
@coderabbitai coderabbitai bot mentioned this pull request Aug 28, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 1, 2025
@elie222 elie222 deleted the feat/rule-modal branch December 18, 2025 23:04
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.

1 participant

Comments