Skip to content

MobileNav component for smaller devices #2361

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

Merged
merged 49 commits into from
Aug 15, 2023

Conversation

dewanshDT
Copy link
Collaborator

@dewanshDT dewanshDT commented Aug 7, 2023

This PR is a part of the mobile responsive project

Changes:
added a MobileNav component to be used in smaller devices and, modified the Nav component to use the component in smaller screens.

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.

@dewanshDT dewanshDT self-assigned this Aug 7, 2023
@dewanshDT dewanshDT requested a review from lindapaiste August 7, 2023 09:39
Copy link
Collaborator

@lindapaiste lindapaiste 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 coming along great! IMO we should clean it up a bit before merging.

opacity: 0;
transform-origin: top;
transition: opacity 100ms;
transition: transform 100ms 200ms;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think if you have two transition lines that the second overrides the first? It should be one line with both transitions in it.

The transitions are really nice though! Good work ⭐

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

got it! replaced it with a single line, transition: opacity 100ms, transform 100ms 200ms;

Copy link
Collaborator

Choose a reason for hiding this comment

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

transform 100ms 200ms -- that's a delay of 200ms and then 100ms for the scale transform. So the opacity transition will have completed (from 0-100ms) before the transform starts (from 200-300ms). When opening you will only see the transform and when closing you will only see the opacity. Seems like that's probably not what you intended? Maybe should be 100ms for both with no delay? If we want different transitions for opening vs closing we could use react-transition-group.

default:
return 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.

I don’t love this switch based on location. It feels a bit fragile, like if we were to add a new page or change a path or something we would have to change it here as well. Perhaps the alternative is that each page which includes the Nav specifies a mobileTitle prop which we pass down. Like <Nav layout=“dashboard” mobileTitle={t(‘Login’)} />.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah that's better, will update it in the future for sure, added a TODO

<Nav />
<Header
syncFileContent={this.syncFileContent}
key={this.props.project.id}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this key prop actually does anything? I see it’s part of the existing code. It doesn’t hurt to leave it but I strongly suspect that it’s useless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should I remove it?


Button: {
primary: {
default: {
foreground: colors.black,
foreground: grays.mediumDark,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change will have implications on all button text colors throughout the app. Is that what we want? @shujuuu Probably yes but I want to double check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah this is should be discussed

},
secondary: {
foreground: colors.black,
background: grays.mediumLight
Copy link
Collaborator

Choose a reason for hiding this comment

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

If secondary is its own complete object then does it need a border color?

If the only difference between primary and secondary (and potential tertiary) is the background color and the rest is the same then maybe we structure it a bit differently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in mobile Panel we don't have borders, I'll check though

@dewanshDT dewanshDT requested a review from lindapaiste August 10, 2023 00:34
@lindapaiste
Copy link
Collaborator

lindapaiste commented Aug 10, 2023

It seems like the "Find" command isn't working. It's very strange because "Tidy Code" does work. I confirmed that the Editor showFind() method is getting called. It's the internal codemirror part (this._cm.execCommand('findPersistent');) which isn't doing anything.

This could be a real rabbit hole so I will look into it. It seems like the modal is appearing but somehow it's inside of the nav bar and not visible.

image

Edit: turns out it's just a z-index/positioning issue. Let's add a media query to the _editor.scss file to override the top property of the .CodeMirror-dialog at the same breakpoint where the MobileNav appears. Maybe ~100px down from the top? We need to work on the dialog itself but that's a future problem. It will be usable on tablet sizes if we fix the top position.

<button onClick={newSketch}>{t('Nav.File.New')}</button>
</li>
<li>
<button onClick={() => saveSketch(cmRef.current)}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

On the desktop nav we have some conditions to hide the "Save" button if the user is not logged in, so we should probably do that here.

Although the usability for clicking it when logged out is pretty decent, it opens a modal telling me to log in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like that we're showing the modal to log in instead of hiding the save button when the user is not logged in, what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I kind of like it too 🤷 Let's keep it for now but I don't like having different logic on mobile vs desktop. When you get a chance maybe you can open an issue for discussion on how we should handle this. Like whether we should show the "Save" option on desktop and have it open the modal.

We could also def make that modal nicer. Emphasize the "Log In" action (maybe a big button?) and use a friendlier title than "Error".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah I agree In the future we should make it nicer by adding a welcoming message with a login button to continue

@lindapaiste
Copy link
Collaborator

A couple minor style things. Probably to save for later.

  • The box-shadow seems like a lot. Do we want just a border-bottom?

  • The account icon could be a little bit smaller.

  • The top of the menu should probably be aligned with the bottom of the nav bar instead of overlapping it.

  • We should think about how the user gets to the bottom of the menu when on a short screen (a phone in landscape mode). Right now it will scroll the whole page down. We may want a max-height on the menu of calc(100vh - barHeightpx) and an overflow: auto so that the menu can scroll independent of the page.

  • If it's easy, we should hide the account menu when on the login page because clicking it won't do anything.

@dewanshDT dewanshDT requested a review from lindapaiste August 11, 2023 19:29
@dewanshDT
Copy link
Collaborator Author

dewanshDT commented Aug 12, 2023

@lindapaiste, I just added an overlay to select language, please have a look, it also indicates the selected language.

image

@dewanshDT
Copy link
Collaborator Author

hey @lindapaiste, added the use of ProjectName, please check it out.

image

@lindapaiste
Copy link
Collaborator

hey @lindapaiste, added the use of ProjectName, please check it out.

image

Looking just like the mockups!

className={classNames({
'current-language': label === languageKeyToLabel(language)
})}
aria-label={label}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I need to read up on ARIA best practices because I don't know if it's necessary to have an aria-label when it's the same as the text content of the button. But we'll leave it for now.

Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

You did it! 🥳 🎊 We've fixed all of the major usability issues and I think it's ready to go! This will be such a huge improvement for our mobile users. Next up...the IDE screen.

@lindapaiste
Copy link
Collaborator

@raclim We've been through a lot of revisions on this PR and we've gotten it to a point where it makes a lot of things better and doesn't make anything worse. There is still a lot to be improved, but it's ready to release!

@lindapaiste lindapaiste merged commit f040067 into processing:develop Aug 15, 2023
@raclim
Copy link
Collaborator

raclim commented Aug 16, 2023

This is super amazing!!! It looks really awesome so far and I think it'll definitely gain a lot of traction from users over the next few weeks, especially as students start going back to school! Thanks again to you both for all of your work! :)

I'll try to merge in #2306, #2052, and #2362 as well before starting the process for the next release, and will give an update when that's happening. Please let me know if you both feel otherwise or would prefer to prioritize any others!

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

Successfully merging this pull request may close these issues.

3 participants