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

Display create menu within the chat area and add bottom up transition. #2222

Merged
merged 5 commits into from
Apr 15, 2021

Conversation

npsedhain
Copy link
Contributor

Details

  1. CreateMenu opens within the chat area.
  2. The animation is changed to bottom-up transition.

Fixed Issues

Fixes [GH_LINK_2090](https://github.com//issues/2090)

Tests

  1. Enter a chat window.
  2. Click on the plus icon next to the chat input.
  3. The component opens within the chat area and not outside it.
  4. The transition is changed to bottom-up from left to right.

Tested On

  • Web
  • Mobile Web
  • Desktop

Screenshots

Web

Screen.Recording.2021-04-03.at.11.31.35.AM.mov

Mobile Web

(Doesn't break anything on a smaller screen)

Screen.Recording.2021-04-03.at.11.25.04.PM.mov

Desktop

Screen.Recording.2021-04-03.at.11.33.16.AM.mov

@npsedhain npsedhain requested a review from a team as a code owner April 3, 2021 17:43
@MelvinBot MelvinBot requested review from tgolen and removed request for a team April 3, 2021 17:43
Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

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

I guess this is OK when there are multiple lines in the input field?

image

cc @shawnborton

@@ -51,6 +79,7 @@ class CreateMenu extends PureComponent {
}

render() {
console.debug(this.props.popOverType, this.getAnchorPosition());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be removed? I don't think it's very useful to have in production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for this one, will remove it.

@@ -59,7 +88,8 @@ class CreateMenu extends PureComponent {
this.onModalHide();
this.resetOnModalHide();
}}
anchorPosition={styles.createMenuPosition}
anchorPosition={this.getAnchorPosition(this.props.popOverType)}
Copy link
Contributor

Choose a reason for hiding this comment

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

If the anchor position is determined by the popover type, and the popover type is already passed as a prop, then I think it would be cleaner to have anchor position determined inside of the <Popover> component. Would this be possible?

@@ -84,5 +114,6 @@ class CreateMenu extends PureComponent {
}

CreateMenu.propTypes = propTypes;
CreateMenu.defaultProps = defaultProps;
CreateMenu.displayName = 'CreateMenu';
Copy link
Contributor

Choose a reason for hiding this comment

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

I know class components don't need displayName, but I'm not sure about PureComponents. Can the display name be removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know?

const defaultProps = {
popOverType: CONST.MODAL.MODAL_TYPE.POPOVER_LEFT_DOCKED,
};

class CreateMenu extends PureComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this is a PureComponent instead of just a normal Component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pure component was implemented beforehand, not sure why it was done though.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I'll check on that and dig a little deeper. No need to let this block your PR since you didn't add it.

@@ -23,7 +23,9 @@ const propTypes = {
CONST.MODAL.MODAL_TYPE.CONFIRM,
CONST.MODAL.MODAL_TYPE.CENTERED,
CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED,
CONST.MODAL.MODAL_TYPE.POPOVER,
CONST.MODAL.MODAL_TYPE.POPOVER_CENTER_BOTTOM,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be easier to do something like type: PropTypes.oneOf(_.values(CONST.MODAL.MODAL_TYPE))?

@@ -12,6 +12,8 @@ const propTypes = {
bottom: PropTypes.number,
left: PropTypes.number,
}).isRequired,

popOverType: modalPropTypes.type,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is missing an inline comment to explain it.

@shawnborton
Copy link
Contributor

I think it's okay that the menu location doesn't change even if the textbox has multiple lines and grows taller. But I think the location of the menu feels a little bit too high above the text input right now. Could we place it like 8 or 16px above the top edge of a one-line chat input?

@trjExpensify
Copy link
Contributor

Hey @npsedhain, can we get an update on the changes requested here please? Thanks!

@npsedhain
Copy link
Contributor Author

Hey @trjExpensify, sorry for the delay, will push the changes within an hour!

@npsedhain
Copy link
Contributor Author

I have pushed the recommended changes, do let me know if there is more!

cc: @tgolen @trjExpensify

tgolen
tgolen previously approved these changes Apr 12, 2021
@tgolen
Copy link
Contributor

tgolen commented Apr 12, 2021

Looks like there is a conflict.

@npsedhain
Copy link
Contributor Author

Hey @tgolen, I have resolved the conflicts.

@tgolen
Copy link
Contributor

tgolen commented Apr 13, 2021

Hm, looks like there are still conflicts. Maybe you didn't push your changes or there are just more conflicts?

@npsedhain
Copy link
Contributor Author

Aah I did push it, maybe because something else was merged, will fix it in a minute.

@npsedhain
Copy link
Contributor Author

@tgolen Its fixed!

Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

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

Sorry for the delay on this!

@@ -84,5 +114,6 @@ class CreateMenu extends PureComponent {
}

CreateMenu.propTypes = propTypes;
CreateMenu.defaultProps = defaultProps;
CreateMenu.displayName = 'CreateMenu';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know?

@tgolen tgolen merged commit e7330c4 into Expensify:master Apr 15, 2021
@roryabraham
Copy link
Contributor

This PR caused a regression. Normally I would just revert it, but unfortunately the base branch was renamed soon after this was merged, so the automatic revert is not an option. @npsedhain Can you create a pull request to fix this regression?

@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@roryabraham roryabraham mentioned this pull request Apr 15, 2021
5 tasks
@roryabraham
Copy link
Contributor

roryabraham commented Apr 15, 2021

Since this will be a deploy blocker, I am creating a PR here to fix the regression.

@OSBotify
Copy link
Contributor

🚀 [Deployed](https://github.com/Expensify/Expensify.cash
/actions/runs/765130740) 🚀 to
staging on Mon Apr 19 2021 at 22:41:56 GMT+0000 (Coordinated Universal Time)

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

@roryabraham
Copy link
Contributor

Just noticed that this other PR actually split up the implementation of CreateMenu a bit and deleted CreateMenu.js, and this one had a bad merge which did not include those changes. So now we have two divergent CreateMenu modules 😬

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