App icon indicating copy to clipboard operation
App copied to clipboard

fix add center button and blue dot

Open nkdengineer opened this issue 10 months ago • 33 comments

Details

Fixed Issues

$ https://github.com/Expensify/App/issues/40209 PROPOSAL: https://github.com/Expensify/App/issues/40209#issuecomment-2053922914

Tests

  • [x] Verify that no errors appear in the JS console

Offline tests

QA Steps

  • [x] Verify that no errors appear in the JS console

PR Author Checklist

  • [x] I linked the correct issue in the ### Fixed Issues section above
  • [x] I wrote clear testing steps that cover the changes made in this PR
    • [x] I added steps for local testing in the Tests section
    • [x] I added steps for the expected offline behavior in the Offline steps section
    • [x] I added steps for Staging and/or Production testing in the QA steps section
    • [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • [x] 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)
    • [x] 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).
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I ran the tests on all platforms & verified they passed on:
    • [x] Android: Native
    • [x] Android: mWeb Chrome
    • [x] iOS: Native
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] 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)
  • [x] I followed proper code patterns (see Reviewing the code)
    • [x] 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)
    • [x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] 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.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • [x] 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:
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] 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 either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • [x] 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.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I followed the guidelines as stated in the Review Guidelines
  • [x] 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)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] 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
  • [x] I verified that if a function's arguments changed that all usages have also been updated correctly
  • [x] If any new file was added I verified that:
    • [x] 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
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • [x] 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.
  • [x] 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)
  • [x] 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.
  • [x] 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.
  • [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [x] 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.
  • [x] 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

nkdengineer avatar Apr 23 '24 09:04 nkdengineer

Below is how it looks in web and native:

  • In web:

https://github.com/Expensify/App/assets/161821005/5a11daa7-768f-4bb2-84d5-05f262b60b4a

  • In native:

https://github.com/Expensify/App/assets/161821005/a307e099-cb0b-410b-9497-28990769fe3c

nkdengineer avatar Apr 23 '24 09:04 nkdengineer

@parasharrajat 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]

melvin-bot[bot] avatar Apr 23 '24 09:04 melvin-bot[bot]

Please attach videos for all platforms.

parasharrajat avatar Apr 23 '24 09:04 parasharrajat

@Expensify/design Can you please review the design for this change and share you feedback?

parasharrajat avatar Apr 23 '24 09:04 parasharrajat

I'll take it internally and come back to you :)

dubielzyk-expensify avatar Apr 23 '24 09:04 dubielzyk-expensify

@parasharrajat I just resolved a few comments. Others should be resolved after we have the design.

nkdengineer avatar Apr 23 '24 10:04 nkdengineer

Let's for for design feedback.

parasharrajat avatar Apr 23 '24 10:04 parasharrajat

@dubielzyk-expensify any updates?

parasharrajat avatar Apr 23 '24 20:04 parasharrajat

We're back with updates! 😄 Here's the intended design:

CleanShot 2024-04-24 at 10 32 41@2x

Adding the button:

This should be using the icon button component size: medium. It should also be anchored in the bottom right overlaying the map with a 20px padding from the edge of the map:

image

Adding the icon

We're using a new icon called crosshair.svg that needs to be checked into our repo. Here's the button: crosshair.svg.zip

Showing the button:

So ideally we actually want the button only to show once the map isn't centered. So imagine:

  1. The route is shown after the origin + destination has been entered
  2. User drags the map
  3. Then we show the button cause the map isn't centered
  4. User taps center button and it fades away. There should be a fade animation btw, not just appear/disappear.

If we can't do this, then showing the button at all times is fine. The other alternative here is to change the icon based on if it's centered or not: CleanShot 2024-04-24 at 10 37 12@2x

Let us know what's doable here 😄

dubielzyk-expensify avatar Apr 24 '24 00:04 dubielzyk-expensify

  • @dubielzyk-expensify Can you give me the radius and the background color code of the center button? Currently, the Crosshair.svg you supplied above is just:

image

  • Also, as you can see in staging, there was a native icon "!" at the bottom right. If we add a "center-me" to the bottom right, that native icon will be overridden:

image

nkdengineer avatar Apr 24 '24 03:04 nkdengineer

Shouldn't need to specify a button color as this is our regular IconButton component that's found elsewhere in the app:

CleanShot 2024-04-24 at 14 25 04@2x

It should use default values. That goes for the icon too.

Also, as you can see in staging, there was a native icon "!" at the bottom right. If we add a "center-me" to the bottom right, that native icon will be overridden:

Ahh good call. Maybe just put it in the top right for now. I assume we need that button for terms reasons with Mapbox.

dubielzyk-expensify avatar Apr 24 '24 04:04 dubielzyk-expensify

@Expensify/design and @grgia , do you know what the icon button component is called?

dubielzyk-expensify avatar Apr 24 '24 04:04 dubielzyk-expensify

@nkdengineer

  1. As mentioned there is an IconButton component in the app, please use that.
  2. There should be a mechanism to push the button on the map layer in a way that it does not overlap.
  3. Button should be pushed into a map layer not fixated over it with CSS.

So ideally we actually want the button only to show once the map isn't centered.

We should be able to do it.

parasharrajat avatar Apr 24 '24 06:04 parasharrajat

There should be a mechanism to push the button on the map layer in a way that it does not overlap

@parasharrajat I cannot find a way to do that because the "!" icon is also displayed on the top of the map image

nkdengineer avatar Apr 24 '24 08:04 nkdengineer

@dubielzyk-expensify we use <Button> or <Icon> in App right now

grgia avatar Apr 24 '24 09:04 grgia

Maybe we can use https://visgl.github.io/react-map-gl/docs/api-reference/use-control to add a new control. If you pass bottom-right position it should automatically be placed above the other buttons.

parasharrajat avatar Apr 24 '24 09:04 parasharrajat

@nkdengineer Any updates?

parasharrajat avatar Apr 24 '24 18:04 parasharrajat

I am trying to implement your suggestion here. It works well with the built-in control (MapboxDraw), but the custom react component

nkdengineer avatar Apr 25 '24 00:04 nkdengineer

With the current code change, here is how it looks:

  • In native:

https://github.com/Expensify/App/assets/161821005/a55a4b3e-57dd-466a-bd30-ae312f6b80dc

  • In web:

https://github.com/Expensify/App/assets/161821005/5d8e1ce6-23f2-43c6-969d-c6659f8dd944

nkdengineer avatar Apr 25 '24 02:04 nkdengineer

Out of curiosity, what's the story behind the blue dot? Is that something we added? Do we have full control over its styling? When does it show up and when does it not show up?

shawnborton avatar Apr 25 '24 11:04 shawnborton

Out of curiosity, what's the story behind the blue dot? Is that something we added? Do we have full control over its styling? When does it show up and when does it not show up?

it shows the current location of the user on the Map. Yes, we have full control over it.

I think it shows forever for now. @nkdengineer can clarify this.

parasharrajat avatar Apr 25 '24 19:04 parasharrajat

This is looking awesome. For the recording it looks like the "center" button shows up before you've moved the map on the first go, can we remove this? So that it doesn't show when the map is centered on route or blue dot?

dubielzyk-expensify avatar Apr 26 '24 02:04 dubielzyk-expensify

@dubielzyk-expensify I fixed your comment. Here is what it looks like now:

https://github.com/Expensify/App/assets/161821005/472cf068-a7f8-4d8a-8b1e-43ce2f9c58df

nkdengineer avatar Apr 26 '24 11:04 nkdengineer

@parasharrajat Please help review PR when you have time. Thanks

nkdengineer avatar Apr 26 '24 11:04 nkdengineer

@parasharrajat -- What is your ETA for review?

quinthar avatar Apr 26 '24 16:04 quinthar

Reviewing

parasharrajat avatar Apr 27 '24 11:04 parasharrajat

BUG: Web: Clicking on the center button does not animate the user to the current position like it does when selecting the first waypoint. We should ease this a bit.

https://github.com/Expensify/App/assets/24370807/ea58b9a7-5fdf-4a11-b9f4-b055e5500953

parasharrajat avatar Apr 27 '24 12:04 parasharrajat

BUG: Web: When we select a waypoint, the map moves to that point but the center button is not visible until I move the map.

Also, I am not sure of the correct behaviour here.

  1. Should this highlight the single waypoint?
  2. Or take the user to center.

Also, there is no way for the user to easily go back to the waypoint location after moving to center. @dubielzyk-expensify Could you please help us determine this?

parasharrajat avatar Apr 27 '24 12:04 parasharrajat

BUG: web: when we have selected two waypoints and we press center button, it zooms the map.

It shouldn't as we are already showing both points and the map should keep the same zoom level.

https://github.com/Expensify/App/assets/24370807/e322a43d-4cb8-4d36-ba2b-cdf990fcafcb

parasharrajat avatar Apr 27 '24 12:04 parasharrajat

BUG: web: The route is not shown completely when following waypoints are selected.

https://github.com/Expensify/App/assets/24370807/5fdf720f-f281-41b6-85cc-f0e95cdde461

parasharrajat avatar Apr 27 '24 12:04 parasharrajat