Skip to content

Jaden Taking Over For Peterson: Implement Improvements in 404 Page (DONE Jaden) - #3286

Open
peterson337 wants to merge 25 commits into
developmentfrom
Peterson_implement_improvements_in_404_page2
Open

Jaden Taking Over For Peterson: Implement Improvements in 404 Page (DONE Jaden)#3286
peterson337 wants to merge 25 commits into
developmentfrom
Peterson_implement_improvements_in_404_page2

Conversation

@peterson337

@peterson337 peterson337 commented Mar 18, 2025

Copy link
Copy Markdown
Contributor

Jaden Taking Over For Peterson: Implement Improvements in 404 Page (DONE Jaden) #3286

Description

This pull request improves the 404 Not Found page and resolves all SonarQube quality gate failures.

The 404 page now displays dynamic messages and styles based on authentication state. All new and modified components follow project code standards (CSS Modules, no inline styles, WCAG contrast compliance).

Related PRs (if any):

None

Main changes explained:

  • NotFoundPage - Removed all inline styles and injected <style> tag; replaced with CSS module classes. Dynamic messaging for logged-in vs logged-out users.
  • NotFoundPage.module.css - Added classes for light/dark theming, responsive layout, and link spacing.
  • UserProfile - Removed unused imports, unused state, and dead functions. Fixed infringements spread bug. Converted <span role="button"> elements to proper <button> elements.
  • UserProfile.module.css - Created new CSS module for styles previously inline.
  • SummaryBar - Refactored to resolve SonarQube cognitive complexity violations. Extracted all inner functions, render helpers, and JSX sections (BadgeIcons, SuggestionModal, BugReportModal) to module-level. Reduced cognitive complexity to within the 15-point limit.
  • notificationCard - Re-added missing CSS module import, fixed className template literal.
  • Logout - Removed duplicate useHistory declaration.

How to test:

cd HighestGoodNetworkApp
git checkout Peterson_implement_improvements_in_404_page2
npm install
npm start
  1. Go to any invalid URL e.g. http://localhost:3000/doesnotexist
  2. Logged out - one link should appear redirecting to the login page
  3. Logged in - two links should appear: one redirects to the dashboard, the second redirects to the dashboard and opens the suggestions/feedback modal

Note:

SonarQube quality gate passes with 0 new issues, 0 security hotspots, and 1.1% duplication on new code.

PR 3286 Screenshot 1

@peterson337 peterson337 added the do not review Do not review or look at code without full context label Mar 18, 2025
@netlify

netlify Bot commented Mar 18, 2025

Copy link
Copy Markdown

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit ac77e0c
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/67ec1eee7486020008d38e43
😎 Deploy Preview https://deploy-preview-3286--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@peterson337 peterson337 added High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible do not review Do not review or look at code without full context and removed do not review Do not review or look at code without full context High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible labels Mar 19, 2025
@peterson337 peterson337 added High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible and removed do not review Do not review or look at code without full context labels Apr 1, 2025

@vaibhavkoladiya vaibhavkoladiya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Everything works as expected. I checked out the current branch, ran the PR locally after npm install, and tested both logged-in and logged-out states. When logged in, the error page correctly shows two links—one redirects to the dashboard, and the other opens the same route with the suggestions/development modal. When not logged in, the error page displays a link that properly redirects to the login page. Looks good to me—approved! ✅

Screen.Recording.2025-04-04.182506.mp4

@rsripathi2906 rsripathi2906 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested the 404 error page implementation — everything works as expected.
Tested both logged-in and logged-out scenarios.
Links and modal behave correctly. Approving the PR.

Screen.Recording.2025-04-04.223938_1.mp4

@sravankumarbodakonda sravankumarbodakonda left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified the error page behavior based on user authentication. Logged-in users see two links—one to the dashboard and another that opens the suggestions/development modal. Unauthenticated users are correctly redirected to the login page. Everything is working as expected, i am approving the PR.
Screenshot 2025-04-09 at 12 03 54 AM
Screenshot 2025-04-09 at 12 03 41 AM
Screenshot 2025-04-09 at 12 03 25 AM

@pavanputti pavanputti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested the fix by checking out the current branch, running npm install, and starting the app locally. I logged in as a user, navigated to a nonexistent URL, and confirmed that the error page showed two links: one redirecting to the dashboard and another opening the suggestions modal while also redirecting to the dashboard. I then logged out, revisited the invalid URL, and verified that the error page displayed a single link redirecting to the login page.

Screen.Recording.2025-04-10.at.5.07.22.PM.mov
Screenshot 2025-04-10 at 5 11 57 PM

@KH07

KH07 commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

It has been tested and functions as intended. I checked out to the current branch, did an npm install, started the app locally, and tried to access a page that did not exist. When not logged in, the error page shows a redirect link to the login page. When logged in, the error page shows two redirect links, both to the home page, and the second one opens a modal.
PR#3286 not logged in
PR#3286 logged in
PR#3286 logging in first link
PR#3286 logging in second link

@nikhilpittala16 nikhilpittala16 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have tested the PR and everything works as expected.

PR.vid.21.mp4

@JuliaHa0902 JuliaHa0902 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have checked out the branch and followed the instructions to test the branch. It works as intended.
When not login:
Screenshot 2025-04-17 233440
When login
Screenshot 2025-04-17 233542
Screenshot 2025-04-17 233712
I clicked on the modal and the pop up showed
Screenshot 2025-04-17 233604
Just a suggestion, maybe we should remove the white part at the end of the page containing "Back to Top" button, or change the background to match the dark theme.
Screenshot 2025-04-17 233805

@gopikalakshmia gopikalakshmia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked out the branch.
Verified the "Not Found" page behavior before and after login.
Before login
image
After login (Home and User Suggestions pop-up available):
image
image

Works as intended .Approving the PR.

@Ram-blip Ram-blip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked the PR and confirmed that the new error page correctly shows a single “Login” link for unauthenticated users, and for logged-in users it displays both a “Go to Dashboard” link and a “Send Feedback” link that opens the suggestions modal -everything navigates and behaves exactly as intended.

PR 3286 Screenshot 2025-05-29 at 5 25 27 PM

@aayushshetty12 aayushshetty12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Working as expected.
When user is logged in, two links appear on the error page: the first redirects to the dashboard, and the second redirects to same dashboard with the modal for suggestions and development.
Screenshot 2025-07-12 033730
Screenshot 2025-07-12 033501

When user is not logged in, link appears on the error page that redirects to the login page.
Screenshot 2025-07-12 033857

@rohanrastogi311 rohanrastogi311 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Peterson,

Error launch due to incorrect node version. 14 instead of 20.

PR 3286 Screenshot

@Jaden300 Jaden300 changed the title Peterson_implement_improvements_in_404_page Jaden Taking Over For Peterson: Implement Improvements in 404 Page Jul 25, 2026
@netlify

netlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit d28e4d2
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6a6ffd8789f679000831cba1
😎 Deploy Preview https://deploy-preview-3286--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Jaden300 added 10 commits July 25, 2026 13:35
…ificationCard

- Move section border, heading color, link margin, and p margin to CSS module classes
- Remove injected style tag from NotFoundPage JSX
- Restore notificationCard.module.css import and use module classes for card layout
- Fix pre-existing stylelint errors in NotFoundPage.module.css
- Remove unused imports: useId, Col, convertDateFormatToMMMDDYY, ProfileImageModal, CREATED_DATE_CRITERIA
- Remove unused state: didLinkUpdate, setDidLinkUpdate
- Remove unused vars: result, isStartDateValid, isEndDateValid and their dead functions
- Fix two bugs: spread of optional chain now uses nullish coalescing to avoid TypeError
- Fix for loop to for-of, findIndex !== -1 to .some, typeof check to direct undefined compare
- Fix optional chaining on err.response and nested ternary for canEditUserProfile
- Convert 6 span role=button elements to proper button elements
- Remove duplicate useHistory call in Logout
- Fix nested template literal in notificationCard
- Move all new inline styles to CSS module classes in UserProfile and SummaryBar
- Remove unused isModalOpen state and toggleModal function
- Fix nested template literal in profilePicture className
- Replace double && checks with optional chaining in SummaryBar getInfringements and getBadges
- Extract getCategoryDescription, getDraggedNextElement, applyEditMode, applyDraggableMode, readFormData, and applyFieldUpdate to module level
- Replace remaining inline style in renderSummaryMessage with btnResetInherit CSS module class
…nitive complexity

- Extract getInfringements, getBadges, getWeeklySummary, canEditData, getContainerClass, and getPlaceholderText to module level
- Update all call sites to pass required params
- Extract loadUserProfile, getUserTasks, openSuggestionModal, editField, sendUserSuggestion to module level
- Update all call sites to pass required params explicitly
…to module level

Extract editRadioButtonSelected, onTaskClick, onBadgeClick, renderSummary,
renderSummaryMessage, openReport, sendBugReport, closeSuggestionModal,
onDragToggleDraggingClass, onSortableDragOver, and handleEditClick from the
component body to module-level functions. Update all call sites to pass
required state and props as explicit parameters. Also fix editField to use a
fieldState object to stay within the 7-parameter SonarQube limit.
Reduce renderSummary from 9 params to 6 by pre-computing canEdit in the
component and passing it directly. Replace all repeated
isAuthUser || canEditData(...) ternaries in JSX with the single canEdit
boolean, eliminating 5 duplicate branch expressions from the component body.
…tive complexity

Move the suggestion and bug report modal JSX into separate module-level
function components, removing their branch logic from the SummaryBar
component body to bring cognitive complexity within the allowed limit.
…complexity

Extract badge icon section into BadgeIcons component removing 5 canEdit
ternaries from SummaryBar. Extract handleLoadEvent to module level. Convert
useEffect && shortcut to explicit if statement.

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Jaden,

I ran and tested the PR locally.

Verified

  • Page not found when logged in

    Image Image
    • Clicking "Home" goes to the dashboard

      Image Image
    • Clicking "Here" goes to the dashboard and opens up the User Suggestion form

      Image Image
  • Only one Link at the Page not Found page where it takes the user to the login page.

Image Image

Issues

  1. Could you clarify if this is the intended behavior. If the user is logged out, at the Page not Found page, it still shows the nav bar and its associated drop down(Hello, View profile, update password, light/dark mode toggle, and logout).

    Image Image

@iAbhi001
iAbhi001 self-requested a review July 28, 2026 01:38
iAbhi001
iAbhi001 previously approved these changes Jul 28, 2026

@iAbhi001 iAbhi001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Local Testing & PR Review

I checked out the branch and performed local testing across both logged-in and logged-out states.

Verified Functionality:

  • Logged-in state: Navigating to an invalid route displays the updated 404 page with two functional links—one pointing to the Dashboard, and the other opening the User Suggestion/Development modal as expected.
  • Logged-out state: The 404 page correctly shows a single link redirecting to the Login page.

⚠️ Issue Found / Question for Author:

  • Navbar visibility when logged out: As noted by @kzou55, when navigating to a non-existent route as an unauthenticated/logged-out user, the authenticated top navbar (with options like Hello, View Profile, Update Password, and Logout) is still rendered.

Expected Behavior: When a user is logged out, the top navigation header should not display logged-in user controls/dropdowns. Could you please check the auth wrapper or route guarding on the 404 page to ensure the navbar reflects the correct logged-out state?

Image Image Image Image

@DeepighaJ DeepighaJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @Jaden300 Tested the PR locally. The mentioned behaviors working as expected but need clarity before approving on the header part during log out scenario. Otherwise its good to go. Will approve once its confirmed.
When LoggedIn: Two links appear "Home" and "here".
On clicking on Home redirects to dashboard page
On clicking on here redirects to dashboard page with model appears and submitting feedback shows success toast "Email sent successfully"
Image
Clicking on home:
Image
Clicking on here model appears:
Image
Image
Image
When Logged out : Only one link appears for login page
Image
Image

Kept all existing routes from HEAD and all new routes from development,
with NotFoundPage catch-all placed after all new ProtectedRoutes.
@Jaden300 Jaden300 changed the title Jaden Taking Over For Peterson: Implement Improvements in 404 Page Jaden Taking Over For Peterson: Implement Improvements in 404 Page (DONE Jaden) Aug 1, 2026
@Jaden300
Jaden300 requested review from DeepighaJ and kzou55 August 1, 2026 22:55
@iAbhi001
iAbhi001 self-requested a review August 2, 2026 20:38
iAbhi001
iAbhi001 previously approved these changes Aug 2, 2026

@iAbhi001 iAbhi001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I tested the PR locally on the Peterson_implement_improvements_in_404_page2 branch after running npm install and npm start.

🛠️ Verification Results:

  • Logged-out State: Navigating to an invalid URL correctly shows a single link redirecting to the login page.
  • Logged-in State: Navigating to an invalid URL displays two functional links—one pointing to the Dashboard, and the other redirecting to the Dashboard while opening the Feedback/Suggestions modal.
  • Modal Functionality: Submitting feedback inside the modal works as expected with a success toast notification.
  • UI & Styling: The 404 page styling renders cleanly without console errors or inline style issues.

Everything works as expected on my end! LGTM! 🚀

Image Image

@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.