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

Feature/add crop screen #83

Merged
merged 21 commits into from
Feb 9, 2022
Merged

Feature/add crop screen #83

merged 21 commits into from
Feb 9, 2022

Conversation

ajmaurya99
Copy link

@ajmaurya99 ajmaurya99 commented Sep 9, 2021

Description of the Change

  • This PR attempts to add a crop screen after selecting an Avatar Image. Currently the suggested image dimensions: 200 by 200 pixels.
  • The crop screen is skipped if the Avatar size is 200 by 200 pixels.
  • Select Avatar CTA is renamed to Select Avatar and Crop.
  • The code is updated to ES6 standards.

Screenshots

Screenshot 2021-09-29 at 4 49 07 PM

Alternate Designs

None

Benefits

Now the users can crop their Avatar as they want it to appear on the website.

Possible Drawbacks

Currently i havent used the api.CroppedImageControl and api.SiteIconControl but these can be used, in order to make the code more robust.

Verification Process

  1. Visit the user profile screen and scroll to the Avatar section at the bottom of the page.
  2. Try updating/adding the Avatar image and you should be able to crop the Avatar Image as per your choice.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

#65

Changelog Entry

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

Hey @ajmaurya99 !

This is amazing and I love all the comments you've left throughout the code. Everything is very well explained and the code is easy to follow.

I've added some comments as per your request to review this which has mostly formatting things.

includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
includes/class-simple-local-avatars.php Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
@ajmaurya99 ajmaurya99 changed the title [WIP] Feature/add crop screen ]Feature/add crop screen Sep 29, 2021
@ajmaurya99 ajmaurya99 changed the title ]Feature/add crop screen Feature/add crop screen Sep 29, 2021
@ajmaurya99 ajmaurya99 added the type:enhancement New feature or request. label Sep 29, 2021
@ajmaurya99 ajmaurya99 marked this pull request as ready for review September 29, 2021 12:21
@jeffpaul jeffpaul requested review from helen and removed request for jeffpaul September 29, 2021 13:23
@jeffpaul jeffpaul added this to the 2.3.0 milestone Sep 29, 2021
@@ -329,8 +330,7 @@ public function avatar_settings_field( $args ) {
*
* @param object $profileuser User object
*/
public function edit_user_profile( $profileuser ) {
?>
public function edit_user_profile( $profileuser ) { ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public function edit_user_profile( $profileuser ) { ?>
public function edit_user_profile( $profileuser ) {
?>

Copy link
Member

@faisal-alvi faisal-alvi Feb 4, 2022

Choose a reason for hiding this comment

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

@ajmaurya99 please add this suggestion by Helen.

Copy link
Contributor

@helen helen left a comment

Choose a reason for hiding this comment

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

Works great! Could you possibly take a pass to reduce/remove the whitespace and other unrelated changes, as well as extraneous code comments that aren't needed for this context?

includes/class-simple-local-avatars.php Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
simple-local-avatars.dev.js Outdated Show resolved Hide resolved
@ajmaurya99
Copy link
Author

@helen I have modified the PR based on your comments, Please have a look.

@helen
Copy link
Contributor

helen commented Oct 18, 2021

Another general thing here is that .github/workflows/push-deploy.yml will need some changes to account for the build, along with switching from .gitattributes to .distignore and deciding whether we want to include src/** in the .org deployment. See https://github.com/10up/simple-podcasting/ for examples.

@jeffpaul jeffpaul requested a review from faisal-alvi January 17, 2022 22:33
Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

@ajmaurya99 Great work! the functionality is working as per the expectations.

  1. Can you please work on the suggestions by Helen?
  2. The package.json file was recently added via Introducing Package file #94. Please resolve the conflicts.
  3. Few more suggestions below, it's negligible but good to be done now than later, please check.

includes/class-simple-local-avatars.php Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@ajmaurya99
Copy link
Author

Another general thing here is that .github/workflows/push-deploy.yml will need some changes to account for the build, along with switching from .gitattributes to .distignore and deciding whether we want to include src/** in the .org deployment. See https://github.com/10up/simple-podcasting/ for examples.

@faisal-alvi I have replaced the .gitattributes with .distignore and added the dist folder to .gitignore.

@ajmaurya99
Copy link
Author

@ajmaurya99 Great work! the functionality is working as per the expectations.

  1. Can you please work on the suggestions by Helen?
  2. The package.json file was recently added via Introducing Package file #94. Please resolve the conflicts.
  3. Few more suggestions below, it's negligible but good to be done now than later, please check.

@faisal-alvi the current feature branch is synced with the develop branch.

@jeffpaul jeffpaul requested a review from faisal-alvi February 1, 2022 14:22
Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

@ajmaurya99 thanks for the changes, added a few small suggestions, can you please check?

includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
.distignore Show resolved Hide resolved
includes/class-simple-local-avatars.php Show resolved Hide resolved
Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

@ajmaurya99 a couple of very tiny changes, everything else is good! Thanks for the efforts!

Then we are good to go 🚀.

private $user_id_being_edited, $avatar_upload_error, $remove_nonce, $avatar_ratings;
public $options;

/**
* Set up the hooks and default values
*/
public function __construct() {
$this->options = (array) get_option( 'simple_local_avatars' );
$this->options = (array) get_option( 'simple_local_avatars' );
Copy link
Member

Choose a reason for hiding this comment

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

Please remove extra space from the beginning of the variable.

@@ -329,8 +330,7 @@ public function avatar_settings_field( $args ) {
*
* @param object $profileuser User object
*/
public function edit_user_profile( $profileuser ) {
?>
public function edit_user_profile( $profileuser ) { ?>
Copy link
Member

@faisal-alvi faisal-alvi Feb 4, 2022

Choose a reason for hiding this comment

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

@ajmaurya99 please add this suggestion by Helen.

@ajmaurya99
Copy link
Author

@faisal-alvi I have added the code indentation changes, Please have a look.

@jeffpaul jeffpaul requested a review from faisal-alvi February 9, 2022 14:28
Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

🚀

@jeffpaul jeffpaul merged commit 369fc7b into develop Feb 9, 2022
@jeffpaul jeffpaul deleted the feature/add-crop-screen branch February 9, 2022 20:51
@faisal-alvi faisal-alvi mentioned this pull request Sep 7, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to crop images before setting as avatar
6 participants