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

Tech Report: Visual improvements #999

Merged
merged 46 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d3987bf
custom techreport header
sarahfossheim Aug 28, 2024
b21cc6e
add prototype categories page
sarahfossheim Aug 28, 2024
04628eb
add filters in sidebar and change page based on amount of techs
sarahfossheim Aug 30, 2024
07171f7
add new nav and filter structure (wip
sarahfossheim Sep 4, 2024
c312252
responsive filters prototype
sarahfossheim Sep 17, 2024
706d6f0
wip: add collapsible filter sidebar
sarahfossheim Sep 24, 2024
fa8c689
fix bug with double close button
sarahfossheim Sep 24, 2024
e58f7ce
add aria
sarahfossheim Sep 24, 2024
7f837c1
merge in master
sarahfossheim Sep 25, 2024
6b24d96
add checkboxes on category page, update texts, minor bugfixes
sarahfossheim Oct 18, 2024
cf7c0e8
select correct technology in comparison view, remove category selecto…
sarahfossheim Oct 23, 2024
bf11a13
fix css linting
sarahfossheim Oct 23, 2024
ce8df02
fix linting
sarahfossheim Oct 23, 2024
bc5af01
Merge branch 'main' into cwvtech-category-dashboard
sarahfossheim Oct 30, 2024
b74de3b
fix linting
sarahfossheim Oct 30, 2024
728d42f
Merge remote-tracking branch 'refs/remotes/origin/cwvtech-category-da…
sarahfossheim Oct 30, 2024
0d062cc
fix sorting order multi apps
sarahfossheim Oct 30, 2024
aea33e1
sort table alternative correctly
sarahfossheim Nov 8, 2024
7aaf182
merge main into branch
sarahfossheim Nov 18, 2024
fea35f0
close <nav>
sarahfossheim Nov 19, 2024
c16fe45
merge master into branch
sarahfossheim Dec 3, 2024
3987516
update tests
sarahfossheim Dec 18, 2024
5a45a40
format tests
sarahfossheim Dec 18, 2024
d67c907
Update src/js/techreport/tableLinked.js
sarahfossheim Dec 18, 2024
7820ed5
fix geo/rank bug, long category list bug, adoption bug, add category …
sarahfossheim Jan 7, 2025
cd10b24
add technologies to summary in category page
sarahfossheim Jan 8, 2025
273d19b
add timestamp to category page and format large numbers
sarahfossheim Jan 12, 2025
37dbaeb
remove console.log
sarahfossheim Jan 12, 2025
d861090
select correct technology in comparison view filters
sarahfossheim Jan 15, 2025
3a125ad
make menu responsive on mobile + track aria-expanded status
sarahfossheim Jan 16, 2025
062bf5b
give remove button icon alt that matches the label
sarahfossheim Jan 16, 2025
f664a28
filter out data with empty content
sarahfossheim Jan 16, 2025
7fb726e
fix linting
sarahfossheim Jan 16, 2025
9a905c3
add width and height to close filter button
sarahfossheim Jan 16, 2025
163cdc3
remove placeholder texts
sarahfossheim Jan 16, 2025
895007c
add icons and chart to the summary tables
sarahfossheim Jan 16, 2025
cb20cb9
add descriptions to technologies
sarahfossheim Jan 16, 2025
0d294f0
style lighthouse cards
sarahfossheim Jan 18, 2025
d55c098
add lighthouse progress circles to table
sarahfossheim Jan 19, 2025
341485e
edit styling of the client dropdown selector
sarahfossheim Jan 19, 2025
ca8219e
move breakdown selector to top of page
sarahfossheim Jan 19, 2025
8441396
add LH circles to table alt, category descriptions, tech img
sarahfossheim Feb 4, 2025
f65cfe9
update colors and change linting
sarahfossheim Feb 5, 2025
f88c22b
add origin fix
sarahfossheim Feb 13, 2025
7f5b76c
Merge branch 'main' into cwvtech-visuals
tunetheweb Feb 13, 2025
4721b49
remove duplicate client-breakdowns
sarahfossheim Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 42 additions & 23 deletions config/techreport.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,32 @@
"category": "performance",
"metric": "median_score_pct",
"label": "Performance",
"url": "?median-lighthouse-over-time=performance#lighthouse"
"url": "?median-lighthouse-over-time=performance#lighthouse",
"description": "Median Lighthouse <strong>performance</strong> score."
},
{
"endpoint": "lighthouse",
"category": "accessibility",
"metric": "median_score_pct",
"label": "Accessibility",
"url": "?median-lighthouse-over-time=accessibility#lighthouse"
"url": "?median-lighthouse-over-time=accessibility#lighthouse",
"description": "Median Lighthouse <strong>accessibility</strong> score."
},
{
"endpoint": "lighthouse",
"category": "seo",
"metric": "median_score_pct",
"label": "SEO",
"url": "?median-lighthouse-over-time=seo#lighthouse"
"url": "?median-lighthouse-over-time=seo#lighthouse",
"description": "Median Lighthouse <strong>SEO</strong> score."
},
{
"endpoint": "lighthouse",
"category": "best_practices",
"metric": "median_score_pct",
"label": "Best Practices",
"url": "?median-lighthouse-over-time=best_practices#lighthouse"
"url": "?median-lighthouse-over-time=best_practices#lighthouse",
"description": "Median Lighthouse <strong>best practices</strong> score."
}
]
},
Expand Down Expand Up @@ -470,7 +474,8 @@
{
"key": "median_score_pct",
"name": "Median score",
"className": "main-cell"
"className": "main-cell",
"viz": "progress-circle"
},
{
"key": "client",
Expand Down Expand Up @@ -676,16 +681,16 @@
"config": {
"colors": {
"app": [
"#5980EB",
"#D55316",
"#2C2F70",
"#68A16D",
"#B979A7",
"#AC8D1C",
"#742F53",
"#449DB1",
"#8E3496",
"#CB377C"
"#ED5FB4",
"#322288",
"#6DA072",
"#E47112",
"#4E9CC8",
"#e51607",
"#616F0D",
"#7D58CD",
"#ba7cb0",
"#882155"
],
"app_dark": [
"#5980EB",
Expand Down Expand Up @@ -730,21 +735,32 @@
},
{
"key": "good_pct",
"name": "Overall good CWV",
"name": "Good CWVs",
"breakdown": "subcategory",
"subcategory": "overall",
"suffix": "%",
"className": "main-cell pct-value",
"viz": "progress",
"className": "cwv-cell main-cell pct-value",
"endpoint": "vitals",
"metric": "good_pct"
},
{
"key": "medium_score_pct",
"name": "Accessibility",
"name": "Perf.",
"breakdown": "subcategory",
"subcategory": "performance",
"endpoint": "lighthouse",
"metric": "median_score_pct",
"viz": "progress-circle"
},
{
"key": "medium_score_pct",
"name": "A11Y",
"breakdown": "subcategory",
"subcategory": "accessibility",
"endpoint": "lighthouse",
"metric": "median_score_pct"
"metric": "median_score_pct",
"viz": "progress-circle"
},
{
"key": "client",
Expand Down Expand Up @@ -904,7 +920,8 @@
"key": "median_score_pct",
"name": "Median lighthouse score",
"breakdown": "app",
"className": "main-cell"
"className": "main-cell",
"viz": "progress-circle"
},
{
"key": "client",
Expand Down Expand Up @@ -1163,7 +1180,8 @@
"key": "selectTech",
"name": "Select technology",
"hiddenName": true,
"type": "checkbox"
"type": "checkbox",
"className": "check-cell"
},
{
"key": "technology",
Expand All @@ -1180,11 +1198,12 @@
},
{
"key": "good_pct",
"name": "Good CWV",
"name": "Good CWVs",
"breakdown": "subcategory",
"subcategory": "overall",
"suffix": "%",
"className": "main-cell pct-value",
"viz": "progress",
"className": "cwv-cell main-cell pct-value",
"endpoint": "vitals",
"metric": "good_pct"
},
Expand Down
16 changes: 16 additions & 0 deletions src/js/components/drilldownHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { DataUtils } from "../techreport/utils/data";
function setTitle(title) {
const mainTitle = document.querySelector('h1 span.main-title');
mainTitle.textContent = title;

const img = document.createElement('img');
const imgUrl = `https://cdn.httparchive.org/static/icons/${title}.png`;
img.setAttribute('aria-hidden', 'true');
img.setAttribute('alt', '');
img.setAttribute('src', imgUrl);
img.classList.add('title-img');
mainTitle.append(img);
}

function setCategories(categories) {
Expand Down Expand Up @@ -30,6 +38,13 @@ function setCategories(categories) {
}
}

function setDescription(description) {
if(description && description !== "") {
const descr = document.querySelector('p.app-description');
descr.textContent = description;
}
}

function update(filters) {
const app = filters.app[0];

Expand All @@ -42,4 +57,5 @@ function update(filters) {
export const DrilldownHeader = {
update,
setCategories,
setDescription,
}
2 changes: 2 additions & 0 deletions src/js/techreport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ class TechReport {

const categories = techInfo && techInfo.category ? techInfo.category.split(', ') : [];
DrilldownHeader.setCategories(categories);
DrilldownHeader.setDescription(techInfo.description);
});
}

updateCategoryComponents (category) {
this.updateComponents(category.data);
DrilldownHeader.setDescription(category.description);
}

// Update components and sections that are relevant to the current page
Expand Down
2 changes: 2 additions & 0 deletions src/js/techreport/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Section {
this.components[component.dataset.id] = new TableLinked(
component.dataset.id,
this.pageConfig,
this.config,
this.pageFilters,
this.data
);
Expand All @@ -60,6 +61,7 @@ class Section {
this.components[component.dataset.id] = new Timeseries(
component.dataset.id,
this.pageConfig,
this.config,
this.pageFilters,
this.data
);
Expand Down
7 changes: 3 additions & 4 deletions src/js/techreport/summaryCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ class SummaryCard {
const valueSlot = card.querySelector('[data-slot="value"]');
valueSlot.innerHTML = latestValue?.toLocaleString();

const progress = card.querySelectorAll('.lighthouse-progress');
const progress = card.querySelectorAll('.progress-circle');
progress.forEach(circle => {
const scoreCategory = DataUtils.getLighthouseScoreCategories(latestValue, this.config.lighthouse_brackets);
const scoreCategoryName = scoreCategory?.name;
circle.setAttribute('style', `--offset: ${100 - latestValue};`);
const chart = card.querySelector('svg.progress-chart');
chart.classList.add(scoreCategoryName);
circle.setAttribute('style', `--offset: ${latestValue}%;`);
circle.classList.add(scoreCategoryName);
});

}
Expand Down
10 changes: 9 additions & 1 deletion src/js/techreport/table.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { DataUtils } from "./utils/data";

function formatData(tableConfig, data) {
const { id, config, apps } = tableConfig;

Expand Down Expand Up @@ -100,7 +102,7 @@ function getSubcategory(config) {
}

// Update the table
function updateTable(id, config, apps, data) {
function updateTable(id, config, appConfig, apps, data) {
// Select a table based on the passed in id
const component = document.getElementById(`table-${id}`)
const tbody = component.querySelector('tbody');
Expand Down Expand Up @@ -178,6 +180,12 @@ function updateTable(id, config, apps, data) {
cell.className = className;
}

if(column.viz === 'progress-circle' && value) {
const score = DataUtils.getLighthouseScoreCategories(value, appConfig.lighthouse_brackets);
wrapper.classList.add('progress-circle', score.name);
wrapper.setAttribute('style', `--offset: ${value}%`);
}

// Add cell to the row
tr.appendChild(cell);
});
Expand Down
34 changes: 28 additions & 6 deletions src/js/techreport/tableLinked.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { DataUtils } from "./utils/data";

class TableLinked {
constructor(id, config, filters, data) {
constructor(id, pageConfig, globalConfig, filters, data) {
this.id = id;
this.pageConfig = config;
this.config = globalConfig;
this.pageConfig = pageConfig;
this.pageFilters = filters;
this.submetric = ''; // TODO: Fetch the default one from somewhere
this.data = data;
Expand Down Expand Up @@ -92,6 +93,15 @@ class TableLinked {
let cell;
if(column.type === 'heading') {
cell = document.createElement('th');
cell.classList.add('app-cell');

const img = document.createElement('span');
const imgUrl = `https://cdn.httparchive.org/static/icons/${formattedApp}.png`;
img.setAttribute('aria-hidden', 'true');
img.setAttribute('style', `background-image: url(${imgUrl})`);
img.classList.add('app-img');
cell.append(img);

const link = document.createElement('a');
link.setAttribute('href', `/reports/techreport/tech?tech=${app}&geo=${geo}&rank=${rank}`);
link.innerHTML = formattedApp;
Expand Down Expand Up @@ -123,24 +133,36 @@ class TableLinked {
cell.append(checkbox);

const label = document.createElement('label');
label.innerHTML = formattedApp;
label.innerHTML = `Select ${formattedApp}`;
label.classList.add('sr-only');
label.setAttribute('for', `${app}-table-${this.id}`);
cell.append(label);

cell.classList.add('check-cell');
} else if(column.key === 'client') {
cell = document.createElement('td');
cell.innerHTML = component.dataset.client;
} else {
const cellContent = document.createElement('span');
cell = document.createElement('td');
const dataset = latest?.[column?.endpoint];
let value = dataset?.find(entry => entry.name === column.subcategory);
value = value?.[component.dataset.client]?.[column?.metric];
if(column.suffix) {
cell.innerHTML = `${value?.toLocaleString()}${column.suffix}`;
cellContent.innerHTML = `${value?.toLocaleString()}${column.suffix}`;
} else {
cell.innerHTML = `${value?.toLocaleString()}`;
cellContent.innerHTML = `${value?.toLocaleString()}`;
}

if(column.viz === 'progress') {
cell.setAttribute('style', `--cell-value: ${value}%`);
cell.dataset.value = value;
} else if(column.viz === 'progress-circle') {
const score = DataUtils.getLighthouseScoreCategories(value, this.config.lighthouse_brackets);
cellContent.classList.add('progress-circle', score.name);
cellContent.setAttribute('style', `--offset: ${value}%`);
}

cell.append(cellContent);
}

if(column.className) {
Expand Down
7 changes: 4 additions & 3 deletions src/js/techreport/timeseries.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { DataUtils } from "./utils/data";
import { UIUtils } from "./utils/ui";
class Timeseries {
// Create the component
constructor(id, config, filters, data) {
constructor(id, pageConfig, config, filters, data) {
this.id = id;
this.pageConfig = config;
this.pageConfig = pageConfig;
this.config = config;
this.pageFilters = filters;
this.submetric = ''; // TODO: Fetch the default one from somewhere
this.data = data;
Expand Down Expand Up @@ -80,7 +81,7 @@ class Timeseries {
this.updateSummary();
}
this.updateViz();
Table.updateTable(this.id, this.pageConfig[this.id]?.table, this.pageFilters.app, this.data);
Table.updateTable(this.id, this.pageConfig[this.id]?.table, this.config, this.pageFilters.app, this.data);
}

// Update the summary with the latest data for all categories
Expand Down
Loading
Loading