diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 1866357..af54a17 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -78,6 +78,11 @@ if (urlParams.get('create') === 'true') { showModal = true; } + + // Perform initial search if there is a value in the search input + if (searchValue) { + search(searchValue); + } } catch (error) { appInsights.trackException({ error }); } finally { @@ -95,7 +100,7 @@ const search = debounce(async (value: string) => { searchValue = value.toLowerCase(); - filteredAgents = agents.filter((agent) => { + filteredAgents = sections["All Agents"].filter((agent) => { return ( agent.metadata.display_name .toLowerCase() @@ -170,7 +175,7 @@ placeholder="Search any library or SDK" maxlength="150" type="search" - value={searchValue} + bind:value={searchValue} on:input={(e) => search(e.currentTarget.value)} /> @@ -183,36 +188,13 @@ {:else} - {#each Object.keys(sections) as section} + {#if searchValue}
-

{section}

+

Search Results

- {#each sections[section] as agent, index} - {#if index === 2 && section === "All Agents"} - - {/if} + {#each filteredAgents as agent}
- {/each} + {:else} + {#each Object.keys(sections) as section} +
+

{section}

+
+ {#each sections[section] as agent, index} + + + {/each} +
+
+ {/each} + {/if} {/if}