Skip to content

Commit 511d962

Browse files
committed
AI Search styles
1 parent e4faa92 commit 511d962

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

MyApp/tailwind.input.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@
233233
line-height: 1.25rem;
234234
cursor: pointer;
235235
}
236-
.search-dialog ::-webkit-scrollbar { width:4px; }
237-
.search-dialog ::-webkit-scrollbar-thumb { background-color:rgb(249, 250, 251); }
236+
.search-dialog ::-webkit-scrollbar { width: 6px; }
237+
.search-dialog ::-webkit-scrollbar-track { background: transparent; }
238+
.search-dialog ::-webkit-scrollbar-thumb { background-color: #4f46e5; border-radius: 4px; }
239+
.search-dialog ::-webkit-scrollbar-thumb:hover { background-color: #3b36c6; }
238240
.group-item[aria-selected=true], .group-item[aria-selected=true] a, .group-item[aria-selected=true] mark {
239241
background-color: #42b983;
240242
box-shadow: inset 0 0 0 2px #42b983;

MyApp/wwwroot/mjs/components/TypesenseConversation.mjs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async function get(url, opt=null) {
4444
function clean(s) {
4545
if (s == null) return null
4646
return s.replace(/&ZeroWidthSpace/g, '')
47-
.replace(/\s+/g, ' ')
47+
//.replace(/\s+/g, ' ')
4848
.trim()
4949
}
5050

@@ -95,10 +95,10 @@ async function multiSearch(message, conversationId = null) {
9595

9696
const AISearchDialog = {
9797
template: `<div v-if="open" class="search-dialog fixed inset-0 z-50 flex bg-black/25 items-center justify-center" @click="$emit('hide')">
98-
<div class="dialog absolute w-full max-w-2xl flex flex-col bg-white/100 dark:bg-gray-800/100 rounded-lg shadow-lg" style="max-height:80vh;" @click.stop="">
98+
<div class="dialog absolute w-full max-w-2xl flex flex-col bg-indigo-50 dark:bg-indigo-900 rounded-lg shadow-lg" style="max-height:80vh;" @click.stop="">
9999
<div class="p-4 flex flex-col" style="max-height: 80vh;">
100100
<!-- Header -->
101-
<div class="flex items-center justify-between mb-4 bg-gradient-to-r from-slate-700 to-slate-600 dark:from-slate-800 dark:to-slate-700 p-4 -m-4 mb-4 rounded-t-lg">
101+
<div class="flex items-center justify-between mb-4 bg-indigo-900 dark:bg-indigo-950 p-4 -m-4 mb-4 rounded-t-lg">
102102
<h2 class="text-xl font-semibold text-white">Ask ServiceStack Docs</h2>
103103
<button type="button" @click="$emit('hide')" class="text-gray-400 hover:text-white dark:hover:text-white">
104104
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -111,20 +111,24 @@ const AISearchDialog = {
111111
<div class="flex-1 overflow-y-auto mb-4 pr-2 space-y-4" style="max-height: calc(80vh - 180px);">
112112
<div v-for="(msg, idx) in messages" :key="idx" :class="['message', msg.role === 'user' ? 'user-message' : 'assistant-message']">
113113
<div v-if="msg.role === 'user'" class="flex justify-end">
114-
<div class="bg-blue-500 text-white rounded-lg px-4 py-2 max-w-xs">
114+
<div class="bg-indigo-900 dark:bg-indigo-950 text-white rounded-lg px-4 py-2 max-w-xs">
115115
{{ msg.content }}
116116
</div>
117117
</div>
118118
<div v-else class="flex flex-col">
119-
<div class="prose bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white rounded-lg px-4 py-2 mb-3"
119+
<div class="shadow prose bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white rounded-lg px-4 py-2 mb-3"
120120
v-html="renderMarkdown(msg.content)"></div>
121121
<!-- Search Results -->
122122
<div v-if="getUniqueHits(msg.hits).length > 0" class="space-y-3 mt-3">
123123
<div class="flex items-center gap-2">
124124
<p class="text-sm text-gray-600 dark:text-gray-400 font-semibold">{{ getUniqueHits(msg.hits).length }} Result{{ getUniqueHits(msg.hits).length !== 1 ? 's' : '' }} Found</p>
125125
</div>
126-
<a v-for="(hit, hitIdx) in getUniqueHits(msg.hits)" :key="hitIdx" :href="hit.url" :class="[hit.type === 'lvl0' || hit.type === 'lvl1' ? 'bg-gradient-to-br from-indigo-50 to-indigo-100 dark:from-indigo-900 dark:to-indigo-800 border-indigo-300 dark:border-indigo-700' : 'bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-gray-800 dark:to-gray-900 border-blue-200 dark:border-gray-700', 'rounded-lg p-4 border hover:shadow-md transition-shadow cursor-pointer block']">
127-
<div :class="[hit.type === 'lvl0' || hit.type === 'lvl1' ? 'text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 text-base' : 'text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 text-sm', 'font-semibold']">
126+
<a v-for="(hit, hitIdx) in getUniqueHits(msg.hits)" :key="hitIdx" :href="hit.url" :class="[hit.type ===
127+
'lvl0' || hit.type === 'lvl1' ?
128+
'bg-gradient-to-br from-indigo-50 to-indigo-100 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600' :
129+
'bg-gradient-to-br from-blue-50 to-blue-50 dark:from-blue-900 dark:to-blue-800 border-blue-300 dark:border-blue-600',
130+
'rounded-lg p-4 border hover:shadow-md transition-shadow cursor-pointer block']">
131+
<div :class="[hit.type === 'lvl0' || hit.type === 'lvl1' ? 'text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 text-base' : 'text-blue-600 dark:text-indigo-400 hover:text-blue-800 dark:hover:text-indigo-300 text-sm', 'font-semibold']">
128132
{{ hit.title }}
129133
</div>
130134
<p v-if="hit.snippet" class="text-xs text-gray-600 dark:text-gray-400 mt-2 line-clamp-3 leading-relaxed">
@@ -137,8 +141,8 @@ const AISearchDialog = {
137141
</div>
138142
</div>
139143
</div>
140-
<div v-if="loading" class="flex justify-center">
141-
<div class="animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"></div>
144+
<div v-if="loading" class="flex justify-center min-h-10">
145+
<div class="absolute animate-spin rounded-full size-8 border-b-2 border-blue-500 dark:border-blue-400"></div>
142146
</div>
143147
</div>
144148
@@ -150,12 +154,12 @@ const AISearchDialog = {
150154
:disabled="loading"
151155
type="text"
152156
placeholder="Ask a question..."
153-
class="flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
157+
class="flex-1 px-4 py-2 border border-gray-300 dark:border-gray-500 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-500"
154158
/>
155-
<button
159+
<button type="button"
156160
@click="sendMessage"
157161
:disabled="loading || !inputMessage.trim()"
158-
class="px-4 py-2 bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-400 text-white rounded-lg font-semibold transition-colors"
162+
class="px-4 py-2 bg-indigo-500 dark:bg-indigo-700 hover:bg-indigo-700 dark:hover:bg-indigo-600 disabled:bg-gray-400 dark:disabled:bg-gray-600 text-white rounded-lg font-semibold transition-colors"
159163
>
160164
Send
161165
</button>

0 commit comments

Comments
 (0)