Skip to content

Comments

Adjustments for assistant history tab and fix with chat#453

Merged
elie222 merged 1 commit intomainfrom
assistant-history-tab
May 26, 2025
Merged

Adjustments for assistant history tab and fix with chat#453
elie222 merged 1 commit intomainfrom
assistant-history-tab

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented May 26, 2025

Summary by CodeRabbit

  • New Features

    • Added the ability to create a new rule directly from the "Report Mistake" interface, streamlining workflow.
    • Enhanced email history display with a badge indicating manual application of rules.
  • Improvements

    • Email cells now allow toggling avatar and date display for greater flexibility.
    • Updated messaging to clearly indicate when a new rule is being created in chat-based automation fixes.
    • Simplified the history table for easier reading by removing redundant columns.
  • Style

    • Adjusted tab content spacing for improved visual consistency.
  • Chores

    • Updated app version to v1.2.1.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

This update introduces new constants for special rule identifiers, adds flexible rendering options to the EmailCell component, and streamlines the UI for rule history and reporting. It also refines tab styling, enables direct navigation for creating new rules, and increments the application version.

Changes

Files/Paths Change Summary
.../automation/consts.ts Added NONE_RULE_ID and NEW_RULE_ID string constants and exported them.
.../automation/AssistantTabs.tsx Updated TabsContent components to use pb-4 instead of mb-10 for bottom spacing (stylistic change).
.../automation/ExecutedRulesTable.tsx Enhanced EmailCell with optional hideAvatar, showDate, and createdAt props; added conditional logic.
.../automation/History.tsx Removed extra table columns; used new EmailCell props; added badge for manual application.
.../automation/FixWithChat.tsx Used NEW_RULE_ID for new rule selection; updated messaging logic for new rule intent.
.../automation/ReportMistake.tsx Used NEW_RULE_ID and NONE_RULE_ID; added "✨ New rule" option to rule selector; open rule creation page.
version.txt Incremented version from v1.2.0 to v1.2.1.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Browser

    User->>UI: Selects "✨ New rule" in rule selector
    UI->>Browser: window.open(rule creation URL)
    Browser-->>User: Opens rule creation page in new tab
Loading
sequenceDiagram
    participant ParentComponent
    participant EmailCell
    participant DateCell

    ParentComponent->>EmailCell: Render with hideAvatar/showDate/createdAt props
    EmailCell-->>ParentComponent: Renders email info
    alt showDate and createdAt provided
        EmailCell->>DateCell: Render with createdAt
        DateCell-->>EmailCell: Formatted date with tooltip
    end
Loading

Possibly related PRs

Poem

A hop and a skip, new constants in tow,
Rule IDs for "none" and for "new" now show!
Tabs get a padding, the UI’s more neat,
Email cells flex with avatars discreet.
With a click, new rules spring—
Version hops up, let’s sing!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

apps/web/app/(app)/[emailAccountId]/automation/ExecutedRulesTable.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

apps/web/app/(app)/[emailAccountId]/automation/History.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

  • 3 others
✨ 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/app/(app)/[emailAccountId]/automation/ExecutedRulesTable.tsx (1)

175-183: Consider adding null check for createdAt in DateCell.

The DateCell component assumes createdAt is always defined, but it might be safer to add a null check since the parent component has conditional rendering.

Consider this minor improvement:

export function DateCell({ createdAt }: { createdAt: Date }) {
+  if (!createdAt) return null;
+
  return (
    <div className="whitespace-nowrap">
      <Tooltip content={new Date(createdAt).toLocaleString()}>
        <EmailDate date={new Date(createdAt)} />
      </Tooltip>
    </div>
  );
}

Alternatively, update the type to make it clearer:

-export function DateCell({ createdAt }: { createdAt: Date }) {
+export function DateCell({ createdAt }: { createdAt: Date | null }) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 77bd3ba and 6de7495.

📒 Files selected for processing (7)
  • apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/ExecutedRulesTable.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/FixWithChat.tsx (4 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/History.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/ReportMistake.tsx (4 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/consts.ts (1 hunks)
  • version.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Jit Security
🔇 Additional comments (13)
version.txt (1)

1-1: LGTM! Version increment aligns with the changes.

The version bump from v1.2.0 to v1.2.1 appropriately reflects the UI adjustments and fixes introduced in this PR.

apps/web/app/(app)/[emailAccountId]/automation/consts.ts (1)

1-2:

Details

✅ Verification successful

Good practice centralizing special rule identifiers.

The constants follow clear naming conventions and will help eliminate magic strings across the codebase. The double underscore pattern makes these special identifiers easily distinguishable from regular rule IDs.

Let me verify that these constants are being used consistently across the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Verify usage of the new constants across the codebase
# Expected: Should find imports and usage of NONE_RULE_ID and NEW_RULE_ID

echo "=== Searching for NONE_RULE_ID usage ==="
rg "NONE_RULE_ID" --type ts --type tsx -A 2 -B 2

echo "=== Searching for NEW_RULE_ID usage ==="
rg "NEW_RULE_ID" --type ts --type tsx -A 2 -B 2

echo "=== Checking for any remaining hardcoded __NONE__ or __NEW__ strings ==="
rg "__NONE__|__NEW__" --type ts --type tsx -A 1 -B 1

Length of output: 570


Let’s retry the search without relying on built-in file types:


🏁 Script executed:

#!/bin/bash
# Verify usage of the new constants across .ts and .tsx files

echo "=== Searching for NONE_RULE_ID usage ==="
rg "NONE_RULE_ID" -g '*.ts' -g '*.tsx' -A2 -B2 || echo "No occurrences found for NONE_RULE_ID"

echo "=== Searching for NEW_RULE_ID usage ==="
rg "NEW_RULE_ID" -g '*.ts' -g '*.tsx' -A2 -B2 || echo "No occurrences found for NEW_RULE_ID"

echo "=== Checking for any hardcoded __NONE__ or __NEW__ strings ==="
rg "__NONE__|__NEW__" -g '*.ts' -g '*.tsx' -A1 -B1 || echo "No hardcoded __NONE__ or __NEW__ found"

Length of output: 6279


Constants Usage Verified and Approved

Both NONE_RULE_ID and NEW_RULE_ID are imported and used consistently in ReportMistake.tsx and FixWithChat.tsx, and no hardcoded __NONE__ or __NEW__ strings remain.

• Confirmed imports and list-item usages in ReportMistake.tsx
• Confirmed conditional logic and messaging in ReportMistake.tsx
• Confirmed imports and new-rule handling in FixWithChat.tsx

No further changes needed—these constants are fully integrated.

apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsx (1)

76-96: Consistent styling improvements across all tab content containers.

The change from mb-10 to pb-4 creates more consistent spacing and reduces the bottom margin across all tab content areas. The update is applied uniformly across all tabs (rules, test, history, pending, knowledge, rule).

apps/web/app/(app)/[emailAccountId]/automation/ExecutedRulesTable.tsx (2)

30-42: Well-implemented optional props for enhanced component flexibility.

The addition of hideAvatar, showDate, and createdAt props enhances the EmailCell component's reusability while maintaining backward compatibility through optional parameters.


49-58: Clean conditional rendering implementation.

The conditional avatar rendering and date display logic is well-structured. The layout adjustment using flexbox with justify-between properly handles the optional date element.

apps/web/app/(app)/[emailAccountId]/automation/ReportMistake.tsx (4)

66-67: LGTM!

The imports are properly structured and follow the existing import organization pattern.


170-178: Good UX enhancement for rule creation flow.

The implementation correctly handles the "New rule" option by opening the rule creation page in a new tab. The early return prevents unnecessary execution of the rest of the callback logic.


226-234: Correct dependency array update.

The emailAccountId is properly added to the dependency array since it's now used within the callback for the prefixPath function call.


444-449: Nice addition of special rule options.

The implementation provides clear visual distinction with emojis and logical ordering of options (None → New rule → existing rules).

apps/web/app/(app)/[emailAccountId]/automation/History.tsx (1)

97-105: Good UI improvements for the history table.

The changes enhance the history display by:

  • Hiding avatars to reduce visual clutter in the table view
  • Showing dates for better temporal context
  • Clearly indicating manually applied rules with a yellow badge

These improvements align well with the broader UI streamlining objectives.

apps/web/app/(app)/[emailAccountId]/automation/FixWithChat.tsx (3)

19-19: LGTM!

Import follows the existing pattern.


55-76: Clean implementation of the NEW_RULE_ID handling.

The code properly distinguishes between the NEW_RULE_ID case and regular rules, passing the appropriate value to getFixMessage. The logic is clear and maintains consistency with the ReportMistake component.


100-100: Good message customization for rule creation flow.

The changes improve the chat message generation by:

  • Adding trim() to clean up whitespace from truncated content
  • Providing a clear, contextual message when the user wants to create a new rule
  • Maintaining the existing logic for other cases

The message content clearly communicates the user's intent to the chat assistant.

Also applies to: 117-123

@elie222 elie222 merged commit b6afecb into main May 26, 2025
2 of 4 checks passed
@vercel
Copy link

vercel bot commented May 26, 2025

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

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview May 26, 2025 9:36am

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

❌ The following Jit checks failed to run:

  • secret-detection
  • static-code-analysis-js

#jit_bypass_commit in this PR to bypass, Jit Admin privileges required.

More info in the Jit platform.

@coderabbitai coderabbitai bot mentioned this pull request Aug 21, 2025
@elie222 elie222 deleted the assistant-history-tab branch December 18, 2025 22:59
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