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 Side Navigation issues (toggle and on refresh) #1335

Merged

Conversation

lacksfish
Copy link
Contributor

@lacksfish lacksfish commented Dec 6, 2023

Toggling the sidenav had some issues (on mobile and desktop view), which I believe these changes will fix.

For example:

  • The mobile view considers the sidenav to not be visible initially, although the default flag is set to true. Therefore the menu button needs to be clicked twice for the menu to appear.
  • In the desktop view, upon refreshing the page, the sidebar becomes visible; however, the associated content does not reposition correctly and remains overlaid by the sidebar instead of being properly moved to the side.
  • Added backdroup-clicked event handler based on Angular documentation

I also took the liberty to add a watch command (npm run watchfrontenddev) for the frontend to the package.json

This PR does not include the associated production build for clarity of code changes.

Summary by CodeRabbit

  • New Features
    • Implemented a backdrop click feature for the side navigation panel.
  • Bug Fixes
    • Fixed an issue where the side navigation state was not toggled correctly on certain events.

@saubyk
Copy link
Collaborator

saubyk commented Jan 18, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Jan 18, 2024

Walkthrough

The changes involve updates to the Angular application's side navigation behavior. A new method backdropClicked() has been added to handle clicks on the backdrop of the side navigation. Additionally, a flag flgSideNavOpened is now toggled whenever the side navigation is opened or closed, improving the state management of the side navigation visibility across different screen sizes and login states.

Changes

File Path Change Summary
.../app.component.html Added (backdropClick) event binding to <mat-sidenav-container>. Fixed a typo by removing an extra > from </mat-sidenav-content>.
.../app.component.ts Introduced flgSideNavOpened toggle in ngAfterViewInit(), onNavigationClicked(), and backdropClicked() methods.

🐇✨
In the land of code, where sidebars slide,
A rabbit hopped through, with changes applied.
Click the backdrop, the side shall hide,
State toggles on, with every stride. 🌟🚪

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ea7f300 and fc0409c.
Files ignored due to path filters (1)
  • package.json is excluded by: !**/*.json
Files selected for processing (2)
  • src/app/app.component.html (1 hunks)
  • src/app/app.component.ts (2 hunks)
Additional comments: 5
src/app/app.component.html (2)
  • 22-22: Added (backdropClick)="backdropClicked()" event handler to mat-sidenav-container for improved user interaction with the sidenav.
  • 30-30: Corrected the closing tag of mat-sidenav-content by removing an extra >.
src/app/app.component.ts (3)
  • 162-164: The flgSideNavOpened flag is now being toggled in ngAfterViewInit. Ensure that this change does not introduce any unintended behavior, especially since the flag is being toggled before the call to this.sideNavigation.close().
  • 176-178: The flgSideNavOpened flag is now being toggled in onNavigationClicked. This change is consistent with the PR objectives to improve the sidenav toggle functionality.
  • 182-183: The flgSideNavOpened flag is now being toggled in backdropClicked. This change is consistent with the PR objectives to improve the sidenav toggle functionality.

@ShahanaFarooqui ShahanaFarooqui changed the base branch from master to Release-0.15.1 January 22, 2024 17:28
@ShahanaFarooqui ShahanaFarooqui merged commit bdd91db into Ride-The-Lightning:Release-0.15.1 Jan 22, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this script? We already have start script for development environment? But it can be added, if it helps other users.

@@ -159,7 +159,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
}

ngAfterViewInit() {
if (this.smallScreen || !this.flgLoggedIn) { this.sideNavigation.close(); }
if (this.smallScreen || !this.flgLoggedIn) {
this.flgSideNavOpened = !this.flgSideNavOpened;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This flag toggling hides the side navigation on non-small screens on initial page load. So, had to delete it from here.

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.

3 participants