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

Add navigation bar and logout #109

Merged
merged 1 commit into from
Oct 7, 2022
Merged

Add navigation bar and logout #109

merged 1 commit into from
Oct 7, 2022

Conversation

jacobtylerwalls
Copy link
Contributor

@jacobtylerwalls jacobtylerwalls commented Oct 6, 2022

Overview

Implement a navigation bar with logout. Placeholders for selected and available utilities for now.

Closes #85

Demo

Submissions activity
localhost_4545_submissions_42

Draw activity (update: settings icon removed)
localhost_4545_draw (1)

Notes

Minor nit: the updated wireframe says "Save & Back" but the prior draw tool had "Save and back". I opted for the existing wording "Save and back" to match "Review and submit".

Settings button is just a placeholder.

Testing Instructions

  • scripts/server
  • Visit draw activity
    • Ensure static utility label
    • Check styling against wireframe
    • Ensure save and back button navigates to submissions
  • Visit submissions activity
    • Ensure utility selector
    • Check styling against wireframe
    • Ensure log out button is functional
  • Verify welcome tool has no nav bar
  • Check Draw tool sidebar no longer has its own title bar
  • Sanity check draw and welcome tools for regressions

Checklist

  • fixup! commits have been squashed
  • CHANGELOG.md updated with summary of features or fixes, following Keep a Changelog guidelines
  • README.md updated if necessary to reflect the changes
  • CI passes after rebase

Copy link
Contributor

@mstone121 mstone121 left a comment

Choose a reason for hiding this comment

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

Looks good, a few minor comments.

I'm noticing that navigating back to the submissions page after adding a reference image isn't working. This seems unrelated to your changes though (and would probably happen in dev if there were a link to test it with).


import PrivateRoute from './components/PrivateRoute';

const privateRoutes = (
<PrivateRoute>
<Routes>
<Route path='/welcome' element={<Outlet />} />
Copy link
Contributor

Choose a reason for hiding this comment

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

🆒

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I found that this was the way to suppress warnings about "are you sure you want to render nothing".

import { useLocation, useNavigate } from 'react-router-dom';
import { ArrowLeftIcon, CogIcon, LogoutIcon } from '@heroicons/react/outline';
import apiClient from '../api/client';
import { API_URLS, NAVBAR_HEIGHT, NAVBAR_VARIANTS } from '../constants';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does having NAVBAR_VARIANTS in constants.js as opposed to here offer any benefit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably nah!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved out in 31559a2

Comment on lines 104 to 110
<IconButton
icon={<Icon as={CogIcon} />}
aria-label='Settings'
onClick={() => {
navigate('/settings');
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

From the wireframes, it seems like the settings icon should not be visible on the draw page.

Screen Shot 2022-10-06 at 4 53 55 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, right, thanks. 9309e80

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a feeling this might be added back in #94, but we can future that.

@jacobtylerwalls
Copy link
Contributor Author

jacobtylerwalls commented Oct 7, 2022

I'm noticing that navigating back to the submissions page after adding a reference image isn't working. This seems unrelated to your changes though (and would probably happen in dev if there were a link to test it with).

Good spot. I can reproduce on develop by clicking back button from draw page back to welcome (after having uploaded a ref image). I'll open an issue. Sourced it to 1d43bbe.

Copy link
Contributor

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

This is looking good! Left a couple minor code comments.

Comment on lines 28 to 29
setSelectedUtility: (state, { payload: utility }) => {
state.selectedUtility = utility;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making this more consistent:

Suggested change
setSelectedUtility: (state, { payload: utility }) => {
state.selectedUtility = utility;
setSelectedUtility: (state, { payload: selectedUtility }) => {
state.selectedUtility = selectedUtility;

Comment on lines 117 to 118
{maybeSettingsButton}
{exitButton}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these (and utilitySelectOrLabel) be decomposed into their own components in this file?

It would make the NavBar component easier to read. We will have to call some hooks twice (useDispatch, useNavigation), but hopefully React optimizes that under the hood enough to not matter.

I'm thinking something like this:

<Flex align='center' gap={4}>
    <Spacer />
    <SettingsButton variant={variant} />
    <ExitButton variant={variant} />
</Flex>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that a lot. What do you think about including dispatch as a prop? d21cac6

Copy link
Contributor

Choose a reason for hiding this comment

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

My preference is for the hook because it reduces the dependecy between components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

Copy link
Contributor

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

Looking good! 😎

);
}

export default function NavBar() {
Copy link
Contributor

Choose a reason for hiding this comment

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

One final comment: Can we move the NavBar component to be the first in this file? So we don't have to scroll all the way down to see the main component. Can scroll down optionally to see detailed implementations of sub-components.

@jacobtylerwalls
Copy link
Contributor Author

Thanks for the reviews!

@jacobtylerwalls jacobtylerwalls merged commit cb36c72 into develop Oct 7, 2022
@jacobtylerwalls jacobtylerwalls deleted the jw/logout-bar branch October 7, 2022 20:55
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.

Clarify and Build Navigation Sidebar, Implement Sign out
3 participants