Conversation
- added cc and bcc when saving drafts - save drafts less aggresively
chore: simplify and fix the dev env
* Create prompts with XML formatting * Include XML formatted prompts in generate func * remove unused regex and add helper functions/warnings * error handling * Update apps/mail/lib/prompts.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * lint issues * Update prompts.ts * #706 (comment) Coderabbit fix 1 * erabbitai bot 3 days ago⚠️ Potential issue errorOccurred state is stale inside finally React state setters (setErrorOccurred) are asynchronous; the errorOccurred value captured at render time will not yet reflect changes made earlier in the same event loop. Consequently, the logic deciding whether to collapse/expand may run with an outdated flag. - } finally { - setIsLoading(false); - if (!errorOccurred || isAskingQuestion) { - setIsExpanded(true); - } else { - setIsExpanded(false); // Collapse on errors - } - } + } finally { + setIsLoading(false); + // Use a local flag to track errors deterministically + const hadError = isAskingQuestion ? false : !!errorFlagRef.current; + setIsExpanded(!hadError); + } You can create const errorFlagRef = useRef(false); and update errorFlagRef.current = true every time an error is detected, ensuring reliable behaviour irrespective of React batching. Committable suggestion skipped: line range outside the PR's diff. * #706 (comment) * #706 (comment) * #706 (comment) --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…users (#726) * feat(i18n): add Vietnamese language support Add Vietnamese ('vi') to the list of supported languages in the i18n configuration and JSON file to expand language options. * Add a new Vietnamese translation file to support Vietnamese language users. * Clear Vietnamese translation strings
Co-authored-by: needle <122770437+needleXO@users.noreply.github.com>
* Updated lockfile * Updated home page session validation --------- Co-authored-by: Adam <x_1337@outlook.com>
* Create route og image * resolve coderabbit nitpicks --------- Co-authored-by: Adam <x_1337@outlook.com>
- updates lib/auth.ts to use the new method - updates actions/user.ts - updates app/(routes)/settings/danger-zone/page.tsx
…mponent - Added posthog-js version 1.236.6 to package.json and bun.lock. - Introduced search functionality by implementing handleFilterByLabel in NavMain component. - Updated NavItem to trigger label filtering on click.
- Updated NavItem to include an onClick prop for the Link component, allowing for custom click behavior. - Maintained existing functionality with prefetch and target attributes.
* delete mails permanently from bin * add English translations for delete mail actions * update the call handleDelete * fixed handle delete function * handleDelete call * enhance handledelete to reset bulk selection after deletion * removed the scope * delete mails permanently from bin * add English translations for delete mail actions * update the call handleDelete * handleDelete call * enhance handledelete to reset bulk selection after deletion * removed the scope --------- Co-authored-by: Ahmet Kilinc <akx9@icloud.com> Co-authored-by: Adam <x_1337@outlook.com>
* Add sendDraft method to Gmail driver and MailManager interface * fix sendDraft method * Add support for sending draft emails and clear draftId after sending --------- Co-authored-by: Adam <x_1337@outlook.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces multiple enhancements and refactorings across the mail application. Key changes include the addition of a thread deletion feature with context menu integration, support for sending drafts via the mail driver and UI, and improvements to the email input component enabling inline editing. The notes panel's async operations are now consistently wrapped in toast notifications. Two new Chinese language variants are added to localization, while the Vietnamese locale is removed. The Changes
Sequence Diagram(s)Thread Deletion FlowsequenceDiagram
participant User
participant ThreadContextMenu
participant deleteThread (action)
participant ActiveDriver
participant Toast
User->>ThreadContextMenu: Select "delete from bin"
ThreadContextMenu->>deleteThread: Call with threadId
deleteThread->>ActiveDriver: driver.delete(threadId)
ActiveDriver-->>deleteThread: Success/Error
deleteThread->>Toast: Show loading/success/error
deleteThread-->>ThreadContextMenu: Return success
Sending Email or DraftsequenceDiagram
participant User
participant CreateEmail
participant sendEmail (action)
participant MailDriver
User->>CreateEmail: Click Send
CreateEmail->>sendEmail: With emailData (+draftId if present)
alt draftId provided
sendEmail->>MailDriver: sendDraft(draftId, emailData)
else
sendEmail->>MailDriver: create(emailData)
end
MailDriver-->>sendEmail: Success/Error
sendEmail-->>CreateEmail: Result
Inline Editing of Email ChipssequenceDiagram
participant User
participant EmailInput
participant CreateEmail
User->>EmailInput: Click on email chip
EmailInput->>EmailInput: Show input for editing
User->>EmailInput: Edit and press Enter
EmailInput->>CreateEmail: onEditEmail(type, index, newEmail)
CreateEmail-->>EmailInput: Update state
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
💤 Files with no reviewable changes (1)
🧰 Additional context used🧬 Code Graph Analysis (7)apps/mail/actions/send.ts (1)
apps/mail/app/api/driver/types.ts (1)
apps/mail/components/create/create-email.tsx (1)
apps/mail/components/context/thread-context.tsx (1)
apps/mail/actions/brain.ts (1)
apps/mail/app/api/driver/google.ts (1)
apps/mail/components/mail/thread-display.tsx (1)
🔇 Additional comments (37)
✨ 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:
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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 4
🧹 Nitpick comments (3)
apps/mail/scripts.ts (1)
1-53: Move test utility to appropriate location.This appears to be a testing utility that would be better placed in a dedicated testing directory rather than in the main application codebase.
Consider moving this file to a
scripts/ortests/utils/directory to better organize the codebase and separate test utilities from production code.apps/mail/components/context/thread-context.tsx (1)
239-253: Thread deletion handler implemented with proper notificationsThe handler is well-implemented with appropriate toast notifications for loading, success, and error states, and it correctly updates UI state by clearing selections and triggering mutation.
There's a minor inconsistency in the indentation on line 240 - it uses tabs instead of spaces, unlike the rest of the file.
- try { + try {apps/mail/actions/brain.ts (1)
13-18: Consider adding error logging in catch handlerThe error handling has been simplified using promise chaining, which is good. However, errors aren't being logged, which might make debugging harder in production.
return await axios .put(process.env.BRAIN_URL + `/subscribe/${connection.providerId}`, { connectionId: connection.id, }) - .catch((error) => false) + .catch((error) => { + console.error('Error subscribing to brain:', error); + return false; + }) .then(() => true);
🛑 Comments failed to post (4)
apps/mail/scripts.ts (2)
31-39:
⚠️ Potential issueFix missing API credentials and recipient email.
The Resend API key is empty and the recipient email address is not specified, which will prevent this script from working properly.
- const resend = new Resend(''); + const resend = new Resend(process.env.RESEND_API_KEY);- to: '', + to: process.env.TEST_RECIPIENT_EMAIL,📝 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.const runTest = async () => { const resend = new Resend(process.env.RESEND_API_KEY); for (const item of arr) { const response = await resend.emails.send({ from: `${faker.person.firstName().toLowerCase()}@test.com`, to: process.env.TEST_RECIPIENT_EMAIL, subject: item.subject, html: item.text, });
52-52: 🛠️ Refactor suggestion
Remove or guard automatic script execution.
The script automatically runs when imported, which might not be intended for production use. Consider wrapping this in a condition or converting it to a manually invoked function.
-runTest(); +// Only run in development or when explicitly requested +if (process.env.NODE_ENV === 'development' && process.env.RUN_TEST_EMAILS) { + runTest(); +} + +export { runTest };📝 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.// Only run in development or when explicitly requested if (process.env.NODE_ENV === 'development' && process.env.RUN_TEST_EMAILS) { runTest(); } export { runTest };i18n.json (1)
23-25: 💡 Verification agent
🧩 Analysis chain
Add Chinese target locales: verify translation files
Locales"zh_CN"and"zh_TW"have been added to thetargetsarray. Please ensure corresponding translation files exist underapps/mail/localesand are correctly populated.
🏁 Script executed:
#!/bin/bash # Verify translation files for the new Chinese locales for locale in zh_CN zh_TW; do if [ ! -f "apps/mail/locales/${locale}.json" ]; then echo "Missing translation file: apps/mail/locales/${locale}.json" exit 1 fi done echo "All new locale files are present."Length of output: 201
Add missing Chinese translation files
Translation file
apps/mail/locales/zh_CN.jsonis currently missing. Please add this file (and verify thatapps/mail/locales/zh_TW.jsonexists) and populate both with the appropriate translations before merging.• Missing: apps/mail/locales/zh_CN.json
• Verify presence and content: apps/mail/locales/zh_TW.jsonapps/mail/i18n/config.ts (1)
4-5: 💡 Verification agent
🧩 Analysis chain
Add Chinese language entries: verify support & maintain ordering
Entries forzh_TWandzh_CNhave been added toLANGUAGES, in line withi18n.json. Please confirm the locale files exist underapps/mail/locales. For clarity, consider maintaining a consistent (e.g., alphabetical) order of entries in this object.
🏁 Script executed:
#!/bin/bash # Check for new locale files in the mail app for locale in zh_CN zh_TW; do if [ ! -f "apps/mail/locales/${locale}.json" ]; then echo "apps/mail/locales/${locale}.json is missing" exit 1 fi done echo "New locale files verified."Length of output: 171
🏁 Script executed:
#!/bin/bash # Verify presence of both Chinese locale files in apps/mail/locales for locale in zh_CN zh_TW; do if [ -f "apps/mail/locales/${locale}.json" ]; then echo "✔ apps/mail/locales/${locale}.json exists" else echo "✖ apps/mail/locales/${locale}.json is missing" fi doneLength of output: 325
Missing locale files for Chinese (Simplified & Traditional)
The entries forzh_CNandzh_TWwere added toapps/mail/i18n/config.ts, but their corresponding JSON files are not present underapps/mail/locales. Please add these files before merging:• apps/mail/locales/zh_CN.json
• apps/mail/locales/zh_TW.jsonAlso, consider ordering the
LANGUAGESobject alphabetically to keep entries consistent:const LANGUAGES = { - en: 'English', - es: 'Spanish', - zh_TW: 'Chinese (Traditional)', - zh_CN: 'Chinese (Simplified)', + en: 'English', + es: 'Spanish', + zh_CN: 'Chinese (Simplified)', + zh_TW: 'Chinese (Traditional)', };📝 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.const LANGUAGES = { en: 'English', es: 'Spanish', zh_CN: 'Chinese (Simplified)', zh_TW: 'Chinese (Traditional)', };
Summary by CodeRabbit