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: new score display, metrics display, rich tooltips #5009

Merged
merged 15 commits into from
Apr 24, 2018
Merged

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Apr 21, 2018

Score display

New gauges, done in SVG instead of crazytime css. Added in the score scale.

Oh, they animate, too. :) (easy to remove if everyone h8s it.)

Before:

image

After:

image

And check out the difference in CC layers:

Metrics display

Not 100% finished but getting there.

image

I've added in a rich tooltip system to support this and other things.. here's how it works:

<div class="tooltip-boundary">  <!-- any hover within this element will show the tooltip -->
	<!-- stuff that you see.. -->
    <div class="tooltip"> ... </div> <!-- hidden by default. can contain w/e -->
</div>

#ref #5008

@vinamratasingal-zz
Copy link

This looks AMAZING! CC: @hwikyounglee

I especially love the initial animation, makes the UI look #snazzy. Thanks @paulirish !

const gauge = this.dom.find('.lh-gauge', tmpl);
gauge.setAttribute('data-progress', scoreOutOf100); // .dataset not supported in jsdom.
gauge.classList.add(`lh-gauge--${Util.calculateRating(category.score)}`);
wrapper.classList.add(`lh-gauge__wrapper--${Util.calculateRating(category.score)}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit let's move this up to where we add the href?

const otherMetrics = metricAudits.filter(a => a.weight < 3);

const metricsBoxesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-metrics-container');
const keyBox = this.dom.createChildOf(metricsBoxesEl, 'div', 'lh-metrics lh-metrics__key');
Copy link
Collaborator

Choose a reason for hiding this comment

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

key is a bit confusing on it's own, but headline and primary aren't exactly much clearer 🤔 IDK

Copy link
Member

Choose a reason for hiding this comment

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

maybe just adding in Metrics is enough? like keyMetricsBox?


.lh-metrics {
flex: 1;
margin-right: 20px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is to separate the boxes, or just right padding?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah its just this gap in the middle.
image

Copy link
Collaborator

@patrickhulce patrickhulce Apr 23, 2018

Choose a reason for hiding this comment

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

gotcha, should we call this lh-metrics-column or something then?

Copy link
Member Author

Choose a reason for hiding this comment

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

good call. 👍

.lh-timeline-metric--fail .lh-timeline-metric__value {
color: var(--fail-color);
.lh-perf-metric--pass .lh-perf-metric__value span::after {
background: url('data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2"><circle class="path circle" fill="#73AF55" cx="65.1" cy="65.1" r="62.1"/><polyline class="path check" fill="none" stroke="white" stroke-width="16" stroke-linecap="round" stroke-miterlimit="10" points="100.2,40.2 51.5,88.8 29.8,67.5 "/></svg>') no-repeat 50% 50%;
Copy link
Collaborator

Choose a reason for hiding this comment

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

oooh this is the circle with a checkmark? could add a quick comment what shape each of these SVGs are? :) i.e. /* circle with checkmark */
/* triangle with exclamation point */..

Copy link
Member Author

Choose a reason for hiding this comment

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

great idea. will do when i update to hwi's new assets.

position: absolute;
right: var(--section-padding);
bottom: var(--section-padding);
color: #757575;
Copy link
Collaborator

Choose a reason for hiding this comment

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

stick this in var or reuse?

const otherMetrics = metricAudits.filter(a => a.weight < 3);

const metricsBoxesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-metrics-container');
const keyBox = this.dom.createChildOf(metricsBoxesEl, 'div', 'lh-metrics lh-metrics__key');
Copy link
Member

Choose a reason for hiding this comment

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

maybe just adding in Metrics is enough? like keyMetricsBox?

<div class="lh-timeline-metric__description"><!-- fill me --></div>
</details>
</div>
<template id="tmpl-lh-perf-metric">
Copy link
Member

Choose a reason for hiding this comment

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

update comment above?

@@ -5347,6 +5347,6 @@
}
},
"timing": {
"total": 830
"total": 1142
Copy link
Member

@brendankenny brendankenny Apr 23, 2018

Choose a reason for hiding this comment

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

no need to update

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

I'm not 100% sure I'm going to grok the SVG animation stuff, but LGTM outside bit o' cleanup/pending comments on incoming icons :)

so slick! awesome teamwork @hwikyounglee @paulirish !


const metricsBoxesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-metrics-container');
const metricsColumn1El = this.dom.createChildOf(metricsBoxesEl, 'div',
'lh-metrics-column lh-metrics-column__key');
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: seems like this should be a modifier on column rather than a child :) lh-metrics-column--key

Copy link
Member Author

Choose a reason for hiding this comment

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

lol i have been mixing up elements and modifier syntax for a while now.


/* Contain the layout style paint & layers during animation*/
contain: content;
will-change: opacity;
Copy link
Collaborator

Choose a reason for hiding this comment

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

does the opacity change? seems like it's just stroke-dasharray

Copy link
Member Author

Choose a reason for hiding this comment

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

it doesn't. just abusing it for a layer promotion.

border-radius: 50%;

.lh-gauge {
text-anchor: middle;
Copy link
Collaborator

Choose a reason for hiding this comment

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

so. much. TIL.

does any text actually go into the SVG though? what are the percentage elements for?

Copy link
Member Author

Choose a reason for hiding this comment

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

this property was old. removed now.

@paulirish paulirish merged commit d18e977 into master Apr 24, 2018
@paulirish paulirish deleted the report branch April 24, 2018 23:40
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 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.

5 participants