Adjustments for assistant history tab and fix with chat#453
Conversation
WalkthroughThis update introduces new constants for special rule identifiers, adds flexible rendering options to the Changes
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
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
Possibly related PRs
Poem
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
apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsxOops! 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. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by apps/web/app/(app)/[emailAccountId]/automation/ExecutedRulesTable.tsxOops! 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. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by apps/web/app/(app)/[emailAccountId]/automation/History.tsxOops! 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. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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
📒 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 1Length 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_IDandNEW_RULE_IDare imported and used consistently inReportMistake.tsxandFixWithChat.tsx, and no hardcoded__NONE__or__NEW__strings remain.• Confirmed imports and list-item usages in
ReportMistake.tsx
• Confirmed conditional logic and messaging inReportMistake.tsx
• Confirmed imports and new-rule handling inFixWithChat.tsxNo 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-10topb-4creates 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, andcreatedAtprops 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-betweenproperly 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
emailAccountIdis properly added to the dependency array since it's now used within the callback for theprefixPathfunction 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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
❌ 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.
Summary by CodeRabbit
New Features
Improvements
Style
Chores