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

[To Main] Feature - DESENG-627 use createBrowserRouter() in-app #2534

Merged
merged 11 commits into from
Jun 6, 2024

Conversation

NatSquared
Copy link
Contributor

Issue #: https://github.com/bcgov/met-public/issues/

Description of changes:

  • Feature Use createBrowserRouter insead of <BrowserRouter> in the App component 🎟️ DESENG-627
    • Updated the App component to use the more flexible createBrowserRouter function instead of the component
    • This enables the use of data router functionality and other advanced features in the future, most notably the Blocker component
    • Added the AutoBreadcrumbs component to the common components library, which will be used to generate breadcrumbs based on the current route

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the met-public license (Apache 2.0).

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 72.17391% with 32 lines in your changes missing coverage. Please review.

Project coverage is 75.93%. Comparing base (ebec3bf) to head (12ab9cf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2534      +/-   ##
==========================================
- Coverage   76.00%   75.93%   -0.07%     
==========================================
  Files         604      603       -1     
  Lines       21785    21755      -30     
  Branches     1663     1667       +4     
==========================================
- Hits        16557    16519      -38     
- Misses       4965     4973       +8     
  Partials      263      263              
Flag Coverage Δ
metweb 64.45% <72.17%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...eb/src/components/layout/Header/InternalHeader.tsx 70.21% <100.00%> (+0.64%) ⬆️
met-web/src/components/layout/SideNav/SideNav.tsx 90.90% <100.00%> (+0.28%) ⬆️
met-web/src/components/tenantManagement/Create.tsx 92.30% <100.00%> (+0.64%) ⬆️
...web/src/components/tenantManagement/TenantForm.tsx 78.88% <100.00%> (-0.24%) ⬇️
met-web/src/components/tenantManagement/Edit.tsx 93.54% <89.47%> (+6.88%) ⬆️
met-web/src/components/common/Layout/index.tsx 66.66% <62.50%> (-15.16%) ⬇️
met-web/src/components/tenantManagement/Detail.tsx 85.18% <72.72%> (+2.83%) ⬆️
...et-web/src/components/tenantManagement/Listing.tsx 72.41% <60.00%> (-2.01%) ⬇️
...eb/src/components/common/Navigation/Breadcrumb.tsx 35.71% <33.33%> (-64.29%) ⬇️

... and 1 file with indirect coverage changes

Copy link

sonarcloud bot commented Jun 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@NatSquared NatSquared requested a review from Baelx June 6, 2024 22:21
Copy link
Collaborator

@Baelx Baelx left a comment

Choose a reason for hiding this comment

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

Approved! I left a few comments here and there but you're free to merge

@@ -0,0 +1,27 @@
import React from 'react';
import '@bcgov/design-tokens/css-prefixed/variables.css'; // Will be available to use in all component
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I know what this comment is trying to say, but want to confirm. Is it:

Suggested change
import '@bcgov/design-tokens/css-prefixed/variables.css'; // Will be available to use in all component
import '@bcgov/design-tokens/css-prefixed/variables.css'; // Variables will be within scope within PublicLayout and all its child components.

* @param smallScreenOnly If true, only displays the breadcrumbs on small screens.
* @returns A list of breadcrumbs.
*/
export const AutoBreadcrumbs: React.FC<{ smallScreenOnly?: boolean }> = ({ smallScreenOnly }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for this great component!

key={match.pathname}
fallback={
<BodyText bold size="small">
Loading...
Copy link
Collaborator

Choose a reason for hiding this comment

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

You know how this functions the best, but I'm just curious why the breadcrumbs have a loading indicator


<Header1>Tenant Admin</Header1>
<Grid container spacing={0} direction="row" mb="0.5em">
<Grid item xs={12} sm={7} lg={9}>
<Header2 decorated>Tenant Instances {!loading && `(${tenants.length})`}</Header2>
<Header2 decorated>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although this isn't as much a concern now, if this platform is offered to folks with varying accessibility needs, we should bear in mind that headings are typically used to provide summaries of sections.

If the goal is just to display the number of tenant instances very prominently, I'd recommend just using a span and styling it to be large. A person using a screen reader will construe this as a description of the section that follows and may be confused as a result.

I also recognize that you didn't add this originally but it'd be something small to change if you get a sec!

onClick={() => {
navigate(`/tenantadmin/${tenant.short_name}/detail`);
}}
onKeyDown={(event) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for thinking of keyboard users!

@NatSquared NatSquared merged commit 67f1210 into main Jun 6, 2024
8 checks passed
@NatSquared NatSquared deleted the feature/DESENG-627-use-createBrowserRouter branch June 6, 2024 23:20
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