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

Attachment modal Arrow to cycle attachments in chat #9177

Closed
wants to merge 0 commits into from

Conversation

JediWattson
Copy link
Contributor

@JediWattson JediWattson commented May 26, 2022

Details

Add an option to cycle between media when opened via buttons.

Fixed Issues

$ #7862

Tests

  1. open older attachment with previous and subsequent attachments in the chat
  2. click left button to go to load previous attachment
  3. click right button to go back to original
  4. right button again to go to next attachment
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (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 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 included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 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 was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team 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
  • 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 */
    • Any functional components have the displayName property
    • 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
  • 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 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.

PR Reviewer Checklist

  • 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 verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 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 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 was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team 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 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 */
    • Any functional components have the displayName property
    • 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 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 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.

QA Steps

  1. open older attachment with previous and subsequent attachments in the chat
  2. click left button to go to load previous attachment
  3. click right button to go back to original
  4. right button again to go to next attachment
  • Verify that no errors appear in the JS console

Screenshots

Web

Screen.Recording.2022-05-26.at.9.54.12.PM.mov

Mobile Web

chrome

mweb.chrome.mov

safari

Screen.Recording.2022-05-31.at.11.26.25.PM.mov

Desktop

Screen.Recording.2022-05-26.at.9.49.57.PM.mov

iOS

Screen.Recording.2022-05-26.at.10.00.05.PM.mov

Android

android.mov

@JediWattson JediWattson requested a review from a team as a code owner May 26, 2022 03:30
@melvin-bot melvin-bot bot requested review from chiragsalian and Santhosh-Sellavel and removed request for a team May 26, 2022 03:30
@github-actions
Copy link
Contributor

github-actions bot commented May 26, 2022

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

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

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

@JediWattson Can you test in all the platforms listed in PR Checklist. Also upload screen recordings for all the platforms

src/CONST.js Outdated Show resolved Hide resolved
Comment on lines 15 to 23
/** sourceUrl to determine the initial index of the attachment rendered in it's respective actions */
sourceURL: PropTypes.string,

/** Object of report actions for this report */
reportActions: PropTypes.objectOf(PropTypes.shape(reportActionPropTypes)),

/** callback from the parent to change the name and sourceUrl of parent's state */
onArrowPress: PropTypes.func,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add meaningful comments to sourceURL & onArrowPress without being too technical

src/components/AttachmentModal.js Outdated Show resolved Hide resolved
Comment on lines 55 to 63
componentDidUpdate() {
if (this.canUseTouchScreen) {
return;
}
Image.getSize(this.props.url, (width, height) => {
this.setImageRegion(width, height);
});
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this is necessary?

Can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe so, I noticed in iOS when going through images if one image starts with a certain zoom compared to the others, then this will persist since nothing is handling the change of source in this regard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what I'm getting without that code. You'll see there's an image zoomed in and the sides are cut off.

Screen.Recording.2022-05-31.at.6.28.12.PM.mov

src/pages/home/report/ReportActionCompose.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionCompose.js Outdated Show resolved Hide resolved
@Santhosh-Sellavel
Copy link
Collaborator

CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.

I have read the CLA Document and I hereby sign the CLA

Robert Daly seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.You can retrigger this bot by commenting recheck in this Pull Request

@JediWattson Sign the CLA Document,

You can sign the CLA by just posting a Pull Request Comment same as the below format.

I have read the CLA Document and I hereby sign the CLA

@Santhosh-Sellavel
Copy link
Collaborator

@shawnborton Can you confirm does it meet the design requirements

@Santhosh-Sellavel
Copy link
Collaborator

@JediWattson Can you update the remaining platform videos too?

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented May 31, 2022

Also @JediWattson I just now noticed most of your commits are unverified & have committed from two different accounts. I'm not sure why. It's recommended to use one account for all purposes

cc: @chiragsalian

@JediWattson JediWattson force-pushed the arrow-feature branch 4 times, most recently from b96b842 to af6aeca Compare May 31, 2022 21:47
@JediWattson
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@chiragsalian
Copy link
Contributor

Hi @JediWattson, so yes as santhosh suggested its best to use one account for all purposes. That way its easier to track the work done and lesser effort on your side to manage gpg keys for two accounts to ensure commits are signed. And speaking of signed commits, all commits have to be signed for us to accept your work. At this point you can combine all commits for this PR or open another new PR with a signed commits. Let us know which works better for you and you can check out #expensify-open-source or ask there if you are stuck as you'll see more people have faced the same issue.

@JediWattson JediWattson force-pushed the arrow-feature branch 5 times, most recently from e4bb56c to eb78fe1 Compare June 1, 2022 04:22
@shawnborton
Copy link
Contributor

Just to confirm the arrow button styles:

  • They should use the same background gray as our standard default buttons like so: image
  • They should be 40x40
  • The icon inside of them should be 20x20
  • The icon inside of them should use our standard text color

I also want to confirm that on mobile, when you tap once on the image, the buttons will be hidden. It also looks like the buttons are not rounded on iOS.

@shawnborton
Copy link
Contributor

Also @Santhosh-Sellavel can you be sure to ping the @expensify/design team for these kinds of reviews in the future and not just me? Thank you!

@shawnborton shawnborton removed the Design label Jun 1, 2022
@Santhosh-Sellavel
Copy link
Collaborator

Ya sure @shawnborton. But need a clarification here.

Since you (along with megan who is unavailable) were involved in the discussion of the solution for this issue or assigned for design label in the issue.

But is it okay pinging design team for any case ignoring design label assigned member who has more context?

@shawnborton
Copy link
Contributor

I would say ping both - directly ping the person who was involved in the design and then cc @expensify/design

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jun 1, 2022

@JediWattson Your changes are lost in the PR, can you update and commit them back. Also, address the concerns from Shawn's comment -> #9177 (comment)

cc: @chiragsalian

@Santhosh-Sellavel
Copy link
Collaborator

@JediWattson
I see you force-pushed changes, while the review is in progress. It's not a good practice.
I would say it's better to start things fresh on the new branch and new PR. Make a note of the discussion made & changes requested here, and address them in the new PR.

cc: @chiragsalian

@JediWattson JediWattson closed this Jun 1, 2022
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.

None yet

4 participants