-
Notifications
You must be signed in to change notification settings - Fork 3k
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 the cancel and save changes to inside the compose box #17633
Move the cancel and save changes to inside the compose box #17633
Conversation
@madmax330 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just one style comment, I'm not too familiar with this part of the app though so leaving the final review to @luacmartins
I've just noticed that the focus on edit box input is broken after rebasing to the latest main. Double checked it on the main branch and yes it's broken there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Left a couple comments. I haven't tested this yet though
@@ -316,26 +345,27 @@ class ReportActionItemMessageEdit extends React.Component { | |||
/> | |||
</View> | |||
|
|||
<View style={styles.alignSelfEnd}> | |||
<Tooltip text={this.props.translate('common.saveChanges')}> | |||
<TouchableOpacity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK TouchableOpacity
is being deprecated. Can we use Pressable
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Touchable Opacity was used to match exactly the send button we have in the ReportActionComposer.js
.
In my opinion, changing it to Pressable would also mean changing it in ReportActionComposer which is already out of the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think that we should change this to a Pressable
since TouchableOpacity
is being deprecated. I understand if we wanna tackle ReportActionComposer
in a followup so we don't add more testing scope to this issue though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's going to be a follow up PR changing ReportActionComposer to use Pressable instead of TouchableOpacity then it makes more sense to me to do both at the same time.
By the way, TouchableOpacity is not deprecated. On reactnative.dev they recommend to use Pressable if you want to have more control:
If you're looking for a more extensive and future-proof way to handle touch-based input, check out the Pressable API.
Also, Pressable is not the same as TouchableOpacity since the latter implements animation out of the box, Pressable doesn't have animation.
Pressabe is designed to be a building block for custom buttons. So the ultimate approach would be to implement our own Touchable Opacity using Pressabe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terrysahaidak you'll have to sign your commits before we can merge this PR. You can do so by running the following command:
git -c core.editor=true rebase --exec 'git commit --amend --no-edit -n -S' -i $COMMIT_HASH
bump @terrysahaidak |
thanks for the reminder @luacmartins, will do it today 🙂 |
Thanks! Let me know when we're ready for another round of review @terrysahaidak |
@luacmartins, yes, would appreciate it! I just double-checked that my changes are still working fine after the rebase. But there is still a bug on iOS so it doesn't focus the input. It's not related to my changes since I could confirm it on the main branch: 2023-04-28.13.47.45.movI think this should be a separate ticket. |
@luacmartins any recommendation on how to force all new commits to be also signed? |
@terrysahaidak here are the steps:
|
@terrysahaidak any luck with getting your commits signed? |
@luacmartins Yes, I actually did the same thing again today but it did not sign them for some reason. Finishing another thing and getting back to this. |
b6955eb
to
cec66af
Compare
@luacmartins seems to be verified, let me know if everything is correct, thanks for example, should past commits also be verified? This doesn't help. But I should be able to just squash the commits. |
Yes, all commits should be verified. Hmm can you try the one below? Ideally we don't squash the commits.
|
I'll fix it tomorrow morning, thanks @luacmartins. Btw, I spent a few hours looking into this issue but didn't find anything specific that would cause this. RPReplay_Final1683010473.MP4 |
cec66af
to
e87637b
Compare
hey @luacmartins, I had to do it the hard way and cherry-picked all my commits into another branch since it would always go through all 250+ commits because of the merge commits, but seems to be good now. I'll test my changes again to make sure nothing is lost/broken after the rebase. |
@terrysahaidak sorry that was so difficult 😅 commits seem good now :) |
Let me know when this is ready for another review |
@luacmartins tested it again and everything looks good. |
Adding @fedirjh for review and testing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reactions={reactions} | ||
toggleReaction={this.toggleReaction} | ||
/> | ||
<View style={this.props.draftMessage ? styles.chatItemReactionsDraftRight : null}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<View style={this.props.draftMessage ? styles.chatItemReactionsDraftRight : null}> | |
<View style={this.props.draftMessage ? styles.chatItemReactionsDraftRight : {}}> |
Avoid apply null
to style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the repo's code and there is the usage of: null
, {}
, and undefined
.
I don't have a preference so I'm ok with {}
in this case.
hitSlop={{ | ||
top: 3, right: 3, bottom: 3, left: 3, | ||
}} | ||
disabled={hasExceededMaxCommentLength} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabled={hasExceededMaxCommentLength} |
I think we should remove this prop as this is a cancel button, and we should be able to cancel the edit regardless of hasExceededMaxCommentLength
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks!
<Tooltip text={this.props.translate('common.saveChanges')}> | ||
<TouchableOpacity | ||
style={[styles.chatItemSubmitButton, | ||
(this.state.isCommentEmpty || hasExceededMaxCommentLength) ? undefined : styles.buttonSuccess, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this.state.isCommentEmpty || hasExceededMaxCommentLength) ? undefined : styles.buttonSuccess, | |
hasExceededMaxCommentLength ? {} : styles.buttonSuccess, |
- Saving empty message should delete it. I tested that and it's working.
this.state.isCommentEmpty
is not defined, it should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I miss TypeScript.
display: 'flex', | ||
flexDirection: 'row', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
display: 'flex', | |
flexDirection: 'row', | |
...flex.dFlex, | |
...flex.flexRow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see a single ...flex.flerRow
usage and lots of fledDirection: 'row'
and it feels like anti patters. Can you link to the style guide for this? Spreading a single value doesn't give anything here, but it's even harder to type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coding the same style in multiple places is an anti-pattern as it violates the DRY principle. We have a checklist item for that :
I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that it's more about the usage of styles.flex1
instead of defining your own myStyle
where you have only { flex: 1 }
, but not about building a style object out of other objects completely.
Thanks for the review, @fedirjh. Fixed the ExceededCommentLength, and tested if on every platform, looks the same. But I don't like the look in this case though, but it's a different story: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-04.at.11.48.24.AM.movScreen.Recording.2023-05-04.at.11.49.01.AM.movMobile Web - ChromeScreen.Recording.2023-05-04.at.11.59.49.AM.movMobile Web - SafariScreen.Recording.2023-05-04.at.11.57.51.AM.movDesktopScreen.Recording.2023-05-04.at.11.52.29.AM.movScreen.Recording.2023-05-04.at.11.53.37.AM.moviOSScreen.Recording.2023-05-04.at.11.54.47.AM.movAndroidScreen.Recording.2023-05-04.at.12.08.47.PM.mov |
@terrysahaidak I noticed that you incorrectly linked an issue in the PR description. This could cause issues with automation after the PR is merged. To fix this, please update the "Fixed Issues" section as follows:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and tests well 🚀 🚀
cc @luacmartins all yours.
Thanks, will do better next time :) |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.3.10-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.12-0 🚀
|
Details
This PR moves the save button inside the edit composer box similar to how we have the send button in the composer. The cancel button now replaces the user avatar following the design we discussed here.
The proposed design
Fixed Issues
$ #15598
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
2023-04-19.10.49.42.mov
2023-04-19.10.51.02.mov
Mobile Web - Chrome
expensify_android_chrome.mp4
Mobile Web - Safari
RPReplay_Final1681891977.MP4
Desktop
2023-04-19.17.54.26.mov
iOS
RPReplay_Final1681915446.mov
Android
expensify_android_native.mp4