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/gh 1596/rewards icon simple view #407

Merged
merged 15 commits into from Jul 17, 2019

Conversation

@wlycdgr
Copy link
Member

@wlycdgr wlycdgr commented Jul 2, 2019

Implement a Rewards icon in the simple Summary view as per GH-1596

  • Have you followed the guidelines in CONTRIBUTING.md?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do?
  • Does your submission pass tests?
  • Did you lint your code prior to submission?
@wlycdgr wlycdgr requested a review from ghostery/ghostery as a code owner Jul 2, 2019
@wlycdgr wlycdgr requested review from IAmThePan and jsignanini Jul 2, 2019
@christophertino christophertino added this to the 8.4.1 milestone Jul 2, 2019
@wlycdgr wlycdgr requested a review from christophertino Jul 2, 2019
* Show the Rewards view
* Used to handle user clicking on the Rewards icon
*/
showRewardsView() {

This comment has been minimized.

@IAmThePan

IAmThePan Jul 2, 2019
Contributor

Do you use this or do you rely on the NavButton link? I'm noticing a bug when I click the Rewards button but not the SVG. It takes me to a blank Detail View.

This comment has been minimized.

@wlycdgr

wlycdgr Jul 3, 2019
Author Member

Fixed showRewardsView (renamed to showRewardsList) to correctly hanle click and convert the NavButtons to ReactSVGs to simplify & give showRewardsList sole responsibility.

This comment has been minimized.

@IAmThePan

IAmThePan Jul 9, 2019
Contributor

Please revert to use the NavButton. That way worked if you had only removed the onClick handler. This new implementation introduces two bugs:

  1. There is no cursor: pointer on the SVG. There should be because it makes sense as you can click the SVG and also because the Historical Stats link above has it.
  2. You can click the box around the SVG while you can't for Historical Stats.

Please make these as similar as possible by reverting to the old way of using NavButton (like the Historical Stats button does) and by removing the onClick handler (which again, the Historical Stats button doesn't have).

This comment has been minimized.

@wlycdgr

wlycdgr Jul 16, 2019
Author Member

I've made the UIs and implementations of the Historical Stats and Rewards navicons consistent, but by converting the Stats navicon to use ReactSVG also instead of reverting to NavButton for the Rewards navicon. I chose this solution because NavButton isn't sufficient to handle clicks on the Rewards navicon, which need to call toggleExpert in addition to pushing a new route onto the history stack. I think letting user click anywhere inside the bordered navicon area is, anyhow, more user-friendly than requiringt them to click on the icon itself. It's also more consistent with the click-on-donut behavior (clicking on empty space inside the donut works as well as clicking the donut itself). The cursor behavior is now consistent between the two navicons also.

return (
<div className={rewardsIconClassNames} onClick={this.showRewardsView}>
<NavButton path="/detail/rewards/list" imagePath="../../app/images/panel/rewards-icon.svg" />
{unreadOffersAvailable && <NavButton classNames="Summary__rewardsIcon__star" path="/detail/rewards/list" imagePath="../../app/images/panel/purple-star.svg" />}

This comment has been minimized.

@IAmThePan

IAmThePan Jul 2, 2019
Contributor

I haven't been able to test this because I don't know how to generate a reward...

This comment has been minimized.

@wlycdgr

wlycdgr Jul 3, 2019
Author Member

As per Vinnie's decision about this, the button should display regardless of whether any rewards (new or seen) are available, so long as the user has not turned Rewards off, so it should be enough to check that the icon takes the user to the Rewards list view, and that it does not display when Rewards are off. For testing the purple star appearance / logic, see next comment.

text-transform: capitalize;
}
// position the star SVG relative to the gift box SVG
.Summary__rewardsIcon__star {

This comment has been minimized.

@IAmThePan

IAmThePan Jul 2, 2019
Contributor

again, I'll check this when changes are made and I generate a reward.

This comment has been minimized.

@wlycdgr

wlycdgr Jul 3, 2019
Author Member

You can force the value of unreadOffersAvailable in Summary#_renderRewardsIcon to true to test the appearance/layout of the star. That bool is true wwhen the unread_offer_ids array sent from the background is not empty, and you can stub that array in PanelData#_getPanelData if you want to verify the transmission from background to the Summary component.

Copy link
Contributor

@IAmThePan IAmThePan left a comment

Hey, there are a few minor things and one minor bug. After those are fixed I'll test the ones with a reward.

app/panel/components/Summary.jsx Outdated Show resolved Hide resolved
wlycdgr and others added 6 commits Jul 3, 2019
…e them and update their snapshots.
…sponsibility for click handling to Summary#showRewardsList
@jsignanini jsignanini merged commit 8e4bf6f into develop Jul 17, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@jsignanini jsignanini deleted the feature/GH-1596/rewards-icon-simple-view branch Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants