Skip to content

Commit 5f2c1e3

Browse files
Redesign search UX: Make main box trigger traditional search with AI option
- Convert home page main search box to trigger traditional search modal instead of chat - Remove confusing duplicate magnifying glass icons (reduced from 3 to 1 on page) - Add AI Copilot toggle button within search modal for users who want AI assistance - Main search box now shows 'Search Redis documentation...' placeholder - AI Copilot becomes secondary option accessible via 🤖 AI button in search modal - Clicking AI button transfers current query to chat interface - Maintains all existing keyboard shortcuts and functionality - Improves UX by making traditional search the primary action - Reduces cognitive load by consolidating search interfaces This addresses feedback about confusing multiple search icons and better prioritizes traditional documentation search while keeping AI copilot easily accessible.
1 parent 9502da9 commit 5f2c1e3

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

layouts/home.html

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ <h1 class="text-5xl font-medium">{{ .Title }}</h1>
1616
{{ with .Params.description }}
1717
<p class="text-xl md:text-2xl">{{ . | markdownify }}</p>
1818
{{ end }}
19-
<div class="flex flex-row items-center gap-4 w-full md:w-4/5">
20-
<form class="flex flex-row items-center border border-white rounded-md px-6 gap-6 w-full bg-redis-ink-900" action="/chat">
21-
<label class="" for="search-home" id="search-label-home">
22-
{{ partial "icons/search.html" }}
23-
</label>
24-
<input id="seach-home" name="q" class="appearance-none bg-transparent text-base sm:text-lg text-white placeholder-white w-full h-16 focus:outline-none"
25-
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
26-
placeholder="Ask our AI-powered Redis copilot a question…" maxlength="500" type="text" value="" tabindex=""/>
27-
<!--<input type="submit" class="hover:text-redis-pen-300" value="&#x23CE;"/>-->
28-
<input class="invisible" type="submit" class="hover:text-redis-pen-300" value=""/>
29-
</form>
30-
<button id="search-button-home" type="button" class="flex-shrink-0 p-3 border border-white rounded-md bg-redis-ink-900 hover:bg-white hover:text-redis-ink-900 transition-colors" title="Search documentation (Ctrl+K)">
19+
<div class="flex flex-row items-center border border-white rounded-md px-6 gap-6 w-full md:w-4/5 bg-redis-ink-900 cursor-pointer" id="search-trigger-home">
20+
<label class="" for="search-home" id="search-label-home">
3121
{{ partial "icons/search.html" }}
32-
</button>
22+
</label>
23+
<div class="appearance-none bg-transparent text-base sm:text-lg text-white placeholder-white w-full h-16 flex items-center"
24+
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
25+
Search Redis documentation…
26+
</div>
3327
</div>
3428
</div>
3529
</header>

layouts/partials/search-modal.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<path d="M10 10l5.09-5.09L10 10l5.09 5.09L10 10zm0 0L4.91 4.91 10 10l-5.09 5.09L10 10z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" />
2424
</svg>
2525
</button>
26+
<button id="ai-copilot-toggle" type="button" style="height: calc(3rem - 2px);" class="px-3 border border-redis-pen-800 rounded-md bg-white hover:bg-redis-yellow-100 transition-colors flex items-center gap-2" title="Switch to AI Copilot">
27+
<span class="text-sm">🤖 AI</span>
28+
</button>
2629
<select id="search-select" style="height: calc(3rem - 2px);" class="w-2/5 pl-3 grow-0 border border-redis-pen-800 rounded-md search-filter bg-white text-left pr-8 appearance-none hidden md:block" autocomplete="off">
2730
<option value="all" selected>All products</option>
2831
<option value="rs">Redis Enterprise</option>
@@ -369,10 +372,19 @@
369372

370373
// Click handler function
371374
function clickHandler(event) {
372-
if (event.target.closest('#search-button') || event.target.closest('#search-button-home')) {
375+
if (event.target.closest('#search-button') || event.target.closest('#search-trigger-home')) {
373376
startSearch()
374377
} else if (event.target.closest('#search-cancel') || event.target.matches('#search-container')) {
375378
stopSearch()
379+
} else if (event.target.closest('#ai-copilot-toggle')) {
380+
// Get the current search query
381+
const searchQuery = searchInput.value.trim()
382+
// Redirect to chat with the query
383+
if (searchQuery) {
384+
window.location.href = `/chat?q=${encodeURIComponent(searchQuery)}`
385+
} else {
386+
window.location.href = '/chat'
387+
}
376388
}
377389
}
378390

0 commit comments

Comments
 (0)