Skip to content

Conversation

tofumatt
Copy link
Contributor

Working on showing errors in the disco pane; tests are failing right now and it's low-priority so just leaving here now but will revisit later.

@muffinresearch
Copy link
Contributor

@tofumatt - this looks to have bit-rotted, can it be updated and completed?

@muffinresearch
Copy link
Contributor

sad_keanu

@tofumatt tofumatt force-pushed the show-disabled-state-on-disco-pane-2095 branch from 3ebf6c2 to ca3f6fc Compare July 8, 2017 01:46
@tofumatt tofumatt changed the title WIP: feat: Show compatibility errors in Disco Pane (fix #2095) feat: Show compatibility errors in Disco Pane (fix #2095) Jul 8, 2017
@tofumatt tofumatt force-pushed the show-disabled-state-on-disco-pane-2095 branch from bf3ea0f to a86c26e Compare July 8, 2017 12:12
@tofumatt tofumatt requested a review from muffinresearch July 8, 2017 14:11
@tofumatt
Copy link
Contributor Author

tofumatt commented Jul 8, 2017

Alright, updated and fixed everything, here are some screenshots:

Small screen

screenshot 2017-07-08 02 45 11

Desktop

screenshot 2017-07-08 02 44 46
screenshot 2017-07-08 02 44 48

@muffinresearch
Copy link
Contributor

This is probably a @pwalm question but I wonder if the red could be dropped back a bit? The sea of red for a non-FF browser might be a bit much.

Copy link
Contributor

@muffinresearch muffinresearch 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

Looks good, I think the main issue here is tidying up the findDOMNode usage. FWIW we don't currently use the lint rule because the historical usage needs to be cleaned up. See https://github.com/mozilla/addons-frontend/issues/968


&,
a,
a:link {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any other states needed e.g: visited, hover, focus, active etc or are the defaults ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The defaults are fine, this just keeps the colour white which it will stay for those other states too.

i18n.gettext('from %(authorName)s, %(timestamp)s'),
{ authorName: review.userName, timestamp });

const reviewBodySanitized = sanitizeHTML(nl2br(review.body), ['br']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intermediate const needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It tidies up the next lines and makes it a bit more readable. I went back and forth on it and this was the nicest version.

throw new Error('minVersion is required; it cannot be undefined');
}

if (reason === INCOMPATIBLE_NOT_FIREFOX) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should never really happen since non non-FF browsers should ever see the disco pane.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but they could hit the URL and it doesn't hurt to have nice messages. Could also happen if the UA was weird and might be useful in a bug report...

That said it increases code size. If you want, I can remove this if we care a lot less about other clients in the Disco Pane, which I guess we do.


expect(preventDefault.called).toBeTruthy();
expect(installTheme.calledWith(themeImage, data.addon)).toBeTruthy();
sinon.assert.calledWith(installTheme, themeImage);
Copy link
Contributor

Choose a reason for hiding this comment

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

is data.addon no longer passed?

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 was actually a case of "how did this test ever work?" since updating the withInstallButton HOC. I fixed it up using enzyme... but we should definitely clean up this test suite in general...

const root = renderAddon({ addon: result, ...result });
expect(root.heading.textContent).toContain('test-heading');

expect(findDOMNode(root).querySelector('.heading').textContent)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@tofumatt tofumatt Jul 10, 2017

Choose a reason for hiding this comment

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

It is, and we'll be moving to enzyme, but I didn't want to refactor these tests at the time. I could do it now if you like but this isn't our only usage of findDomNode 😄

(The refs weren't working, so I moved to the DOM queries.)


it('renders a notice for old versions of Firefox', () => {
const root = render({
lang: 'fr',
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems a little odd to pass lang and then be looking for english translations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's true, I'll tweak that.

@tofumatt tofumatt force-pushed the show-disabled-state-on-disco-pane-2095 branch from a86c26e to 1771519 Compare July 10, 2017 19:18
@tofumatt tofumatt merged commit 77c2a5b into master Jul 10, 2017
@tofumatt tofumatt deleted the show-disabled-state-on-disco-pane-2095 branch July 10, 2017 21:47
@pwalm
Copy link
Contributor

pwalm commented Jul 12, 2017

The red is a bit much, isn't it. I would suggest we put that "You need to..." notification between the intro copy and the first add-on, and remove or make inactive the "Add to Firefox"/"Install Theme" buttons.

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