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

#1061 - have menu open by default no matter if you're logged in or not #1065

Merged
merged 3 commits into from
May 20, 2022

Conversation

louise-davies
Copy link
Member

Description

Basically I just removed the check for logged in users (and also for the login page as I figured we can just have the menu open everywhere by default for simplicity). Also stopped the drawer from closing on token invalidation.

Testing instructions

  • Review code
  • Check Actions build
  • Review changes to test coverage
  • Use server with no autoLogin (e.g. DLS preprod) and the menu is visible by default when logged out

Agile board tracking

Closes #1061

@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #1065 (5bc18fc) into develop (77e5f52) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1065      +/-   ##
===========================================
- Coverage    97.94%   97.93%   -0.01%     
===========================================
  Files           42       42              
  Lines         1555     1551       -4     
  Branches       421      418       -3     
===========================================
- Hits          1523     1519       -4     
  Misses          31       31              
  Partials         1        1              
Impacted Files Coverage Δ
src/state/reducers/scigateway.reducer.tsx 100.00% <ø> (ø)
src/mainAppBar/mainAppBar.component.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77e5f52...5bc18fc. Read the comment docs.

Copy link
Contributor

@sam-glendenning sam-glendenning left a comment

Choose a reason for hiding this comment

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

Generally happy with this but I was thinking about more scenarios about when the user might want the nav menu open, since the issue wants to address moments when the user might feel a bit lost or unsure about where to navigate to. So here's a few questions:

  1. On successful login, the nav menu remains in the same state after redirection. Do we want it to always open instead? This could aid in the times the user is redirected back to the home page and may not know where to go from there but could interfere with the user's explicit choice to close the nav menu and keep it closed.
  2. Similarly on logout, user is redirected to homepage and the nav menu remains in the same state. Do we want it to always open in this case? In this instance, the user is effectively being returned to the same state that they arrived at the site, i.e. not logged in and viewing the homepage. Therefore, do we want the menu open like before?
  3. Finally, a small possible addition. When the user arrives at a 404 page, the nav menu successfully opens (expected behaviour) but we aren't explicitly checking for this in the 404 page e2e test 'should load 404 page correctly'. Should we add a line to check for it here? Or is this covered by the following test, 'page refresh should open the navigation drawer'?

@sam-glendenning
Copy link
Contributor

On a small unrelated note, another thing I just noticed - redirection back to a protected route after successful login works fine for plugins but doesn't for SciGateway routes. For example, let's say the user is on the help page and not logged in. They successfully sign in but are redirected to the homepage instead of back to the help page. Do we want this to happen? If not, we can make a separate issue perhaps.

@louise-davies
Copy link
Member Author

@sam-glendenning

I think we don't want to overcomplicate things with the menu. Currently, all we do is have the menu open when the site loads. If a user then shuts it, they presumably know how to open and close the menu at that point so I don't think we should auto open it after login etc.

I don't think we need to check it on the 404 page test as it's not really a test of the 404 page - the menu is now open in all circumstances after the site loads so that includes the 404 page.

As for your latter point, the user isn't redirected from the help page to the login page. The login redirect is to solve the use case of "user clicks on a link, user is unauthenticated so goes to login page, once logged in user should be back at the page the originally clicked on", whereas if a user logs in after visiting the help it's because they've explicitly navigated to the login page via the button. We can redirect in that case as well but it's less clear cut - for example a lot of apps would just direct you to their homepage at that point but some would redirect you back to the page you were previously viewing.

Copy link
Contributor

@sam-glendenning sam-glendenning left a comment

Choose a reason for hiding this comment

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

You've convinced me! You're right, it's easy to get carried away with all the times one random person might like a particular thing behaving a particular way. I'll approve

@louise-davies louise-davies merged commit 4660cc7 into develop May 20, 2022
@louise-davies louise-davies deleted the feature/anon-homepage-menu-open-#1061 branch May 20, 2022 07:33
@louise-davies louise-davies added the enhancement New feature or request label Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nav menu not open on homepage when not logged in
2 participants