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

Refactored Header/MobileNav.jsx with all Todos #3312

Closed

Conversation

Rajnish2105
Copy link

Refactor: Updated "MobileNav.jsx" file with all the todos

Changes:

  1. remove the switch and use a props like mobileTitle
    Now component accepts the mobileTitle prop (handled default value and prop type)
    An update to PR Refactor MobileNav for handling mobile title more efficiently #3310
  2. use selectRootFile selector
  3. add translations to overlay attributes (title, arialabel)
  4. Add Translations to Settings menuitem in mobilenav

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

const project = useSelector((state) => state.project);
const user = useSelector((state) => state.user);

const { t } = useTranslation();
// console.log('The title: ', title);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, we want to isolate changes in each pull request to tie as much to the original issue as possible. In most scenarios, we recommend not having pull requests build on top of another and create dependencies on each other.

Copy link
Author

Choose a reason for hiding this comment

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

By update i meant i started from scratch but worked on the same problem, just with a different idea in mind.
i didn't used any code from previous pull request.

const rootFile = useSelector(
(state) => state.files.filter((file) => file.name === 'root')[0]
);
// DONE
Copy link
Collaborator

Choose a reason for hiding this comment

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

If a comment is addressed, the original one can simply be deleted!

@@ -244,7 +249,7 @@ const MobileNav = () => {
)}
</Title>
{/* check if the user is in login page */}
{pageName === 'login' || pageName === 'signup' ? (
{pageName === 'LoginView.Login' || pageName === 'LoginView.SignUp' ? (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Replacing hardcoded strings is a great move here!

@@ -266,7 +271,7 @@ const MobileNav = () => {
</Link>
</div>
)}
{pageName === 'home' ? (
{pageName === 'home' || pageName === project.name ? (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could probably look more lik {pageName === project.name ? ( to remove the hardcoded string!

const isMobile = useIsMobile();

// console.log('The updated mobile title is: ', mobileTitle);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We would ideally want to remove commented out logs!

@raclim
Copy link
Collaborator

raclim commented Feb 7, 2025

I'm sorry, as mentioned in your other PR, we ideally want to accept pull requests that are tied to an issue. However, I appreciate the consideration for accessibility and attention to what the repository might be needing! I also added in a few comments regarding what potential changes might look like. I'm sorry again that we couldn't get this in, but please feel free to check out the issues within this repository!

@raclim raclim closed this Feb 7, 2025
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.

2 participants