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 waypoints list and add stop button #23698

Merged
merged 42 commits into from
Aug 11, 2023
Merged

Add waypoints list and add stop button #23698

merged 42 commits into from
Aug 11, 2023

Conversation

neil-marcellini
Copy link
Contributor

@neil-marcellini neil-marcellini commented Jul 26, 2023

Details

Fixed Issues

$ #22700
PROPOSAL: N/A

Tests

  1. Sign in with an @expensifail.com account
  2. Click the green plus, request money
  3. Click the distance tab
  4. Verify that you see start and stop waypoints only, and an add stop button
  5. Click add stop
  6. Verify a stop is added
  7. Add two more stops for a total of 5
  8. Verify the bottom waypoint is fading out
  9. Scroll down to the bottom
  10. Verify the bottom waypoint is not faded
  11. Close the modal
  12. Click the green plus, request money
  13. Verify the distance tab is still selected and there are 5 waypoints
  • Verify that no errors appear in the JS console

Offline tests

Sign in then go offline and run the tests above

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
Chrome.mov
Mobile Web - Safari
Safari.mp4
Desktop
desktop.mov
iOS
ios.mov
Android
Android1.mov

@neil-marcellini neil-marcellini self-assigned this Jul 26, 2023
@neil-marcellini
Copy link
Contributor Author

@shawnborton may I please have an early review of this? Here's what I have so far. Do you have any recommendations?

May I please also have the following icons as .svg files? The "hamburger" Expensicon for the drag handles on the waypoints and the Maki icon "marker". I think we should use a filled white dot for the start waypoint, (or maybe a white circle), the gray dot for the stops, and a gray (or red?) marker for the finish. I think it's nice to be able to match them up between the waypoints in the list and the icons on the map in the future.

Screen.Recording.2023-08-02.at.5.58.32.PM.mov

Oooh I think it looks a bit better with a gradient from transparent to the background color vs black.

Screen.Recording.2023-08-02.at.6.12.58.PM.mov

@shawnborton
Copy link
Contributor

Will work on getting the icons now.

A couple of questions in the meantime:

  • If there is no map, why does this only take up half of the screen height?
  • For the icons you requested, I'll give them all to you in pure black and then we can control colors via styling
  • For the "Add Stop" button, the icon in the button should use our icon color
  • The top tabs are not updated to match our latest styles. I think @AndrewGable updated these recently with the SmartScan project.

@shawnborton
Copy link
Contributor

Also, looks like you are using the wrong icon for drag handles in your mocks - we have an icon for drag handles already:
image

Here are the icons you need though: distanceicons.zip

You can use the dot indicator icon that already exists for the circle.

@neil-marcellini
Copy link
Contributor Author

  • If there is no map, why does this only take up half of the screen height?

There will be a map in the future so I want to set it up for that now. It's behind a beta so no one will see this until it's complete anyways.

  • The top tabs are not updated to match our latest styles. I think @AndrewGable updated these recently with the SmartScan project.

Yeah copy that, I'll get it updated soon.

we have an icon for drag handles already

Ah ok. Thanks for sending the icons!

All the other points sounds good and I'll get them updated and check with you again. I'm thinking that I should reduce the spacing around the dot icon to make it match the mock more closely, do you agree?

@shawnborton
Copy link
Contributor

Let's try without modifying the icon size so we can keep them all consistent at 20x20. If we need to make a new dot indicator (smaller), we totally can. But let's first go with consistency.

@neil-marcellini
Copy link
Contributor Author

Ok I added the new icons and it's looking pretty good. I want to differentiate the start waypoint from the stops based on the icon. The white filled circle doesn't really work because that's the color when an icon is hovered.
image

Would you please send me a circle icon that's like the dot indicator but unfilled? I think that would look good for the start icon, matching the color of the others.

@neil-marcellini
Copy link
Contributor Author

👀

@neil-marcellini
Copy link
Contributor Author

Fade-out shade looks different on iOS

I don't know if that's a large enough difference to be worth investigating and fixing it right now. I would like to leave it as is. Maybe we do a follow up though if it's a problem? What do you think @shawnborton?

@neil-marcellini
Copy link
Contributor Author

Are the drag handles supposed to be green? I had this from our mockups:

Yeah I saw that the mockup is different but I think it makes sense to change in this use case.

I would think all standard icons use our default icon color. I could see giving the waypoint icons a slightly different color to make them look a bit different since they are more like labels and less like icon buttons though.

The drag handle icon is passed to the menu item component without specifying an iconFill so it is using the default color in the context of that component.

<MenuItemWithTopDescription
description={translate(descriptionKey)}
icon={Expensicons.DragHandles}
secondaryIcon={waypointIcon}
secondaryIconFill={theme.icon}
shouldShowRightIcon
key={key}
/>

In the component we set the color based on the user's interaction, and that's fairly complicated. Overall I think we should leave the drag handle icons with their color based on the interaction on it. I think it makes sense to set a static color on the waypoint icons because they aren't interactive.

{props.iconType === CONST.ICON_TYPE_ICON && (
<Icon
src={props.icon}
width={props.iconWidth}
height={props.iconHeight}
fill={
props.iconFill ||
StyleUtils.getIconFillColor(
getButtonState(props.focused || isHovered, pressed, props.success, props.disabled, props.interactive),
true,
)
}
/>
)}

Do you agree with that or do you think about it differently @shawnborton?

@neil-marcellini
Copy link
Contributor Author

Thanks for the feedback. I responded to everything here and I would appreciate another review.

<ScrollView
onContentSizeChange={(width, height) => setScrollContentHeight(height)}
onScroll={updateGradientVisibility}
scrollEventThrottle={16}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this value need to be a CONST?

export default withOnyx({
// We must provide a default value for transactionID here, otherwise the component won't mount
// because withOnyx returns null until all the keys are defined
transactionID: {key: ONYXKEYS.IOU, selector: (iou) => (iou && iou.transactionID) || ''},
Copy link
Collaborator

Choose a reason for hiding this comment

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

NAB, could use lodashGet

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

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

LGTM. Tests pass well!

Just a couple of NABS

Comment on lines +153 to +154

baseMenuItemHeight: 64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

NAB

  1. Why not use the existing optionRowHeight or listItemHeightNormal
  2. If it's specific to a component why do we have a generic name baseMenuItemHeight?
  3. Unnecessary line break

@melvin-bot melvin-bot bot requested a review from MariaHCD August 10, 2023 00:56
@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

@MariaHCD Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@Santhosh-Sellavel
Copy link
Collaborator

Fade-out shade looks different on iOS

I don't know if that's a large enough difference to be worth investigating and fixing it right now. I would like to leave it as is. Maybe we do a follow up though if it's a problem? What do you think @shawnborton?

@neil-marcellini We should have a follow-up for this, as it is inconsistent something that we need to address. It's not pressing here but let's just create an issue ourselves to save some bounty on reporting, thanks!

@shawnborton
Copy link
Contributor

Do you agree with that or do you think about it differently

I think that makes sense, but do you have updated screenshots I can review? Again, I think the drag handles should just use our standard icon color and we can make the waypoint icons use something else.

@thienlnam thienlnam mentioned this pull request Aug 11, 2023
57 tasks
@thienlnam
Copy link
Contributor

Neil is OOO today, but this PR is blocking a couple other PRs from making progress so going to help push this forward

Screenshot 2023-08-11 at 11 00 13 AM

These are the current screenshots

@thienlnam
Copy link
Contributor

I created a follow up issue here to have the fade out shade addressed #24447 along with the other NAB comments that Santhosh-Sellavel left.

I'm going to merge this since it seems like the concerns are addressed except for the color of the drag handles. I'll then address the drag handles color change in my PR and ideally get that merged today so it should be live at the same time.

This just allows me to unblock the other PRs that are held on this since we're still aiming to get this done by a deadline but should not affect design quality

@thienlnam thienlnam merged commit a31412a into main Aug 11, 2023
@thienlnam thienlnam deleted the neil-waypoints-list branch August 11, 2023 18:07
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/thienlnam in version: 1.3.54-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/thienlnam in version: 1.3.54-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.54-13 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

6 participants