Skip to content

Commit e0c22b6

Browse files
Icon urls (#1106)
* Fix icon URLs * Revert unintended changes --------- Co-authored-by: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com>
1 parent 38db506 commit e0c22b6

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build": "webpack --config webpack.config.js --mode production",
1818
"watch": "webpack --config webpack.config.js --mode production --watch",
1919
"generate": "node ./tools/generate",
20+
"dev": "run-script-os",
2021
"start": "run-script-os",
2122
"start:darwin:linux": "./tools/scripts/run_and_test_website.sh -d",
2223
"start:win32": "call tools/scripts/run_and_test_website.bat",

src/js/techreport/combobox.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ class ComboBox {
2121
// Add options in the dropdown list
2222
const listbox = this.element.querySelector('[role="listbox"]');
2323
rows.forEach((row, index) => {
24+
const icon = row.icon;
2425
const option = document.createElement('div');
2526
option.setAttribute('role', 'option');
2627
option.setAttribute('aria-selected', 'false');
27-
option.dataset.name = row;
28+
option.dataset.name = row.technology;
2829
option.dataset.key = index;
29-
option.textContent = row;
30-
option.id = `${this.element.dataset.id}-${row.replaceAll(' ','-')}`;
30+
option.textContent = row.technology;
31+
option.id = `${this.element.dataset.id}-${row.technology.replaceAll(' ','-')}`;
3132
const logo = document.createElement('img');
3233
logo.setAttribute('alt', '');
33-
logo.setAttribute('src', `https://cdn.httparchive.org/static/icons/${row}.png`);
34+
logo.setAttribute('src', `https://cdn.httparchive.org/static/icons/${icon}`);
3435
logo.setAttribute('loading', 'lazy');
3536
option.append(logo);
36-
if(this.selected.includes(row)) {
37+
if(this.selected.includes(row.technology)) {
3738
option.setAttribute('aria-selected', true);
3839
}
3940
listbox.append(option);
@@ -83,7 +84,7 @@ class ComboBox {
8384
const options = this.element.querySelector('[role="listbox"]');
8485

8586
this.filteredData = this.data.filter(row => {
86-
return row.toLowerCase().includes(search.toLowerCase());
87+
return row.technology.toLowerCase().includes(search.toLowerCase());
8788
});
8889

8990
options.textContent = '';
@@ -186,6 +187,7 @@ class ComboBox {
186187
}
187188

188189
showSelectedElement(name) {
190+
const icon = this.data.find(((tech) => tech.technology == name))?.icon;
189191
/* Add selected element to an overview list */
190192
const selection = document.createElement('li');
191193
selection.dataset.name = name;
@@ -198,7 +200,7 @@ class ComboBox {
198200

199201
/* Add the app logo */
200202
const appIcon = document.createElement('img');
201-
appIcon.setAttribute('src', `https://cdn.httparchive.org/static/icons/${encodeURI(name)}.png`);
203+
appIcon.setAttribute('src', `https://cdn.httparchive.org/static/icons/${encodeURI(icon)}`);
202204
appIcon.setAttribute('alt', '');
203205
appIcon.classList.add('logo');
204206
deleteSelection.append(appIcon);

src/js/techreport/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class TechReport {
359359
},
360360
{
361361
name: 'technologies',
362-
endpoint: 'technologies?onlyname',
362+
endpoint: 'technologies?fields=technology,icon',
363363
},
364364
{
365365
name: 'ranks',
@@ -406,8 +406,9 @@ class TechReport {
406406
// Update drilldown page components
407407
updateDrilldownComponents(data) {
408408
const app = this.filters.app[0];
409+
const icon = data[app].at(-1).icon;
409410
DrilldownHeader.update(this.filters);
410-
DrilldownHeader.setIcon(`${encodeURI(app)}.png`);
411+
DrilldownHeader.setIcon(`${encodeURI(icon)}`);
411412

412413
if(data && data[app]) {
413414
UIUtils.updateReportComponents(this.sections, data, data[app], this.page, this.labels);

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h1>
3131
</div>
3232
</section>
3333

34-
<section class="alt" style="padding: 60px 15px;">
34+
<section style="padding: 60px 15px;">
3535
<div class="container">
3636
<div class="row">
3737
<div class="col-lg-7 col-sm-6 col-md-6 col-xs-12">

templates/techreport/components/table_linked.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
{% if column.key == "technology" %}
5959
<th class="app-cell">
6060
<span class="app-wrapper">
61-
<span class="app-img" aria-hidden="true" style="background-image: url(https://cdn.httparchive.org/static/icons/{{ tech }}.png)"></span>
61+
<span class="app-img" aria-hidden="true"></span>
6262
<a href="/reports/techreport/tech?tech={{ tech }}&geo={{ tech_report_page.filters.geo }}&rank={{ tech_report_page.filters.rank }}">{{ tech }}</a>
6363
</span>
6464
</th>

0 commit comments

Comments
 (0)