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

Move all the compose meta data to be above the compose input #9095

Merged
merged 10 commits into from
May 27, 2022

Conversation

tgolen
Copy link
Contributor

@tgolen tgolen commented May 19, 2022

Details

Some of the information used to be above the compose, and some of it below. All of them had inconsistent styling and bad practices for layout out the UI components.

I put the "user is typing" block at the end, since that's the one that has the biggest chance of flashing on and off. Putting it at the end makes it the least jarring so the position of the other elements don't change when it flashes on and off.

Fixed Issues

$ #9087

Tests & QA

  1. Open a chat
  2. Go offline
  3. Verify the offline message now appears above the compose input
  4. Go back online
  5. Compose a message with more than 60,000 characters (use copy/paste to do this easily)
  6. Verify the comment exceeded meta data is displayed above the compose input
  7. Open a second incognito browser and sign in as the other chat participant and start typing
  8. Verify that the "user is typing" message is above the compose input
  9. Open a third incognito browser and sign in as a third chat participant
  10. Start a group chat with all three people
  11. Quickly type something in the compose input in two of the browsers
  12. Verify that in the third browser the "multiple people are typing" appears and it's displayed above the compose input
  13. Verify that all the vertical and horizontal spacing looks OK
  • Verify that no errors appear in the JS console

Screenshots

**NOTE: For these screenshots, I hacked the code to display all pieces of meta data at once. This will not be possible to do in production because for example, you can't see "user is typing" when you're offline. **

Multiple users typing:

2022-05-19_10-12-44.mp4

Web

2022-05-19_09-52-24

Mobile Web

2022-05-19_10-07-11

Desktop

2022-05-19_09-58-48

iOS

2022-05-19_10-02-13

Android

2022-05-19_10-05-26

@tgolen tgolen requested a review from a team as a code owner May 19, 2022 16:18
@tgolen tgolen self-assigned this May 19, 2022
@melvin-bot melvin-bot bot requested review from amyevans and removed request for a team May 19, 2022 16:18
@tgolen
Copy link
Contributor Author

tgolen commented May 19, 2022

cc @Luke9389 I created the <YouAppearToBeOffline> component in this PR. I think you were looking to created that from your design doc, but I just couldn't resist doing it here since it cleaned up the report compose view so well.

@tgolen tgolen requested a review from Luke9389 May 19, 2022 16:20
@Luke9389
Copy link
Contributor

OK cool! Thanks for the heads up

Copy link
Contributor

@amyevans amyevans left a comment

Choose a reason for hiding this comment

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

Just a small comment on styling

Comment on lines 448 to 465
{shouldShowReportRecipientLocalTime
&& (
<View style={[styles.mr3]}>
<ParticipantLocalTime participant={reportRecipient} />
</View>
)}

<View style={[styles.mr3]}>
<YouAppearToBeOffline />
</View>

<View style={[styles.mr3]}>
<ExceededCommentLength commentLength={this.comment.length} />
</View>

<View style={[styles.mr3]}>
<ReportTypingIndicator reportID={this.props.reportID} />
</View>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrapping each of these components in a <View style={[styles.mr3]}> is going to produce inconsistent margins when, for example, the first and last components are visible, but the 2nd and 3rd return null. I think it'd be better to apply a gap: 12px; style to the flex container and eliminate these inner wrappers.

Also, NAB, but I think it reads cleaner to have && ( on the same line as the boolean var: {shouldShowReportRecipientLocalTime && (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's a really good point with the spacing. I like the idea of using gap!

Copy link
Contributor

@Luke9389 Luke9389 left a comment

Choose a reason for hiding this comment

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

This all looks good to me 👍

...withLocalizePropTypes,
};

const YouAppearToBeOffline = (props) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

There was consensus in the Design Doc to call this component OfflineIndicator because that describes what it is, not what it says or does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, OK. I personally feel like that is not really a great name for it because an "offline indicator" could be done in several different ways (just an icon, just text, a spinner, something else, etc.). I do not feel too strongly about it at this point though, so I will change the name.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point. I'm also not dug in on OfflineIndicator either, just going by the threads in the doc. I think @iwiznia was more strongly opinionated about it. Thanks for making the change anyway. Down to rename if we re-discuss and end up switching back.

Copy link
Contributor

Choose a reason for hiding this comment

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

YouAppearToBeOffline also does not tell you if it is an icon, just text, a spinner, something else, no?

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, right after I said that, I realized the name I had wasn't much better.

@tgolen
Copy link
Contributor Author

tgolen commented May 24, 2022

Updated

@tgolen
Copy link
Contributor Author

tgolen commented May 24, 2022

Oh, I forgot to make the gap change. Let me do that

@tgolen
Copy link
Contributor Author

tgolen commented May 24, 2022

Actually, I found that gap is not yet supported in React-Native :( styled-components/styled-components#3628 so I won't be updating it.

@Luke9389
Copy link
Contributor

I'll give @amyevans a chance to check this out one more time, given the RN gap gap.

@amyevans
Copy link
Contributor

Actually, I found that gap is not yet supported in React-Native

TIHI 🙃

This is my first time diving into RN styling and I am shocked/frustrated how limited its capabilities are 😬. Though obviously not as elegant, another option would be to pass styles.mr3 to each child component via the style prop and then spread what's received within the children. E.g. <ParticipantLocalTime participant={reportRecipient} style={[styles.mr3]} /> and then https://github.com/Expensify/App/blob/tgolen-move-istyping/src/pages/home/report/ParticipantLocalTime.js#L61 could be style={[styles.chatItemComposeSecondaryRowSubText, ...this.props.style]}

@Luke9389
Copy link
Contributor

Hey @amyevans, it looks like Tim is gonna be OOO until June 6. There's an N07 Issue held on this PR, so would it be OK for us to merge this and then make a separate issue for styling? I'd be happy to follow you over there and be the reviewer if you'd like to implement it (I've got the context and you've got the idea).

@amyevans
Copy link
Contributor

Sure, that sounds perfect to me 😄

@amyevans amyevans merged commit 70479c3 into main May 27, 2022
@amyevans amyevans deleted the tgolen-move-istyping branch May 27, 2022 18:40
@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.

@thesahindia
Copy link
Member

We have extra whitespace below the last message in chats where we aren't showing current time of the contact
(not sure if it's related to this PR)
Screenshot 2022-05-29 at 12 14 10 AM

Screenshot 2022-05-29 at 12 14 36 AM

cc: @tgolen

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @amyevans in version: 1.1.69-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @luacmartins in version: 1.1.69-2 🚀

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