Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #201 : Active class for sidebar #221

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

madhav-relish
Copy link
Contributor

@madhav-relish madhav-relish commented Aug 28, 2024

Fixes #201

The active tab is highlighted when that particular page is active
Screenshot 2024-08-28 104231

Summary by CodeRabbit

  • New Features

    • Enhanced the Compose Email Form with improved UI components and styling for better user experience.
    • Updated the Side Navigation to include current search parameters, improving navigation relevance.
  • Bug Fixes

    • Streamlined the Modal component's structure for improved clarity and potential performance enhancement.
  • Style

    • Applied new styling classes to various components for a more modern and visually appealing design.
    • Adjusted the layout of the Video Demo component for a more flexible design.

- Modal is now big and fully responsive
- Simplified the styling
- changed the design of the "To" autocomplete to the desired one
Copy link

vercel bot commented Aug 28, 2024

@madhav-relish is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Aug 28, 2024

Walkthrough

The changes involve updates to the ComposeEmailForm, Modal, SideNav, and VideoDemo components to enhance user experience and functionality. The ComposeEmailForm now utilizes a more modular input structure, while the Modal component simplifies its styling logic. The SideNav has been improved to include URL search parameters for better navigation context. Additionally, the VideoDemo component has been adjusted for a more flexible layout. These modifications collectively enhance the UI and responsiveness of the components.

Changes

Files Change Summary
apps/web/app/(app)/compose/ComposeEmailForm.tsx, apps/web/components/Modal.tsx UI component updates for better styling and modularity in ComposeEmailForm; simplified class management in Modal.
apps/web/components/SideNav.tsx Integration of useSearchParams to reflect current URL search parameters in navigation links.
apps/web/app/(landing)/home/VideoDemo.tsx Adjustments to the layout of the VideoDemo component for more flexibility in rendering.

Assessment against linked issues

Objective Addressed Explanation
Active class for sidebar (#201)

🐇 In the meadow, bright and wide,
Changes made with joyful pride.
Inputs clean and links that flow,
A sidebar that will surely glow!
Hopping through the code we cheer,
For better paths that now appear! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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

@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

Commits

Files that changed from the base of the PR and between e4912e6 and 7910318.

Files selected for processing (3)
  • apps/web/app/(app)/compose/ComposeEmailForm.tsx (4 hunks)
  • apps/web/components/Modal.tsx (1 hunks)
  • apps/web/components/SideNav.tsx (3 hunks)
Additional context used
Biome
apps/web/components/SideNav.tsx

[error] 301-301: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)

Additional comments not posted (6)
apps/web/components/Modal.tsx (1)

64-79: LGTM!

The changes simplify the styling logic by reducing redundancy in class application while maintaining the conditional styling based on the props attributes.

The code changes are approved.

apps/web/app/(app)/compose/ComposeEmailForm.tsx (4)

3-8: LGTM!

The import statements have been modified to include ComboboxInput, which enhances modularity.

The code changes are approved.


174-179: LGTM!

The additional classes for styling improve the visual layout and user interaction.

The code changes are approved.


193-195: LGTM!

The simplified class for ComboboxInput contributes to a cleaner input style without borders.

The code changes are approved.


303-303: LGTM!

The updated class for the main container adds a more defined structure to the component.

The code changes are approved.

apps/web/components/SideNav.tsx (1)

337-342: LGTM!

The changes ensure that the links in the sidebar are now aware of and include the current search parameters, improving navigation experience.

The code changes are approved.

Comment on lines 300 to 301
const searchParams = useSearchParams();
const activePath = "?" + searchParams.toString(); // "?" is added to match the href strings of NavItems
Copy link
Contributor

Choose a reason for hiding this comment

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

Use template literals for string concatenation.

Template literals are preferred over string concatenation for better readability and performance.

Apply this diff to use template literals:

-const activePath = "?" + searchParams.toString();
+const activePath = `?${searchParams.toString()}`;
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.

Suggested change
const searchParams = useSearchParams();
const activePath = "?" + searchParams.toString(); // "?" is added to match the href strings of NavItems
const searchParams = useSearchParams();
const activePath = `?${searchParams.toString()}`; // "?" is added to match the href strings of NavItems
Tools
Biome

[error] 301-301: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7910318 and 764e9d0.

Files selected for processing (1)
  • apps/web/components/SideNav.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/SideNav.tsx

Copy link
Owner

@elie222 elie222 left a comment

Choose a reason for hiding this comment

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

Thanks. Just a few comments

{selectedEmailAddressses.map((emailAddress) => (
<Badge
key={emailAddress}
variant="outline"
className="mr-1.5"
className="h-8 rounded-md border-primary bg-primary text-white"
Copy link
Owner

Choose a reason for hiding this comment

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

mostly not using x-primary but the color instead. sometimes primary appears in codebase but it's rare and i'd prefer to stay consistent with colors here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -298,6 +298,9 @@ export function SideNav(props: {
function Sidebar(props: { isMobile: boolean }) {
const path = usePathname();
const showMailNav = path === "/mail" || path === "/compose";
const searchParams = useSearchParams();
// "?" is added to match the href strings of NavItems
const activePath = `?${showMailNav && searchParams.toString() ? searchParams.toString() : "type=inbox"}`; // if we are at "/mail" only, then the "Inbox" item will be highlighted
Copy link
Owner

Choose a reason for hiding this comment

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

Something like this would be cleaner and cover cases where there are other searchParams:

const params = new URLSearchParams(searchParams);
params.set(searchParam, value);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has also been changed for better readability and tested as well!

- Color name is now specified rather than using bg-primary etc
- Fixed the layout change of demo video modal on the landing page
- Made sidebar code more readable for highlighted labels
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 764e9d0 and f8db0b0.

Files selected for processing (3)
  • apps/web/app/(app)/compose/ComposeEmailForm.tsx (4 hunks)
  • apps/web/app/(landing)/home/VideoDemo.tsx (1 hunks)
  • apps/web/components/SideNav.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/(app)/compose/ComposeEmailForm.tsx
Additional comments not posted (3)
apps/web/app/(landing)/home/VideoDemo.tsx (1)

31-31: Approve layout changes, but verify responsiveness.

The changes to the iframe and its container improve flexibility and responsiveness. However, ensure to test the layout across different screen sizes and devices to confirm that the video presentation remains consistent and visually appealing.

The code changes are approved.

Run the following script to verify the layout across different devices:

apps/web/components/SideNav.tsx (2)

301-310: Approve changes, suggest adding explanatory comments.

The use of useSearchParams and URLSearchParams to dynamically set the activePath enhances the sidebar's responsiveness to URL changes. However, consider adding comments to explain the logic behind setting activePath and its use in the Links component, especially for developers unfamiliar with these hooks.

The code changes are approved.


345-350: Approve dynamic link handling in the sidebar.

The dynamic handling of activePath in the Links component ensures that the sidebar navigation is contextually relevant and reflects the current URL state. This is a good practice and enhances the user experience by making the navigation more intuitive.

The code changes are approved.

@elie222 elie222 merged commit ddf1103 into elie222:main Sep 10, 2024
1 of 2 checks passed
@elie222
Copy link
Owner

elie222 commented Sep 10, 2024

Thanks!

@coderabbitai coderabbitai bot mentioned this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Active class for sidebar
2 participants