[ECWoC] Fixed Profile Picture not loading Error, Implemented uniform navbar and footer - #125
[ECWoC] Fixed Profile Picture not loading Error, Implemented uniform navbar and footer#125ShivanshCoding36 wants to merge 3 commits into
Conversation
Update profile image URL logic to use a new default image as location of the previous default image has changed.
|
@ShivanshCoding36 is attempting to deploy a commit to the Sahil's projects Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @ShivanshCoding36, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses two key areas: resolving a bug related to default profile picture loading and enhancing UI consistency across the application's legal pages. The changes ensure that users with default avatars see the correct image and that the Privacy Policy and Terms of Service pages now utilize the same standardized navigation and footer components as the main site, providing a more cohesive user experience. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Hi maintainers |
There was a problem hiding this comment.
Code Review
This pull request aims to fix a profile picture loading error and unify the navigation and footer on legal pages. A critical security vulnerability was identified where links in the new navbar component use insecure http:// protocols, potentially exposing users to man-in-the-middle attacks. It is recommended to update these URLs to https://. Additionally, the implementation for the uniform navbar introduces critical code quality issues due to extensive JSX duplication in PrivacyPolicy.jsx and Terms.jsx, leading to runtime errors from missing imports and undefined variables. The profile picture fix also has minor code quality improvements.
| </div> | ||
| </div> | ||
| </div> | ||
| </header>> |
| {/* API Docs Icon */} | ||
| <div className="relative group ml-3"> | ||
| <a | ||
| href="http://docs.travelbook.sahilfolio.live/" |
There was a problem hiding this comment.
The link to the API documentation uses an insecure http:// protocol, exposing users to man-in-the-middle attacks. All external links should use https:// for encrypted connections. Additionally, this section is part of a large duplicated JSX block for the navigation bar, which introduces significant code duplication and critical errors, including undefined navigate function calls and unimported components like MdGroup and AiOutlineCloudServer. Please refactor this into a shared Navbar component and ensure all dependencies are correctly imported and hooks are initialized.
| href="http://docs.travelbook.sahilfolio.live/" | |
| href="https://docs.travelbook.sahilfolio.live/" |
| {/* API Docs Icon */} | ||
| <div className="relative group ml-3"> | ||
| <a | ||
| href="http://docs.travelbook.sahilfolio.live/" |
There was a problem hiding this comment.
The link to the API documentation uses an insecure http:// protocol, exposing users to man-in-the-middle attacks. All external links should use https:// for encrypted connections. Similar to PrivacyPolicy.jsx, this section is part of a large duplicated JSX block for the navigation bar, leading to code duplication and critical errors, including undefined navigate function calls and unimported components like MdGroup and AiOutlineCloudServer. Please refactor this to use a shared Navbar component and fix the missing imports and hook initializations.
| href="http://docs.travelbook.sahilfolio.live/" | |
| href="https://docs.travelbook.sahilfolio.live/" |
| {/* Medium Blog Icon */} | ||
| <div className="relative group ml-3"> | ||
| <a | ||
| href="http://medium.travelbook.sahilfolio.live/" |
There was a problem hiding this comment.
The link to the Medium blog uses an insecure http:// protocol. This exposes users to man-in-the-middle attacks, where an attacker could intercept or modify the content. All external links should use https:// to ensure an encrypted, secure connection.
| href="http://medium.travelbook.sahilfolio.live/" | |
| href="https://medium.travelbook.sahilfolio.live/" |
| {/* Medium Blog Icon */} | ||
| <div className="relative group ml-3"> | ||
| <a | ||
| href="http://medium.travelbook.sahilfolio.live/" |
There was a problem hiding this comment.
The link to the Medium blog uses an insecure http:// protocol. This exposes users to man-in-the-middle attacks, where an attacker could intercept or modify the content. All external links should use https:// to ensure an encrypted, secure connection.
| href="http://medium.travelbook.sahilfolio.live/" | |
| href="https://medium.travelbook.sahilfolio.live/" |
| @@ -1,15 +1,27 @@ | |||
| import React from 'react'; | |||
| import {React,useEffect} from 'react'; | |||
There was a problem hiding this comment.
useEffect is imported but not used in this component. Unused imports should be removed to keep the code clean. Additionally, the import syntax import {React,useEffect} from 'react'; is non-standard. It should be import React from 'react'; since useEffect is not used.
| import {React,useEffect} from 'react'; | |
| import React from 'react'; |
| const defaultOld = | ||
| 'https://res.cloudinary.com/travel-book/image/upload/v1720536854/travel_book/default-avatar.png'; | ||
|
|
||
| const defaultNew = | ||
| 'https://travelbook.devbysahil.com/avatar-default.png'; | ||
|
|
||
| const profileImageUrl = | ||
| userInfo?.profileImage === defaultOld | ||
| ? defaultNew | ||
| : userInfo?.profileImage; |
There was a problem hiding this comment.
The constants defaultOld and defaultNew are re-declared on every render. Since they are true constants, they should be defined outside the component scope to prevent unnecessary re-computation on each render. It's also a common practice to name such constants in UPPER_SNAKE_CASE and centralize them in a constants file for better maintainability.
Pull Request Description
Summary
This PR improves UI consistency and fixes the default avatar image issue caused by a backend URL mismatch. It removes hardcoded layout elements and switches policy pages to use shared layout components.
Type of Change
Please delete options that are not relevant:
Motivation and Context
The backend still returns the old default avatar URL, which is no longer exsisting and is replaced with the new url
Some static pages (Privacy Policy / Terms & Conditions) were using hardcoded Navbar and Footer instead of the shared components used across the app.
Changes Made
1) Default Avatar Fix
2) Layout Consistency Improvements
Screenshots (if applicable)
If your changes include UI modifications, please add before and after screenshots:
Before:
1)
2)
After:
1)
2)
Testing
Code Quality
Deployment
Contributor Checklist
For Maintainers