Skip to content

Commit 65ac0ef

Browse files
committed
Add link to package index
1 parent a7b126f commit 65ac0ef

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

css/package-list.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ button.read-more {
1111
padding: 0;
1212
}
1313

14+
.no-results {
15+
line-height: 2;
16+
text-align: center;
17+
}
18+
19+
.no-results .large-icon {
20+
font-size: 5em;
21+
}
22+
1423
.package-item {
1524
padding: 10px 0; /* Adjusted padding for vertical spacing */
1625
display: flex;

renderer.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,15 @@ function renderPackageList(result, searchTerm = '') {
163163
}
164164

165165
if(packages.length === 0){
166-
packageList.innerHTML = '<div class="no-results">No packages found. Try a different search term.</div>';
166+
packageList.innerHTML = `
167+
<div class="no-results">
168+
<p class="large-icon">🤷</p>
169+
<p>No packages found. Try a different search term.</p>
170+
<p>
171+
Your favorite package is not listed? Consider adding it
172+
<a onclick="openBrowserWindow('https://github.com/arduino/package-index-py/edit/main/package-list.yaml')">here</a>.
173+
</p>
174+
</div>`;
167175
return;
168176
}
169177

@@ -209,7 +217,7 @@ function renderPackageList(result, searchTerm = '') {
209217

210218
moreInfoButton.addEventListener('click', () => {
211219
const targetURL = pkg.docs || pkg.url;
212-
openPackageInfo(targetURL);
220+
openBrowserWindow(targetURL);
213221
});
214222
});
215223
}
@@ -256,7 +264,7 @@ async function installPackage(package) {
256264
hideOverlay();
257265
}
258266

259-
function openPackageInfo(url) {
267+
function openBrowserWindow(url) {
260268
if (url) {
261269
window.open(url, '_blank'); // Opens the URL in a new browser tab
262270
} else {

0 commit comments

Comments
 (0)