Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Fix #274: Add UR study participation UI #278

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

biancadanforth
Copy link
Collaborator

@biancadanforth biancadanforth commented Nov 19, 2018

@Osmose Ready for your review!

I'm awaiting two things still from other folks (pinged them this morning in slack; adding a DNM label for now):

  • sharonbautista: Final survey URL with Mozilla-branded domain
  • bryanbell: Final study screen hero image

Notes:

Notes:
- I had to put the copy in brackets in StudyInvitation.jsx to be able to use the apostrophe it contains. This avoids the eslint rule error react/no-unescaped-entities.
- The panels are wider than bryanbell's mocks, but the PR for mozilla#256 will fix that.
@biancadanforth biancadanforth added the [ENG]: Do not merge Do not merge this pull request label Nov 19, 2018
Copy link
Contributor

@Osmose Osmose left a comment

Choose a reason for hiding this comment

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

r+wc. I'm assuming you'll swap out the hero image before landing this. Nice work!

* in the Study popup is clicked
*/
handleClickParticipate() {
browser.tabs.create({url: 'https://www.surveygizmo.com/s3/4693160/Price-Wise-Research-Study-Participant-Screener'});
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in the config?

render() {
const {products} = this.props;
const {extractedProduct} = this.state;
const {extractedProduct, showStudyInvitation} = this.state;
if (showStudyInvitation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a config check here so that we can quick-disable this when it's time to stop recruiting? We can put up a PR changing the config default and just deploy that, and then remove the code itself later without the pressure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added this feature flag check in the <StudyFooter /> component, which gates the showStudyInvitation value.

@@ -49,6 +51,7 @@ export default class BrowserActionApp extends React.Component {
super(props);
this.state = {
extractedProduct: props.extractedProduct,
showStudyInvitation: false,
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 is fine for this PR, but if we add any other "views" like this we should look into writing some sort of router or something that manages which view is "active". Otherwise figuring out which pages is active and the flow through pages will involve some complex if/then logic and several booleans like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you share an example of what that might look like?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could be as simple as:

class BrowserActionApp {
  constructor(props) {
    super(props);
    this.state = {
      currentPage: 'productListing',
    };
  }

  render() {
    switch (this.state.currentPage) {
      case 'productListing':
        return <TrackedProductList />;
      case 'studyEnrollment':
        return <StudyEnrollment />;
    }
  }
}

Or something as complex as React Router, depending on our needs.

return (
<button
type="button"
className="menu-item study"
Copy link
Contributor

Choose a reason for hiding this comment

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

These CSS classes are working out better than I expected.

className="menu-item study"
onClick={this.props.onClick}
>
Help us improve Price Wise...
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using &hellip; here instead of three periods for the ellipsis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why is this preferred?

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes the ellipsis a single character (which, semantically, it is), and also it is a visually different glyph vs three consecutive periods.


/** Components for the StudyInvitation screen */

.title-bar.study {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we ever add a permanent screen with a layout this similar to the onboarding, we should factor out the styles to be reused between the two. For this temporary page, copying them here like you've done is a fine solution.

<div className="study-invitation">
<img className="hero" src={browser.extension.getURL('img/shopping-welcome.svg')} alt="" />
<p className="description">
{"Help us improve Price Wise by participating in a research study. Take this 5-minute survey to learn more about the study and see if you're a fit."}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the {""} surrounding the text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to put the copy in brackets in StudyInvitation.jsx to be able to use the apostrophe it contains. This avoids the eslint rule error react/no-unescaped-entities. Reference

Copy link
Contributor

Choose a reason for hiding this comment

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

The HTML entity version of the apostrophe &apos is my preferred alternative, but it's an incredibly minor distinction.

Also incorporate feedback from Osmose, including the feature flag 'enableStudyUI' in config.js to turn on/off the UI.
@biancadanforth biancadanforth merged commit 263cd73 into mozilla:master Nov 19, 2018
@biancadanforth biancadanforth deleted the 274-research-study branch November 19, 2018 23:35
@biancadanforth biancadanforth removed the [ENG]: Do not merge Do not merge this pull request label Nov 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants