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

Report: don't display score gauge header if there's only one. #2261

Merged
merged 5 commits into from Jun 22, 2017

Conversation

paulirish
Copy link
Member

Got tired of looking at tops of my perf/a11y reports that look like this:
image

This PR doesn't show the overview gauges if there's only one.

for (const category of report.reportCategories) {
scoreHeader.appendChild(this._categoryRenderer.renderScoreGauge(category));
if (!isSoloCategory)
Copy link
Member

Choose a reason for hiding this comment

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

I thought we didn't allow no braces multiline if statement

Copy link
Member Author

Choose a reason for hiding this comment

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

au contraire!

(it was a surprise to me, too)

Copy link
Member

Choose a reason for hiding this comment

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

#2263 :P


container.appendChild(this._renderReportHeader(report)); // sticky header goes at the top.
container.appendChild(this._renderReportNav(report));

const reportSection = container.appendChild(this._dom.createElement('div', 'lh-report'));

const scoreHeader = reportSection.appendChild(
this._dom.createElement('div', 'lh-scores-header'));
const scoreHeaderClass = `lh-scores-header ${isSoloCategory ? 'lh-scores-header__solo' : ''}`;
Copy link
Member

Choose a reason for hiding this comment

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

Can we just not have a score header if < 2 categories?

Copy link
Member Author

Choose a reason for hiding this comment

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

well i was thinking that too, but our styling uses that header's margin to get out from under the pos:fixed header.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok so the better fix would be to put that margin on something else.
i guess that's the action necessary here.

@paulirish
Copy link
Member Author

@brendankenny ptal

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -139,18 +139,22 @@ class ReportRenderer {
*/
_renderReport(report) {
const container = this._dom.createElement('div', 'lh-container');
const isSoloCategory = report.reportCategories.length === 1;
let scoreHeader;
Copy link
Member

Choose a reason for hiding this comment

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

move these two lines down to above if (!isSoloCategory) {?

@brendankenny
Copy link
Member

style nit still applies but other than that, still looks good :P

@paulirish paulirish merged commit e0e2966 into master Jun 22, 2017
@paulirish paulirish deleted the scoresheader0 branch June 22, 2017 00:28
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.

None yet

2 participants