feat: Draft mail list timming display added#1501
Conversation
WalkthroughThis change updates the mail draft list UI to conditionally display the draft's internal date if available, using a formatted date string. It also extends the Changes
Sequence Diagram(s)sequenceDiagram
participant DraftComponent
participant Utils
DraftComponent->>DraftComponent: Check if draft.rawMessage?.internalDate exists
alt internalDate exists
DraftComponent->>Utils: formatDate(Number(internalDate))
Utils-->>DraftComponent: Formatted date string
DraftComponent->>DraftComponent: Render formatted date in UI
else internalDate missing
DraftComponent->>DraftComponent: Do not render date
end
Possibly related PRs
Suggested labels
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/lib/utils.ts (1)
120-125: Enhance numeric timestamp handling for better performance.The function overload and number handling logic are correctly implemented. However, the conversion from
number→Date→toISOString()→new Date()(in parseAndValidateDate) creates unnecessary overhead.Consider optimizing the number handling to avoid redundant conversions:
export function formatDate(dateInput: string | Date | number, formatter?: any): string { if (typeof dateInput === 'number') { - dateInput = new Date(dateInput).toISOString(); + dateInput = new Date(dateInput); }This change would require updating the subsequent logic to handle Date objects directly in the mail formatting path, similar to how the notes formatting logic already works.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/mail/components/mail/mail-list.tsx(1 hunks)apps/mail/lib/utils.ts(2 hunks)
🔇 Additional comments (2)
apps/mail/lib/utils.ts (1)
121-121: LGTM! Improved parameter naming and type safety.The parameter rename from
datetodateInputis more descriptive and the function overloads provide excellent type safety for the different input types.apps/mail/components/mail/mail-list.tsx (1)
671-679: LGTM! Well-implemented conditional date display.The implementation correctly:
- Uses optional chaining for safe property access
- Applies consistent styling with the existing
receivedOndate display- Properly converts the internal date to a number for the enhanced
formatDatefunction- Maintains the same responsive behavior with opacity transitions
The feature integrates seamlessly with the existing UI patterns and enhances the user experience by showing draft timing information.
Description
Added time display to the draft mail list, similar to inbox mail recieved on time.
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Before:

After:

By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by CodeRabbit
New Features
Improvements