Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 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
cf2e245
prototype 10 results at a time in the category view
sarahfossheim Feb 12, 2025
089b8a5
add pagination info
sarahfossheim Feb 13, 2025
7910595
style description
sarahfossheim Feb 13, 2025
7e8f7e0
add basic skip-to-main links
sarahfossheim Feb 13, 2025
cbd5d64
Merge branch 'main' into cwvtech-paginated
sarahfossheim Feb 24, 2025
d1db998
paginate table and update selection correctly
sarahfossheim Feb 28, 2025
3886133
update linting
sarahfossheim Mar 1, 2025
a5180bd
merge
sarahfossheim Mar 1, 2025
d07af8e
linting
sarahfossheim Mar 1, 2025
e9e1acc
fix select button label bug
sarahfossheim Mar 2, 2025
4fd775b
only fetch category and technology names in the dropdowns
sarahfossheim Mar 2, 2025
7730c71
Merge branch 'main' into cwvtech-paginated
sarahfossheim Mar 3, 2025
1e8ab9e
prototype overview of selected techs
sarahfossheim Mar 3, 2025
98d9845
limit selection up to 10 and allow unselection from summary
sarahfossheim Mar 4, 2025
82b9eef
don't programmatically set style attribute on elements that don't exist
sarahfossheim Mar 4, 2025
6d81ac9
add row selector
sarahfossheim Mar 19, 2025
515f280
remove console.log
sarahfossheim Mar 19, 2025
eb7183a
remove unused import
sarahfossheim Mar 20, 2025
9303ce4
linting
sarahfossheim Mar 20, 2025
e66d605
add values to options
sarahfossheim Mar 20, 2025
77a7652
split up rows selector options
sarahfossheim Mar 21, 2025
10d9ad7
Update src/js/components/filters.js
sarahfossheim Mar 22, 2025
c93975f
Update src/js/components/filters.js
sarahfossheim Mar 22, 2025
f9d2919
Update src/js/techreport/tableLinked.js
sarahfossheim Mar 22, 2025
ca09b2d
Update src/js/techreport/utils/data.js
sarahfossheim Mar 22, 2025
ce51ccd
use encodeURI instead of replaceAll
sarahfossheim Mar 22, 2025
1bf214a
Merge remote-tracking branch 'refs/remotes/origin/cwvtech-paginated' …
sarahfossheim Mar 22, 2025
3b29eaa
fix bugs, prefill table comparison view
sarahfossheim Mar 27, 2025
2e1b56a
fix indent
sarahfossheim Mar 27, 2025
2000b52
set lower default progress bar value
sarahfossheim Mar 27, 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
6 changes: 3 additions & 3 deletions config/techreport.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@
"#E24070"
],
"overrides": {
"WordPress": "#3858e9",
"ALL": "#69797e"
}
},
Expand All @@ -719,6 +718,7 @@
"id": "tech_comparison_summary",
"table": {
"caption": "Summary",
"prefill": "tech",
"columns": [
{
"key": "technology",
Expand Down Expand Up @@ -1159,14 +1159,14 @@
"endpoint": "category",
"metric": "origins",
"label": "Origins",
"description": "Origins analyzed in this category.",
"description": "Total amount of origins analyzed in this category.",
"key": "info"
},
{
"endpoint": "category",
"metric": "technologies",
"label": "Technologies",
"description": "Amount of technologies in this category.",
"description": "Total number of technologies tagged with this category.",
"key": "info"
}
],
Expand Down
14 changes: 13 additions & 1 deletion server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,24 @@ def techreportlanding(page_id):
# Get the filters
requested_geo = request.args.get("geo") or "ALL"
requested_rank = request.args.get("rank") or "ALL"
requested_category = request.args.get("category") or "ALL"
requested_category = request.args.get("category") or "CMS"
requested_page = request.args.get("page") or 1
requested_page = int(requested_page)
selected_techs = request.args.get("selected")
selected_rows = request.args.get("rows") or 10
selected_rows = str(selected_rows)

last_page = request.args.get("last_page") or False

filters = {
"geo": requested_geo,
"rank": requested_rank,
"app": requested_technologies,
"category": requested_category,
"page": requested_page,
"last_page": last_page,
"selected": selected_techs,
"rows": selected_rows,
}
params = {
"geo": requested_geo.replace(" ", "+"),
Expand Down
21 changes: 8 additions & 13 deletions src/js/components/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,31 @@ class Filters {

/* Update the list of technologies */
updateTechnologies() {
this.technologies = DataUtils.filterDuplicates(this.technologies, 'technology');

/* Get existing tech selectors on the page */
const allTechSelectors = document.querySelectorAll('select[name="tech"]');
const techNames = this.technologies.map(element => element.app);

/* Update the options inside all of the selectors */
allTechSelectors.forEach(techSelector => {
techSelector.innerHTML = '';

/* If the technology doesn't exist, throw a warning */
const techNamesFiltered = techNames;
if(!techNamesFiltered) {
if(!this.technologies) {
const errorMsg = document.createElement('p');
errorMsg.textContent = 'Technology not found, please select a different one';
techSelector.before(errorMsg);
}

/* Get a list of technologies */
const techs = this.technologies;
techs.unshift({ technology: 'ALL' });

/* Add one option per technology */
if(document.getElementById('filter-option')) {
techs.forEach((technology) => {
const optionTmpl = document.getElementById('filter-option').content.cloneNode(true);
const option = optionTmpl.querySelector('option');
const formattedTech = DataUtils.formatAppName(technology.technology);
const formattedTech = DataUtils.formatAppName(technology);
option.textContent = formattedTech;
option.value = technology.technology;
option.value = technology;
if(formattedTech === techSelector.getAttribute('data-selected')) {
option.selected = true;
}
Expand Down Expand Up @@ -161,17 +156,17 @@ class Filters {

const all = document.createElement('option');
all.value = 'ALL';
all.innerHTML = 'ALL';
all.textContent = 'ALL';
select.append(all);

const sortedCategories = this.categories.sort((a, b) => a.category !== b.category ? a.category < b.category ? -1 : 1 : 0);
const sortedCategories = this.categories.sort((a, b) => a !== b ? a < b ? -1 : 1 : 0);
sortedCategories.forEach((category) => {
const option = document.createElement('option');
if(category.category === select.getAttribute('data-selected')) {
if(category === select.getAttribute('data-selected')) {
option.selected = true;
}
option.value = category.category;
option.innerHTML = category.category;
option.value = category;
option.textContent = category;
select.append(option);
});
})
Expand Down
106 changes: 24 additions & 82 deletions src/js/techreport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ class TechReport {
break;

case 'category': {
const category = this.filters.category || 'CMS';
this.initializeReport();
this.getCategoryData(category);
this.getCategoryData();
break;
}
}
Expand Down Expand Up @@ -277,83 +276,9 @@ class TechReport {
});
}

getCategoryData(category) {
const url = `${Constants.apiBase}/categories?category=${category}`;
const apis = [
{
endpoint: 'cwv',
metric: 'vitals',
parse: DataUtils.parseVitalsData,
},
{
endpoint: 'lighthouse',
metric: 'lighthouse',
parse: DataUtils.parseLighthouseData,
},
{
endpoint: 'adoption',
metric: 'adoption',
parse: DataUtils.parseAdoptionData,
},
{
endpoint: 'page-weight',
metric: 'pageWeight',
parse: DataUtils.parsePageWeightData,
},
];

fetch(url)
.then(result => result.json())
.then(result => {
const category = result[0];
const technologyFormatted = category?.technologies?.join('%2C')
.replaceAll(" ", "%20");

const geo = this.filters.geo.replaceAll(" ", "%20");
const rank = this.filters.rank.replaceAll(" ", "%20");
const geoFormatted = geo.replaceAll(" ", "%20");
const rankFormatted = rank.replaceAll(" ", "%20");

let allResults = {};
category.technologies.forEach(tech => allResults[tech] = []);

Promise.all(apis.map(api => {
const url = `${Constants.apiBase}/${api.endpoint}?technology=${technologyFormatted}&geo=${geoFormatted}&rank=${rankFormatted}&start=latest`;

return fetch(url)
.then(techResult => techResult.json())
.then(techResult => {
techResult.forEach(row => {
const parsedRow = {
...row,
}

if(api.parse) {
parsedRow[api.metric] = api.parse(parsedRow[api.metric], parsedRow?.date);
}

const resIndex = allResults[row.technology].findIndex(res => res.date === row.date);
if(resIndex > -1) {
allResults[row.technology][resIndex] = {
...allResults[row.technology][resIndex],
...parsedRow
}
} else {
allResults[row.technology].push(parsedRow);
}
});
});
})).then(() => {
category.data = {
technologies: allResults,
info: {
origins: category.origins,
technologies: Object.keys(allResults).length,
},
};
this.updateCategoryComponents(category);
});
});
getCategoryData() {
const callback = this.updateCategoryComponents.bind(this);
DataUtils.fetchCategoryData(this.filters.rows, this.filters, callback)
}

// Get the information about the selected technology
Expand Down Expand Up @@ -411,14 +336,31 @@ class TechReport {
getFilterInfo() {
const filterData = {};

const filterApis = ['categories', 'technologies', 'ranks', 'geos'];
const filterApis = [
{
name: 'categories',
endpoint: 'categories?onlyname',
},
{
name: 'technologies',
endpoint: 'technologies?onlyname',
},
{
name: 'ranks',
endpoint: 'ranks',
},
{
name: 'geos',
endpoint: 'geos',
},
];

Promise.all(filterApis.map(api => {
const url = `${Constants.apiBase}/${api}`;
const url = `${Constants.apiBase}/${api.endpoint}`;

return fetch(url)
.then(result => result.json())
.then(result => filterData[api] = result)
.then(result => filterData[api.name] = result)
.catch(error => console.log('Something went wrong', error));
})).then(() => {
const FilterComponent = new Filters(filterData, this.filters);
Expand Down
Loading
Loading