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

Refactored ProfilePicture to use React component #876

Merged
merged 11 commits into from
Apr 5, 2018
Merged

Refactored ProfilePicture to use React component #876

merged 11 commits into from
Apr 5, 2018

Conversation

baohouse
Copy link
Contributor

@baohouse baohouse commented Apr 1, 2018

Addresses #874

Change overview:

  1. Updated ProfilePicture class to use Avatar React component.
  2. Enhanced Avatar component to use react-lazyload
  3. Updated tests that assert on the ProfilePicture
  4. Fixed some tests for language toggling involving page transitions

PR checklist:

  • yarn test
  • yarn lint
  • rspec
  • rubocop
  • Manual inspection of if me homepage for visual parity
  • Manual check for lazy loading of images to make sure the images do not load until the user scrolls them into view
  • Manual check that image size on if me homepage is correct in both desktop and mobile widths
  • Manual inspection on if me profile page for visual parity

1. Updated ProfilePicture class to use Avatar React component.
2. Enhanced Avatar component to use react-lazyload
3. Updated tests that assert on the ProfilePicture
4. Fixed some tests for language toggling involving page transitions
@baohouse baohouse requested review from GeoDoo and julianguyen April 1, 2018 02:43
* This file contains the color palette for the Kujali interface.
*/

$theme-color-1: #6d0839;
Copy link
Member

Choose a reason for hiding this comment

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

Rename as $theme-color-primary? Really though it should be colour 🌈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can call it primary, that's fine too. It's possible in the future that a theme has more than 2 colors, so that's why I just used straight up numbers. In the future, you can then assign variables:

$text-highlight: $theme-color-secondary;

mark { color: $text-highlight }

"Colour"? Haha, I would say CSS use of "color" makes things more consistent, but, if you really want, I can make the change. 😆

Copy link
Member

Choose a reason for hiding this comment

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

I think if there's more than two colours in the future, we should just give them straight up names

*/

$theme-color-1: #6d0839;
$theme-color-2: #d0e799;
Copy link
Member

Choose a reason for hiding this comment

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

Rename as $theme-color-secondary?

.add('With name', withSource(
<Row style={{ backgroundColor: '#aaa' }}>
<Col span={8}>
<Avatar src={photoJulia} name="Julia &ldquo;Fleurchild&rdquo; Nguyen" displayname />
Copy link
Member

Choose a reason for hiding this comment

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

LOL 🌷👧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, I'm just testing to see what the component looks like when the line length exceeds the width of the image. Honest!

return specList.split(',');
} else {
return [
{ pattern: 'app/**/*.spec.js', watched: true },
Copy link
Member

Choose a reason for hiding this comment

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

Hmm not 100% sure why it's broken up like this, can you explain? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the client/README.md I documented a way to run specific tests. I looked up on Stackoverflow on how to do this, and this was the best answer I could find so far. So if you specify a list in the environment properties, it will run those, otherwise falling back to all tests.

@@ -593,22 +586,30 @@ img {
}

.small_profile_picture_div {
width: 100px;
height: 100px;
width: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this 1px?

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 a div element made to behave like a table cell. Since we want to control the width by way of the content's width (which in this case is the Avatar component), we can reduce the number of places to update width information from two places to one.

}
}

.profile_picture_div {
width: 150px;
height: 150px;
width: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

Similar question as above ^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto as above 😄

Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Thanks a million for working on this <3

I have a handful of questions that need answering, but overall, LGTM! Excited that we're starting to see put together the React and Rails sides.

@baohouse baohouse requested a review from nma April 3, 2018 22:26
Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Thanks for answering my questions and working on this! LGTM!

@@ -1,3 +1,8 @@
/**
* TODO: Split up development configuration from production configuration
Copy link
Collaborator

Choose a reason for hiding this comment

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

it is a bit more involved than that sadly, we will need to move react_on_rails to v9 and bump us up to webpacker instead of webpacker_lite gem

@@ -35,11 +40,13 @@ const config = Object.assign(baseConfig, {
context: resolve(__dirname),

entry: {
'webpack-bundle': [
'moments-app_bundle': glob.sync('./app/bundles/momentsApp/startup/*'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

will we be separating bundles for momentsApp / alliesApp and etc going forward? Or only moments app due to the chart.js requirements?

Copy link
Contributor Author

@baohouse baohouse Apr 5, 2018

Choose a reason for hiding this comment

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

We should let webpack determine chunking. If we use UI routing, then this becomes far more feasible. Right now we're manually creating chunk entries, but that's not scalable. So we should move away from this. But in all honesty, I think the concept of a bundle makes more sense if it was Origin UI vs Kujali UI. When you have a MomentCard in the momentsApp bundle needing a component from the shared bundle, you can achieve the same effect if we put all components into a single folder and make two registration files, one for MomentsApp and one more Common. Or, well, like I said first, let webpack determine the chunking per route.

<%= stylesheet_pack_tag 'shared_bundle' %>

<!-- TODO: Need a way to load this bundle only on Moments pages -->
<%= javascript_pack_tag 'moments-app_bundle' %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

my thoughts here is that once we move the entirety of the app to React, we can just inject one bundle. This feels like a transition code atm.

@baohouse baohouse merged commit d8c4a98 into ifmeorg:master Apr 5, 2018
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.

3 participants