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

Added: Navigation and Routing #2281

Conversation

shashankvish0010
Copy link

@shashankvish0010 shashankvish0010 commented Apr 3, 2024

Description

Added a "Home" page to the navigation bar, represented by the 'Home' icon.
Integrated the "Statistics" page and "Workflows" page routes into the application's routing structure within the authenticated layout for now.
I modified the authentication redirect; now it redirects to statistics.

fixes: #2263

How these changes were tested

Tested with local development setup.

Examples and references

Screenshot (319)

Copy link

changeset-bot bot commented Apr 3, 2024

⚠️ No Changeset found

Latest commit: 1bbf642

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Apr 3, 2024

Important

Auto Review Skipped

Auto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

This update introduces a new "Home" page linked to the "Statistics" section, enriches the navigation with additional routes for "Statistics" and "Workflows", and modifies redirection paths for authenticated/unauthenticated users to the newly established "Statistics" page. These changes aim to streamline navigation and enhance user experience within the application.

Changes

File Path Change Summary
.../Router/Router.tsx Added routes for Statistics and Workflows pages.
.../Header/hooks/useNavbarLogic/useNavbarLogic.tsx Included a "Home" navigation item with icon linking to /en/statistics.
.../templates/Providers/Providers.tsx Updated redirection paths for authenticated/unauthenticated users to /en/statistics.
.../pages/Statistics/Statistics.page.tsx Added a new Statistics page component.
.../pages/Workflows/Workflows.page.tsx Added a new Workflows page component.

Assessment against linked issues

Objective Addressed Explanation
Add a "Home" page to the navigation bar with the Home icon (#2263)
Integrate "Statistics" and "Cases" routes into the application's routing (#2263) The objective mentions "Cases" routes, but the summary only specifies "Statistics" and "Workflows".
Modify authentication redirects to point to the "Statistics" page (#2263)

🐇✨
In a burrow, not so deep,
A rabbit worked, no time to sleep.
With a hop and code in hand,
It crafted routes, oh so grand.
"To Statistics!" it did cheer,
With every line, its goal drew near.
Now navigate, explore, take leaps,
Through pages new, where data peeps.
🌟🐾

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.

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.
  • 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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2f98a8d and 3039c41.
Files selected for processing (5)
  • apps/backoffice-v2/src/Router/Router.tsx (3 hunks)
  • apps/backoffice-v2/src/common/components/organisms/Header/hooks/useNavbarLogic/useNavbarLogic.tsx (2 hunks)
  • apps/backoffice-v2/src/common/components/templates/Providers/Providers.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Statistics/Statistics.page.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Workflows/Workflows.page.tsx (1 hunks)
Files skipped from review due to trivial changes (2)
  • apps/backoffice-v2/src/pages/Statistics/Statistics.page.tsx
  • apps/backoffice-v2/src/pages/Workflows/Workflows.page.tsx
Additional comments not posted (2)
apps/backoffice-v2/src/common/components/templates/Providers/Providers.tsx (1)

14-20: Ensure the new redirection paths (/en/statistics and /en/auth/sign-in) are valid and correctly integrated into the application's routing configuration.

apps/backoffice-v2/src/Router/Router.tsx (1)

24-25: Verify the correctness of the paths (/en/statistics and /en/workflows) and ensure that the error elements are properly configured for the new routes for "Statistics" and "Workflows" pages.

Also applies to: 112-121

Verification successful

The paths for the "Statistics" and "Workflows" pages are correctly implemented as /:locale/statistics and /:locale/workflows, respectively, with appropriate error handling configured via errorElement: <RouteError />. This confirms that the changes align with the objectives of integrating these pages into the application's routing framework.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the correctness of the paths and the configuration of the error elements.
rg '/en/statistics' apps/backoffice-v2/src/Router/Router.tsx
rg '/en/workflows' apps/backoffice-v2/src/Router/Router.tsx
rg '<RouteError />' apps/backoffice-v2/src/Router/Router.tsx

Length of output: 857



Script:

#!/bin/bash
# Inspect the entire routing configuration within Router.tsx to verify the implementation of the new routes and their error handling.
cat apps/backoffice-v2/src/Router/Router.tsx

Length of output: 5308

Comment on lines +20 to +25
{
text: 'Home',
icon: <Home size={20} />,
href: '/en/statistics',
key: 'nav-item-Home',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification process has confirmed that the '/en/statistics' path does not exist in the router configuration, indicating an issue with the validity of the link for the "Home" navigation item. However, the 'nav-item-Home' key is confirmed to be unique within the navigation items. Based on these findings, the review comment is partially verified, highlighting the need to address the non-existent path issue.

Analysis chain

Ensure the link for the "Home" navigation item (/en/statistics) is valid and correctly integrated into the application's routing configuration. Also, verify the consistency and uniqueness of the navigation item's key (nav-item-Home).


The verification process is inconclusive due to the lack of output for the '/en/statistics' path in the router configuration. This could indicate that the path is not defined, or there might have been an issue with the search command. Additionally, while the 'nav-item-Home' key is present, the output does not confirm its uniqueness. Further investigation is required to conclusively verify both aspects.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the existence of the '/en/statistics' path in the router configuration.
rg '/en/statistics' apps/backoffice-v2/src/Router/Router.tsx
# Ensure the key 'nav-item-Home' is unique across the navigation items.
rg 'nav-item-Home' apps/backoffice-v2/src/common/components/organisms/Header/hooks/useNavbarLogic/useNavbarLogic.tsx

Length of output: 205



Script:

#!/bin/bash
# Re-verify the existence of the '/en/statistics' path in the router configuration with a corrected command.
rg '/en/statistics' apps/backoffice-v2/src/Router/Router.tsx || echo "Path not found"
# Check for multiple occurrences of the 'nav-item-Home' key to ensure its uniqueness.
rg 'nav-item-Home' apps/backoffice-v2/src/common/components/organisms/Header/hooks/useNavbarLogic/useNavbarLogic.tsx -c

Length of output: 221

@Omri-Levy
Copy link
Contributor

Great work! Before merging try and see if you can understand why the nav item is not styled as the active item. Notice its a shade of gray instead of the expected black.

@Omri-Levy Omri-Levy changed the base branch from dev to epic/feat/home-page April 4, 2024 07:07
@shashankvish0010
Copy link
Author

Great work! Before merging try and see if you can understand why the nav item is not styled as the active item. Notice its a shade of gray instead of the expected black.

Thanks for addressing the issue, I checked it and got to know that the 'Home' nav-item is not styled as active item when it's active, and added changes to make sure it works perfectly fine.

Comment on lines +51 to +56
{
path: '/:locale/auth/sign-in',
element: <SignIn />,
errorElement: <RouteError />,
},
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please ensure your IDE is configured to run Prettier and ESLint on save. Install the respective plugins if you haven't and make sure you're not running a custom format on save. 🙏🏼

Comment on lines 66 to 68
if (!navItem.children) {
return navItem.href === pathname;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert please. This should never be true since a filter group always has children. The suggestion in the previous comment was general advice for the future.

@Omri-Levy Omri-Levy merged commit 4d171f6 into ballerine-io:epic/feat/home-page Apr 10, 2024
@shashankvish0010 shashankvish0010 deleted the shashankvish-0010/feat/navigation-and-routing branch April 10, 2024 10:03
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.

Welcome - Navigation and Routing
2 participants