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

Fix inconsistent margins for reacted emojis to different sort of comments #22010

Closed

Conversation

rezkiy37
Copy link
Contributor

@rezkiy37 rezkiy37 commented Jul 1, 2023

Details

Fixed Issues

$ #18681
PROPOSAL: #18681 (comment)

Tests

  • Verify that no errors appear in the JS console
  1. Open the "Expensify" app on any device or platform
  2. Open/create any chat
  3. Create any type of messages like test, code-blocks, quote, attachment, etc.
  4. Add emojis
  5. Verify that spacings are the same between all messages and emojis

Offline tests

Same as tests

QA Steps

  • Verify that no errors appear in the JS console

Same as tests

  1. Open the "Expensify" app on any device or platform
  2. Open/create any chat
  3. Create any type of messages like test, code-blocks, quote, attachment, etc.
  4. Add emojis
  5. Verify that spacings are the same between all messages and emojis

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
    • 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 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 1 2 3
Mobile Web - Chrome

IMG_7105
IMG_7106
IMG_7107
IMG_7108

Mobile Web - Safari

IMG_7101
IMG_7102
IMG_7103
IMG_7104

Desktop Screenshot 2023-07-02 at 13 26 08 Screenshot 2023-07-02 at 13 26 14
iOS

ios 1
ios 2
ios 3

Android android 1 android 2 android 3

@rezkiy37
Copy link
Contributor Author

rezkiy37 commented Jul 2, 2023

@rezkiy37
this change works on your side? possible to add video or screenshot?

It is still a draft PR. Once it is ready, I will open it for review 🙂

@rezkiy37 rezkiy37 marked this pull request as ready for review July 3, 2023 08:37
@rezkiy37 rezkiy37 requested a review from a team as a code owner July 3, 2023 08:37
@melvin-bot melvin-bot bot requested review from abdulrahuman5196 and removed request for a team July 3, 2023 08:37
@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

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

@rezkiy37
Copy link
Contributor Author

rezkiy37 commented Jul 5, 2023

@abdulrahuman5196 Just a friendly reminder that the PR is ready for review 🙂

@abdulrahuman5196
Copy link
Contributor

Sorry for the delay @rezkiy37 Will close the review before tomorrow morning.

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jul 9, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • 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
  • 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
    • 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 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 reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jul 9, 2023

NAB: @rezkiy37 Kindly mark Offline tests and QA tests as "Same as tests". Offline tests also should be present for this change since its expected to work offline

@rezkiy37
Copy link
Contributor Author

NAB: @rezkiy37 Kindly mark Offline tests and QA tests as "Same as tests". Offline tests also should be present for this change since its expected to work offline

Done.

@rezkiy37
Copy link
Contributor Author

@abdulrahuman5196 Just a friendly reminder 🙂

@abdulrahuman5196
Copy link
Contributor

Working on this now

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 When we hover the message, the hover doesn't have any space top or bottom as its like attached to the message which is odd.

Screen.Recording.2023-07-13.at.3.03.07.PM.mov

@rezkiy37
Copy link
Contributor Author

@rezkiy37 When we hover the message, the hover doesn't have any space top or bottom as its like attached to the message which is odd.

Screen.Recording.2023-07-13.at.3.03.07.PM.mov

Yes, it works this way, because the messages are separated by a separator component of FlatList, not via paddings.

@rezkiy37
Copy link
Contributor Author

This implementation follows the proposal, that was approved. So, we should decide or ask someone who care about UX.

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jul 13, 2023

@rezkiy37 I think hover should have padding as per the current working behaviour, it is odd without padding for hover.

@conorpendergrast Could you kindly tag an UX person to confirm on the same? #22010 (comment)

@rezkiy37
Copy link
Contributor Author

@rezkiy37 I think hover should have padding as per the current working behaviour, it odd with padding for hover.

@conorpendergrast Could you kindly tag an UX person to confirm on the same? #22010 (comment)

@abdulrahuman5196, I misunderstood. "hover should have padding" and "it odd with padding for hover". Does not it contradict?

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 Sorry. It was a typo, updated the comment - #22010 (comment)

I am aligned to have some amount of padding top and bottom on hover similar to current behaviour.

Screenshot 2023-07-13 at 11 13 45 PM

@rezkiy37
Copy link
Contributor Author

@rezkiy37 Sorry. It was a typo, updated the comment - #22010 (comment)

I am aligned to have some amount of padding top and bottom on hover similar to current behaviour.

Screenshot 2023-07-13 at 11 13 45 PM

Well, let me add them and tweak the separator.

@abdulrahuman5196
Copy link
Contributor

Thank you @rezkiy37

@rezkiy37
Copy link
Contributor Author

@abdulrahuman5196, just to clarify the next steps:

  1. Sounds like this implementation won't be merged.
  2. I am going to propose an alternative solution from the proposal.
  3. Should I create a new PR and close this one?

@abdulrahuman5196
Copy link
Contributor

Sounds like this implementation won't be merged.

@rezkiy37 Why would this be? Is it not possible to tweek the separator and message hover size?

Any blockers there?

@abdulrahuman5196
Copy link
Contributor

I was expected to fix the hover issue alone, otherwise the implementation here seems fine AFAIK.

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 I am still seeing issue with whipser messages
Screenshot 2023-08-06 at 4 58 40 PM

And moreover I am not sure on understanding what we are doing as a fix for whisper messages. Could you explain what are we trying to do specifically for whispers alone.

@rezkiy37
Copy link
Contributor Author

rezkiy37 commented Aug 7, 2023

@rezkiy37 I am still seeing issue with whipser messages Screenshot 2023-08-06 at 4 58 40 PM

And moreover I am not sure on understanding what we are doing as a fix for whisper messages. Could you explain what are we trying to do specifically for whispers alone.

@abdulrahuman5196, updates:

My bad, it is one more case. I added a logic to understand what the previous action is whisper. It fixed a case when the current message is a whisper and the previous one as well, but they are not in one group.
Commit - 51adace.

Example

whisper.mov

Could you explain what are we trying to do specifically for whispers alone.

Yes, sure. The app highlights separators between whisper actions when they are in a group. It creates this solid effect.
Also, on hover other messages near a whisper, the app should create the solid effect. It powered by extending the hover area from 4px (half of separator) to 8px (entire separator).

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 Still I am seeing issues with hover on whisper

Current issues

  1. Hover on whisper is not perfect.
  2. And we have a no hover point between messages where both above and below messages are not highlighted. This is not the behaviour in the main, atleast one of the messages will be highlighted at any time
Screen.Recording.2023-08-13.at.9.55.37.PM.mov

@Beamanator We have been trying so much to fix the hover issue, but even after multiple iterations we are still unable to perfect the solution. Should we try for a different approach to solve the issue? Or any advice on path forward?

@rezkiy37
Copy link
Contributor Author

@abdulrahuman5196, yeah, I see. I agree to wait a comment from @Beamanator to consider any next steps here.

@abdulrahuman5196
Copy link
Contributor

@Beamanator Waiting on your comments here?

@abdulrahuman5196
Copy link
Contributor

@Beamanator Reference #22010 (comment)

@Beamanator
Copy link
Contributor

Sorry for the delay gents, it's been quite a busy few weeks prepping for some conferences - I will try to get back to y'all today 🙏

@Beamanator
Copy link
Contributor

Hmm I can see how these types of changes (to Report action components) can run the risk of regressions since there's lots of complicated logic all over the place - I think it definitely would make sense for @rezkiy37 to take a bit of time, step back and reevaluate if there's another solution. I don't currently have time to look into what exactly would be the best way forward for this, but that's why we hire others for that work :D

One strategy I'm thinking could work well:

  1. Reevaluate what exactly the problem is that we're trying to solve in the issue
    • Did we add anything to the scope after trying things in this PR?
  2. Re-agree on what the solution should look like (with the design team's 👀 )
  3. Determine if we can break this up into multiple pieces (so far this PR isn't huge, but it seems like we can't get everything to work at once, so what if we try to just fix 1 thing at a time?)
  4. Get back to coding

Thoughts?

@rezkiy37
Copy link
Contributor Author

Hmm I can see how these types of changes (to Report action components) can run the risk of regressions since there's lots of complicated logic all over the place - I think it definitely would make sense for @rezkiy37 to take a bit of time, step back and reevaluate if there's another solution. I don't currently have time to look into what exactly would be the best way forward for this, but that's why we hire others for that work :D

One strategy I'm thinking could work well:

  1. Reevaluate what exactly the problem is that we're trying to solve in the issue

    • Did we add anything to the scope after trying things in this PR?
  2. Re-agree on what the solution should look like (with the design team's 👀 )

  3. Determine if we can break this up into multiple pieces (so far this PR isn't huge, but it seems like we can't get everything to work at once, so what if we try to just fix 1 thing at a time?)

  4. Get back to coding

Thoughts?

Makes sense. I believe we should do these steps. Also, I will ask some help of my Callstack teammates.

@rezkiy37
Copy link
Contributor Author

@abdulrahuman5196, @Beamanator, I still think about:

What alternative solutions did you explore?

There is another solution how to fix these weird margins only.
I propose to use margin top instead of the vertical. This way it fixes extra-gap between the reactions and code-blocks.
Also, the app still have all current spaces between items.

  1. Open BasePreRenderer.
  2. Replace styles.mv2 with styles.mt2 in ScrollView.

Since, the main approach was not good, I believe in this one. Thoughts?

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 Sorry I missed this one. I will check on the alternative solution and update sooner

@teneeto
Copy link
Contributor

teneeto commented Sep 12, 2023

@rezkiy37 Sorry I missed this one. I will check on the alternative solution and update sooner

Great work guys!

@abdulrahuman5196 I've followed the conversation up until this point and before I look into any further proposals into this, I would also like to see how @rezkiy37 most recent proposal plays out. Perhaps I could come in at this point to see how I can assist. would also be waiting on your thoughts...

@abdulrahuman5196
Copy link
Contributor

@rezkiy37 I tried this #22010 (comment)

But for me it seems like, there isn't visible UI changes happening. I am sure if I am missing something. If possible could you kindly provide screenshots of what is previous and new change in UI?

@rezkiy37
Copy link
Contributor Author

@rezkiy37 I tried this #22010 (comment)

But for me it seems like, there isn't visible UI changes happening. I am sure if I am missing something. If possible could you kindly provide screenshots of what is previous and new change in UI?

Let me please provide more info here.

@rezkiy37
Copy link
Contributor Author

@rezkiy37 I tried this #22010 (comment)

But for me it seems like, there isn't visible UI changes happening. I am sure if I am missing something. If possible could you kindly provide screenshots of what is previous and new change in UI?

Initially, our goal here to align spacing between a message and reactions for different type of messages. Actually, there is a component with an inconsistency - BasePreRenderer. It happens, because it applies an additional bottom margin.

So, I am no the latest main applied styles.mt2 (top margin) instead of styles.mv2 (vertical margins) to ScrollView of BasePreRenderer. Result:

  1. We can see that spacing between messages and their reactions are the same, even for a multi-line. There are red arrows that demonstrate a difference.
1
  1. We can see that spacing between messages are the same, even for a multi-line and a bare text. There are red arrows and squares, that demonstrate a difference.
2
  1. I remember a concern - Fix inconsistent margins for reacted emojis to different sort of comments #22010 (comment) - about spacing between a multi-line message and text. So, prepared 2 examples where I posted the first one without an empty line between, the second one with an empty line. Even for the first case it has a minimal space. I think it is expected when you create a message it line by line. For the second example, I added an empty line explicitly. Therefore, I have a bigger space.
Screenshot 2023-09-27 at 11 35 39

cc @abdulrahuman5196 @teneeto

@abdulrahuman5196
Copy link
Contributor

Thank you for the clear explanation @rezkiy37 here #22010 (comment)

This was the alternate solution proposed during the proposal review. We have already tried other better solutions but unfortunately, due to other issues we weren't able to proceed on the same.

IMO, I think at this state this alternate is a good enough fix given the main solution(better solution) has multiple side effects preventing its implementation.

🎀 👀 🎀
C+ Reviewed

cc: @Beamanator

@rezkiy37
Copy link
Contributor Author

Thank you for the clear explanation @rezkiy37 here #22010 (comment)

This was the alternate solution proposed during the proposal review. We have already tried other better solutions but unfortunately, due to other issues we weren't able to proceed on the same.

IMO, I think at this state this alternate is a good enough fix given the main solution(better solution) has multiple side effects preventing its implementation.

🎀 👀 🎀 C+ Reviewed

cc: @Beamanator

Cool, thank you!
I will prepare another PR, this one we will close.

@Beamanator
Copy link
Contributor

Thanks @abdulrahuman5196 and @rezkiy37 for the continued effort here, looking forward to the next PR 👍

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.

4 participants