Skip to content

Commit e928864

Browse files
committed
site(gordon): make page context switch prettier
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 14d73da commit e928864

1 file changed

Lines changed: 32 additions & 29 deletions

File tree

layouts/partials/gordon-chat.html

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -431,24 +431,41 @@ <h3 class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">
431431

432432
<!-- Input area -->
433433
<div class="border-t border-gray-200 p-4 dark:border-gray-700">
434-
<form @submit.prevent="askQuestion()" class="flex items-center gap-2">
435-
<div class="relative flex-1 self-stretch">
436-
<textarea x-ref="input" x-model="currentQuestion"
437-
@input="$el.style.height = 'auto'; $el.style.height = $el.scrollHeight + 'px'"
438-
@keydown.enter="if (!$event.shiftKey) { $event.preventDefault(); askQuestion() }"
439-
placeholder="Ask a question about Docker..."
440-
rows="1"
441-
:disabled="isLoading"
442-
class="block w-full resize-none rounded-lg border border-gray-300 p-3 pr-24 leading-normal min-h-[3rem] focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 focus:outline-none disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:focus:border-blue-400"></textarea>
443-
<!-- Page context toggle chip inside input -->
444-
<div class="absolute right-2 top-1/2 -translate-y-1/2" x-data="{ showTooltip: false }">
434+
<form @submit.prevent="askQuestion()" class="space-y-2">
435+
<div class="flex items-center gap-2">
436+
<div class="relative flex-1 self-stretch">
437+
<textarea x-ref="input" x-model="currentQuestion"
438+
@input="$el.style.height = 'auto'; $el.style.height = $el.scrollHeight + 'px'"
439+
@keydown.enter="if (!$event.shiftKey) { $event.preventDefault(); askQuestion() }"
440+
placeholder="Ask a question about Docker..."
441+
rows="1"
442+
:disabled="isLoading"
443+
class="block w-full resize-none rounded-lg border border-gray-300 p-3 leading-normal min-h-[3rem] focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 focus:outline-none disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:focus:border-blue-400"></textarea>
444+
</div>
445+
<button type="submit" :disabled="!currentQuestion.trim() || isLoading"
446+
:title="isLoading ? 'Sending...' : 'Send question'"
447+
class="cursor-pointer rounded-lg bg-blue-600 px-4 py-3 font-semibold text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50">
448+
<template x-if="!isLoading">
449+
<span class="icon-svg">
450+
{{ partialCached "icon" "send" "send" }}
451+
</span>
452+
</template>
453+
<template x-if="isLoading">
454+
<span class="icon-svg animate-spin">
455+
{{ partialCached "icon" "progress_activity" "progress_activity" }}
456+
</span>
457+
</template>
458+
</button>
459+
</div>
460+
<div class="flex items-center" x-data="{ showTooltip: false }">
461+
<div class="relative">
445462
<button
446463
@click="includePageContext = !includePageContext"
447464
@mouseenter="showTooltip = true"
448465
@mouseleave="showTooltip = false"
449466
type="button"
450467
:class="includePageContext
451-
? 'bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400'
468+
? 'bg-blue-100 text-blue-600 dark:bg-blue-800 dark:text-blue-200'
452469
: 'bg-gray-200 text-gray-500 dark:bg-gray-700 dark:text-gray-400'"
453470
class="cursor-pointer rounded-md px-2 py-1 text-xs font-medium transition-colors hover:opacity-80">
454471
<span class="flex items-center gap-1">
@@ -462,7 +479,7 @@ <h3 class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">
462479
{{ partialCached "icon" "link_off" "link_off" }}
463480
</span>
464481
</template>
465-
<span class="hidden sm:inline">Context</span>
482+
<span>Context</span>
466483
</span>
467484
</button>
468485
<!-- Tooltip -->
@@ -474,30 +491,16 @@ <h3 class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">
474491
x-transition:leave="transition ease-in duration-75"
475492
x-transition:leave-start="opacity-100 scale-100"
476493
x-transition:leave-end="opacity-0 scale-95"
477-
class="absolute bottom-full right-0 mb-2 w-56 rounded-lg bg-gray-900 p-2.5 text-xs text-white shadow-lg dark:bg-gray-700"
494+
class="absolute bottom-full left-0 mb-2 w-56 rounded-lg bg-gray-900 p-2.5 text-xs text-white shadow-lg dark:bg-gray-700"
478495
style="display: none;">
479496
<div class="relative">
480497
<p>When enabled, Gordon considers the current page you're viewing to provide more relevant answers.</p>
481498
<!-- Arrow -->
482-
<div class="absolute -bottom-3 right-4 h-2 w-2 rotate-45 bg-gray-900 dark:bg-gray-700"></div>
499+
<div class="absolute -bottom-3 left-4 h-2 w-2 rotate-45 bg-gray-900 dark:bg-gray-700"></div>
483500
</div>
484501
</div>
485502
</div>
486503
</div>
487-
<button type="submit" :disabled="!currentQuestion.trim() || isLoading"
488-
:title="isLoading ? 'Sending...' : 'Send question'"
489-
class="cursor-pointer rounded-lg bg-blue-600 px-4 py-3 font-semibold text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50">
490-
<template x-if="!isLoading">
491-
<span class="icon-svg">
492-
{{ partialCached "icon" "send" "send" }}
493-
</span>
494-
</template>
495-
<template x-if="isLoading">
496-
<span class="icon-svg animate-spin">
497-
{{ partialCached "icon" "progress_activity" "progress_activity" }}
498-
</span>
499-
</template>
500-
</button>
501504
</form>
502505
</div>
503506

0 commit comments

Comments
 (0)