feat: brain live search — results appear as you type (300ms debounce)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -208,8 +208,13 @@
|
|||||||
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); capture(); }
|
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); capture(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSearchKey(e: KeyboardEvent) {
|
let searchTimer: ReturnType<typeof setTimeout>;
|
||||||
if (e.key === 'Enter') search();
|
|
||||||
|
function handleSearchInput() {
|
||||||
|
clearTimeout(searchTimer);
|
||||||
|
searchTimer = setTimeout(() => {
|
||||||
|
search();
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Poll for pending items
|
// Poll for pending items
|
||||||
@@ -345,7 +350,7 @@
|
|||||||
class="search-input"
|
class="search-input"
|
||||||
placeholder="Search your brain..."
|
placeholder="Search your brain..."
|
||||||
bind:value={searchQuery}
|
bind:value={searchQuery}
|
||||||
onkeydown={handleSearchKey}
|
oninput={handleSearchInput}
|
||||||
/>
|
/>
|
||||||
{#if searchQuery}
|
{#if searchQuery}
|
||||||
<button class="search-clear" onclick={() => { searchQuery = ''; loadItems(); }}>
|
<button class="search-clear" onclick={() => { searchQuery = ''; loadItems(); }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user