Fix: Ai Chatbox fixes + Added option in shortcuts ui#1518
Fix: Ai Chatbox fixes + Added option in shortcuts ui#1518Pheewww wants to merge 1 commit intoMail-0:stagingfrom
Conversation
WalkthroughThe changes introduce a conditional rendering of the AI chat input area based on billing status, add a new keyboard shortcut (mod+0) to open the AI assistant, and update the English locale to include a label for this shortcut. No exported or public code entities are modified. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Billing
participant AIChatComponent
User->>AIChatComponent: Open AI Chat UI
AIChatComponent->>Billing: Check chatMessages.enabled flag
Billing-->>AIChatComponent: Returns enabled/disabled
alt chatMessages.enabled == true
AIChatComponent->>User: Render input area
else chatMessages.enabled == false
AIChatComponent->>User: Hide input area
end
User->>AIChatComponent: Presses mod+0
AIChatComponent->>AIChatComponent: Triggers openAIAssistant action
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Possibly related PRs
Suggested reviewers
Poem
✨ 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/mail/components/create/ai-chat.tsx (1)
397-398: Consider cleaner conditional rendering syntax.The functionality is correct and properly disables the AI chat input for free users. However, the conditional rendering could be more readable.
Consider this cleaner approach:
- { chatMessages && !chatMessages.enabled ? - (null) : (<div className={cn('mb-4 flex-shrink-0 px-4', isFullScreen ? 'px-0' : '')}> + {chatMessages?.enabled && ( + <div className={cn('mb-4 flex-shrink-0 px-4', isFullScreen ? 'px-0' : '')}> ... - </div>)} + </div> + )}This uses optional chaining and logical AND for cleaner conditional rendering.
Also applies to: 507-507
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/mail/components/create/ai-chat.tsx(2 hunks)apps/mail/config/shortcuts.ts(1 hunks)apps/mail/locales/en.json(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/config/shortcuts.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
🧬 Code Graph Analysis (1)
apps/mail/components/create/ai-chat.tsx (1)
apps/mail/lib/utils.ts (1)
cn(51-51)
🔇 Additional comments (2)
apps/mail/locales/en.json (1)
489-489: LGTM! Clean localization addition.The new localization string follows the existing pattern and provides clear labeling for the AI Assistant shortcut.
apps/mail/config/shortcuts.ts (1)
111-117: Verify shortcut key conflict with existing AI sidebar toggle.The shortcut definition is well-formed, but there may be a conflict with the existing
Cmd+0handler in the AI chat component (lines 277-280 inapps/mail/components/create/ai-chat.tsx) that toggles the AI sidebar. Both shortcuts use the same key combination but serve different purposes.#!/bin/bash # Search for other uses of mod+0 or cmd+0 key combinations rg -i "(mod|cmd|meta).*['\"]0['\"]|['\"]0['\"].*(mod|cmd|meta)" -A 3 -B 3
MrgSub
left a comment
There was a problem hiding this comment.
Let's leave the input visible but make it readonly
|
This PR has merge conflicts and has been open for more than 3 days. It will be automatically closed. Please resolve the conflicts and reopen the PR if you'd like to continue working on it. |
Fixes #1517
Ai chat input should be disabled for free user
https://github.com/user-attachments/assets/60ceae1b-dbcf-4f7d-a58e-f255064b91fc
Open AI Assistant should be in shortcuts under navigation
Summary by CodeRabbit
New Features
Bug Fixes