Skip to content

Commit deece5c

Browse files
committed
feat(home): group example searches
1 parent 204a0f1 commit deece5c

2 files changed

Lines changed: 58 additions & 13 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A fast, modern web search interface for [Windows Package Manager (winget)](https
1515
## Features
1616

1717
- 🔍 **Instant search** - Search by package ID, name, description, publisher, or tags
18-
- 🧭 **Example searches** - Start from common queries on the blank home screen
18+
- 🧭 **Example searches** - Start from grouped dev tool and everyday app queries on the blank home screen
1919
- 📋 **One-click copy** - Copy `winget install` commands instantly
2020
- 🌐 **English-only results** - Filters to show only English package descriptions
2121
- 🔄 **Auto-updated** - Daily updates via GitHub Actions
@@ -38,7 +38,7 @@ Visit the live site: `https://YOUR_USERNAME.github.io/YOUR_REPO_NAME/`
3838

3939
2. **Search Interface**: A static HTML page that:
4040
- Loads the generated `packages.json`
41-
- Shows a blank home state with example searches
41+
- Shows a blank home state with grouped example searches
4242
- Provides instant client-side search
4343
- Generates copy-ready `winget install` commands
4444

@@ -235,7 +235,7 @@ The extraction script (`extract_packages.py`):
235235
### Performance
236236
237237
- Initial load: ~5-10MB JSON file containing ~30,000+ packages
238-
- The home page starts blank and suggests example searches instead of showing arbitrary starter results
238+
- The home page starts blank and suggests grouped example searches instead of showing arbitrary starter results
239239
- Search is performed client-side for instant results
240240
- Ranked search results are capped at 200 items for performance
241241
- Debounced search input (300ms) for smooth typing

index.html

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,31 @@
123123
display: flex;
124124
flex-wrap: wrap;
125125
gap: 10px;
126+
}
127+
128+
.example-search-grid {
129+
display: grid;
130+
grid-template-columns: repeat(2, minmax(0, 1fr));
131+
gap: 16px;
126132
margin-top: 16px;
127133
}
128134

135+
.example-group {
136+
display: flex;
137+
flex-direction: column;
138+
gap: 10px;
139+
}
140+
141+
.example-group-title {
142+
color: var(--text-primary);
143+
font-size: 0.95em;
144+
font-weight: 600;
145+
}
146+
147+
.example-group .example-searches {
148+
margin-top: 0;
149+
}
150+
129151
.example-search {
130152
border: 1px solid var(--border-color);
131153
border-radius: 999px;
@@ -404,6 +426,10 @@
404426
.command {
405427
font-size: 0.8em;
406428
}
429+
430+
.example-search-grid {
431+
grid-template-columns: 1fr;
432+
}
407433
}
408434
</style>
409435
</head>
@@ -464,12 +490,24 @@ <h1>
464490
const statsDiv = document.getElementById('stats');
465491
const lastUpdatedSpan = document.getElementById('last-updated');
466492
const EXAMPLE_SEARCHES = [
467-
'Git',
468-
'Google Chrome',
469-
'Microsoft Edge',
470-
'Visual Studio Code',
471-
'Docker Desktop',
472-
'7-Zip'
493+
{
494+
title: 'Dev tools',
495+
items: [
496+
'Git',
497+
'Visual Studio Code',
498+
'Docker Desktop',
499+
'Node.js',
500+
'Python',
501+
],
502+
},
503+
{
504+
title: 'Everyday apps',
505+
items: [
506+
'Google Chrome',
507+
'Microsoft Edge',
508+
'7-Zip',
509+
],
510+
},
473511
];
474512

475513
// Keyboard shortcuts
@@ -591,7 +629,7 @@ <h1>
591629

592630
function updateStats(query, totalMatches, showingCount, truncated) {
593631
if (!query) {
594-
statsDiv.textContent = `${packages.length.toLocaleString()} packages available • try an example search below`;
632+
statsDiv.textContent = `${packages.length.toLocaleString()} packages available • try a common search below`;
595633
return;
596634
}
597635

@@ -696,11 +734,18 @@ <h1>
696734
function renderEmptyState() {
697735
return `
698736
<div class="empty-state">
699-
<div class="empty-state-kicker">Example searches</div>
737+
<div class="empty-state-kicker">Try these</div>
700738
<h2>Start with a common package</h2>
701739
<p>Search by package ID, name, publisher, description, or tag.</p>
702-
<div class="example-searches">
703-
${EXAMPLE_SEARCHES.map(example => `<button type="button" class="example-search" onclick="filterBy('${escapeForSingleQuotedJs(example)}')">${escapeHtml(example)}</button>`).join('')}
740+
<div class="example-search-grid">
741+
${EXAMPLE_SEARCHES.map(group => `
742+
<section class="example-group" aria-label="${escapeHtml(group.title)}">
743+
<div class="example-group-title">${escapeHtml(group.title)}</div>
744+
<div class="example-searches">
745+
${group.items.map(example => `<button type="button" class="example-search" onclick="filterBy('${escapeForSingleQuotedJs(example)}')">${escapeHtml(example)}</button>`).join('')}
746+
</div>
747+
</section>
748+
`).join('')}
704749
</div>
705750
<div class="empty-state-note">You can click a publisher or tag in a result to narrow the search once results appear.</div>
706751
</div>

0 commit comments

Comments
 (0)