Skip to content

Commit dc9b08d

Browse files
rahulkeerthiclaude
andcommitted
fix(site): improve search UX
- Placeholder simplified to 'Try a name...' (was over-promising provider ID support) - Added clickable hint buttons: Salah, Haaland, Real Madrid, Bundesliga, reep_p2804f5db - 'demo subset of full dataset' label with link to GitHub - Build script now seeds showcase entities into search index + adds 23 famous player name queries - Index: 3,398 → 4,348 entities (Cole Palmer, Salah, Haaland etc now included) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aa58bac commit dc9b08d

3 files changed

Lines changed: 56 additions & 3 deletions

File tree

site/scripts/build-data.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ async function main() {
147147
// --- 3. Build search index ---
148148
const allEntities = new Map<string, Entity>();
149149

150-
// a-z single-letter queries
150+
// Seed the index with showcase entities so they're always searchable
151+
for (const entity of examples) {
152+
allEntities.set(entity.reep_id, entity);
153+
}
154+
155+
// a-z single-letter queries + famous players/teams that users will try
151156
const letters = "abcdefghijklmnopqrstuvwxyz".split("");
152157
const footballTerms = [
153158
"Real",
@@ -163,7 +168,13 @@ async function main() {
163168
"Bundesliga",
164169
"Cup",
165170
];
166-
const queries = [...letters, ...footballTerms];
171+
const playerNames = [
172+
"Messi", "Ronaldo", "Haaland", "Mbappe", "Salah", "Palmer",
173+
"Bellingham", "Vinicius", "Saka", "Foden", "De Bruyne", "Modric",
174+
"Son", "Kane", "Lewandowski", "Neymar", "Pedri", "Gavi",
175+
"Osimhen", "Wirtz", "Yamal", "Odegaard", "Rice",
176+
];
177+
const queries = [...letters, ...footballTerms, ...playerNames];
167178

168179
console.log(
169180
`[build-data] Building search index with ${queries.length} queries...`

site/src/pages/index.astro

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,20 @@ const coverageProviders = Object.entries(PROVIDERS)
8888
type="text"
8989
class="search-input"
9090
id="search-input"
91-
placeholder="Search by name or paste any provider ID..."
91+
placeholder="Try a name..."
9292
autocomplete="off"
9393
/>
9494
<div class="search-results" id="search-results"></div>
9595
</div>
96+
<div class="search-hints" style="margin-top: 0.5rem; font-size: 0.82rem; color: var(--fg-muted);">
97+
Try:
98+
<button class="hint-btn" data-query="Salah">Salah</button>
99+
<button class="hint-btn" data-query="Haaland">Haaland</button>
100+
<button class="hint-btn" data-query="Real Madrid">Real Madrid</button>
101+
<button class="hint-btn" data-query="Bundesliga">Bundesliga</button>
102+
<button class="hint-btn" data-query="reep_p2804f5db">reep_p2804f5db</button>
103+
<span style="margin-left: 0.25rem; opacity: 0.6;">· demo subset of <a href="https://github.com/withqwerty/reep#data" style="color: var(--fg-muted);">full dataset</a></span>
104+
</div>
96105
</header>
97106

98107
<!-- Examples -->
@@ -418,6 +427,18 @@ const coverageProviders = Object.entries(PROVIDERS)
418427
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
419428
}
420429

430+
// Hint buttons — click to populate search
431+
document.querySelectorAll('.hint-btn').forEach(btn => {
432+
btn.addEventListener('click', async () => {
433+
await loadIndex();
434+
const query = (btn as HTMLElement).dataset.query || '';
435+
input.value = query;
436+
input.focus();
437+
doSearch();
438+
});
439+
});
440+
441+
// Close dropdown on outside click
421442
document.addEventListener('click', (e) => {
422443
if (!resultsEl.contains(e.target as Node) && e.target !== input) {
423444
resultsEl.classList.remove('open');

site/src/styles/global.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,27 @@ footer a {
384384
text-decoration: none;
385385
}
386386

387+
/* Search hint buttons */
388+
.search-hints {
389+
text-align: center;
390+
}
391+
392+
.hint-btn {
393+
font-family: var(--font-mono);
394+
font-size: 0.78rem;
395+
background: var(--green-light);
396+
color: var(--green);
397+
border: none;
398+
padding: 0.2rem 0.5rem;
399+
border-radius: 4px;
400+
cursor: pointer;
401+
margin: 0.1rem;
402+
}
403+
404+
.hint-btn:hover {
405+
opacity: 0.7;
406+
}
407+
387408
/* Highlight animation */
388409
@keyframes highlight {
389410
0% { box-shadow: 0 0 0 4px var(--green-light); }

0 commit comments

Comments
 (0)