Skip to content

Comments

feat: add shimmer loading effect and starred mail section#1589

Closed
Pankajkumar2608 wants to merge 3 commits intoMail-0:stagingfrom
Pankajkumar2608:feat/starred-mail-shimmer
Closed

feat: add shimmer loading effect and starred mail section#1589
Pankajkumar2608 wants to merge 3 commits intoMail-0:stagingfrom
Pankajkumar2608:feat/starred-mail-shimmer

Conversation

@Pankajkumar2608
Copy link
Contributor

@Pankajkumar2608 Pankajkumar2608 commented Jul 2, 2025

Uploading Untitled video - Made with Clipchamp (1).mp4…

Fixes #1588

Description

This PR adds two enhancements:

  1. Introduces a shimmer loading effect in the mail list to improve user experience during data fetching.
  2. Adds a new "Starred" mail section, which displays only starred mails and updates the navigation and routing accordingly.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🎨 UI/UX improvement

Areas Affected

  • User Interface/Experience
  • Data Storage/Management

Testing Done

  • Manual testing performed
  • Mobile responsiveness verified (UI tested across screen sizes)

Security Considerations

  • No sensitive data is exposed
  • Input validation is implemented (where applicable)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • All tests pass locally

Additional Notes

  • Added a new component thread-skeleton.tsx for shimmer effect.
  • Updated navigation.ts, route config, and en.json to support the new "Starred" section.

Screenshots/Recordings

Add screenshots or screen recordings here if applicable.


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

    • Added a "Starred" folder to the mail app, accessible from the sidebar navigation.
    • Introduced a new keyboard shortcut ("g + *") for quick access to the "Starred" folder.
    • Added a "Starred" label for localization and display.
  • Enhancements

    • Improved mail list loading experience with a new skeleton placeholder UI for smoother visual feedback during data loading.
  • Bug Fixes

    • Adjusted empty state and loading indicators to better fill available space and display only when appropriate.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 2, 2025

"""

Walkthrough

The changes introduce a new "Starred" mail folder throughout the mail application, updating constants, navigation, localization, and folder-label mappings to support it. Additionally, a skeleton (shimmer) loading effect is implemented for the mail list, replacing the previous spinner-based loading UI with placeholder components for a smoother loading experience.

Changes

Files/Paths Change Summary
apps/mail/app/(routes)/mail/[folder]/page.tsx Added 'starred' to allowed folder names.
apps/mail/components/mail/mail-list.tsx Replaced loading spinner with new MailListSkeleton shimmer component; updated layout and logic.
apps/mail/components/mail/thread-skeleton.tsx Introduced new ThreadSkeleton component for skeleton mail thread UI.
apps/mail/config/navigation.ts Added "Starred" navigation item to the mail sidebar.
apps/mail/messages/en.json Added "starred" label to English localization.
apps/server/src/lib/utils.ts Added "starred" to folder/label constants, folder names, and folder-label mappings.
apps/server/src/trpc/routes/mail.ts Added "starred" mapping to folder-to-label map.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Sidebar
    participant MailApp
    participant Server

    User->>Sidebar: Clicks "Starred"
    Sidebar->>MailApp: Navigates to /mail/starred
    MailApp->>Server: Requests mails with label "STARRED"
    MailApp->>MailApp: Shows MailListSkeleton (shimmer loading)
    Server-->>MailApp: Returns starred mails
    MailApp->>MailApp: Renders MailList with starred mails
Loading
sequenceDiagram
    participant MailApp
    participant MailList
    participant MailListSkeleton

    MailApp->>MailList: Renders MailList (loading=true)
    MailList->>MailListSkeleton: Display shimmer skeleton
    MailList-->>MailApp: Once data loaded, render mail threads
Loading

Assessment against linked issues

Objective Addressed Explanation
Add "Starred" section to show only starred emails, update navigation, create filtering logic, route /mail/starred (#1588)
Implement skeleton/shimmer UI for mail list loading across folders (#1588)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

  • context #595: Adds toggle star action and context menu, directly complementing the starred folder by enabling starring/un-starring threads.
  • Skeleton for drafts #1302: Adds a skeleton placeholder for drafts, related through the shared goal of improving loading skeletons in mail components.
  • Hotix #1241: Modifies mail list rendering logic, related as both PRs affect the MailList component's UI and loading behavior.

Suggested reviewers

  • MrgSub

Poem

In the warren where emails hop and play,
A "Starred" burrow shines bright today!
With shimmer and skeleton, loading's a breeze—
No more waiting, just mail with ease.
🐇✨
Quick as a bunny, your favorites appear,
The mailbox is smiling from ear to ear!
"""


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3775d92 and 317fb68.

📒 Files selected for processing (1)
  • apps/mail/config/navigation.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/mail/config/navigation.ts
✨ 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

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Implements a new Starred mail section and shimmer loading effects for improved UX during data fetching. The changes span both client and server components with careful attention to data management.

  • Added new apps/mail/components/mail/thread-skeleton.tsx implementing loading placeholders with shimmer animation effects
  • Updated apps/server/src/trpc/routes/mail.ts to handle starred mail functionality with proper label management
  • Modified apps/mail/config/navigation.ts to include Starred section under Management group with appropriate shortcuts
  • Enhanced apps/mail/components/mail/mail-list.tsx with optimistic UI updates for star toggling
  • Added localization support in apps/mail/messages/en.json for the new Starred section

7 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

id: 'starred',
title: m['navigation.sidebar.starred'](),
url: '/mail/starred',
icon: Stars,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: potential keyboard shortcut conflict between 'g + s' for starred and settings route defined on line 157

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 34fa41e and 3775d92.

📒 Files selected for processing (7)
  • apps/mail/app/(routes)/mail/[folder]/page.tsx (1 hunks)
  • apps/mail/components/mail/mail-list.tsx (3 hunks)
  • apps/mail/components/mail/thread-skeleton.tsx (1 hunks)
  • apps/mail/config/navigation.ts (1 hunks)
  • apps/mail/messages/en.json (1 hunks)
  • apps/server/src/lib/utils.ts (3 hunks)
  • apps/server/src/trpc/routes/mail.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: danteissaias
PR: Mail-0/Zero#618
File: apps/mail/components/mail/mail-iframe.tsx:102-102
Timestamp: 2025-04-07T20:48:48.213Z
Learning: In the Zero mail application, when implementing the "Trust Sender" feature, the banner should disappear immediately when a user clicks the "Trust Sender" button without showing a loading state. This is achieved by setting `setImagesEnabled(true)` at the beginning of the `onTrustSender` function, providing immediate visual feedback while the backend operation continues asynchronously.
apps/server/src/trpc/routes/mail.ts (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
apps/mail/app/(routes)/mail/[folder]/page.tsx (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.
apps/mail/components/mail/mail-list.tsx (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.
apps/mail/config/navigation.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 (2)
apps/mail/config/navigation.ts (1)
apps/mail/components/icons/icons.tsx (1)
  • Stars (1342-1373)
apps/server/src/lib/utils.ts (1)
apps/mail/lib/utils.ts (2)
  • FOLDERS (10-17)
  • LABELS (19-26)
🪛 Biome (1.9.4)
apps/mail/components/mail/mail-list.tsx

[error] 1017-1017: Avoid passing children using a prop

The canonical way to pass children in React is to use JSX elements

(lint/correctness/noChildrenProp)

🔇 Additional comments (12)
apps/mail/components/mail/thread-skeleton.tsx (1)

1-19: Well-implemented skeleton loading component.

The ThreadSkeleton component follows excellent skeleton UI patterns with proper visual hierarchy, responsive design, and consistent spacing. The layout effectively mimics a mail thread item structure.

apps/server/src/trpc/routes/mail.ts (1)

22-22: Correct implementation of starred folder mapping.

The addition follows the established pattern and correctly maps the "starred" folder to the "STARRED" label, maintaining consistency with existing folder mappings.

apps/mail/app/(routes)/mail/[folder]/page.tsx (1)

9-9: Necessary addition for starred folder routing.

Adding "starred" to ALLOWED_FOLDERS correctly enables route validation for the new starred folder, preventing "folder not found" errors when users navigate to /mail/starred.

apps/mail/messages/en.json (1)

404-404: Proper localization addition for starred folder.

The addition of the "starred" label under navigation.sidebar is correctly placed and follows the established pattern for navigation localization.

apps/server/src/lib/utils.ts (1)

50-50: LGTM! Consistent implementation of STARRED folder and label constants.

The additions follow the established patterns in the codebase:

  • Folder name uses lowercase ('starred')
  • Label name uses uppercase ('STARRED')
  • Proper mapping in FOLDER_TAGS

These changes align well with the PR's objective to add starred mail functionality.

Also applies to: 60-60, 80-80

apps/mail/components/mail/mail-list.tsx (7)

61-61: Good addition of ThreadSkeleton import.

Adding the skeleton component import supports the enhanced loading experience being implemented.


729-735: Excellent skeleton loading implementation.

The MailListSkeleton component provides a much better user experience during loading states compared to a simple spinner. The parameterized count allows for flexibility.


982-982: Improved container layout structure.

The change to flex-col layout properly supports the new skeleton loading and empty state implementations.


986-1008: Enhanced loading and empty states.

The replacement of the simple loading spinner with MailListSkeleton significantly improves the user experience. The empty state now uses flex-1 for better space utilization.


1010-1034: Well-structured virtual list implementation.

The VList container structure is properly organized with flex layout. The scroll handling logic for pagination remains intact and functional.


1037-1037: Improved fetching state condition.

The condition isFetching && !isLoading properly separates the pagination loading state from the initial skeleton loading, providing clearer visual feedback to users.


1017-1017: Ignore static-analysis warning: VList children is a render-function

The VList component from virtua types its children prop as a render function (index: number) => ReactNode. Passing vListRenderer here matches the intended API, so the linter’s “non-canonical children” warning can be safely ignored.

@MrgSub
Copy link
Collaborator

MrgSub commented Jul 2, 2025

Please address comments and provide a video

@Pankajkumar2608
Copy link
Contributor Author

Please address comments and provide a video

Untitled.video.-.Made.with.Clipchamp.2.mp4

@Pankajkumar2608
Copy link
Contributor Author

Hi @MrgSub,

I noticed that an unintended merge commit (be57303) got added to this branch.
The relevant commits for this PR are:

3775d92: feat: add shimmer loading effect and starred mail section

317fb68: fixed issue with between shortcut

If possible, could you please cherry-pick or squash only these two commits when merging to keep the history clean?
Let me know if you'd prefer me to rebase and force-push a clean version — I can do that too.

Thanks a lot!
again sorry it done by mistake

@MrgSub
Copy link
Collaborator

MrgSub commented Jul 4, 2025

Thank you, can we remove the loading effect and just add the starred mail section? perhaps open another PR for the skeleton as it's not needed atm

@MrgSub MrgSub added the Low Priority Low Priority Work label Jul 4, 2025
@Pankajkumar2608
Copy link
Contributor Author

Thank you, can we remove the loading effect and just add the starred mail section? perhaps open another PR for the skeleton as it's not needed atm

I added the loading effect to improve the user experience during longer load times — it's better to show a shimmer effect than a blank screen. But sure, I can remove it for now and focus on just adding the starred mail section. We can introduce the skeleton in a separate PR later if needed.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2025

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.

@github-actions github-actions bot closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Low Priority Low Priority Work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shimmer effect for loading of mail-list and starred section for showing only starred mail

2 participants