Skip to content

Commit 6c4bce1

Browse files
committed
style: update style of the "Scroll to bottom" button
AdminForth/1792/agent-new-functionality
1 parent b073998 commit 6c4bce1

2 files changed

Lines changed: 39 additions & 13 deletions

File tree

custom/conversation_area/ConversationArea.vue

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,49 @@
5353
</div>
5454
<div v-if="showBottomSpacer" class="w-full" :style="{ height: spacerHeight + 'px' }"></div>
5555
</CustomAutoScrollContainer>
56-
<button @click="scrollContainer.scrollToBottom();">
57-
<IconArrowDownOutline
58-
class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2 bg-lightPrimary/20 dark:bg-darkPrimary/10
59-
border border-lightPrimary dark:border-darkPrimary text-lightPrimary dark:text-darkPrimary p-2 w-10 h-10
60-
rounded-full transition-opacity duration-100 ease-in backdrop-blur-sm"
61-
:class="showScrollToBottomButton ? 'opacity-100' : 'opacity-0 pointer-events-none'"
62-
:disabled="!showScrollToBottomButton"
63-
/>
64-
</button>
56+
<Transition
57+
enter-active-class="transition-all duration-250 ease-out"
58+
enter-from-class="opacity-0 translate-y-3 scale-90"
59+
enter-to-class="opacity-100 translate-y-0 scale-100"
60+
leave-active-class="transition-all duration-200 ease-in"
61+
leave-from-class="opacity-100 translate-y-0 scale-100"
62+
leave-to-class="opacity-0 translate-y-3 scale-90"
63+
>
64+
<button
65+
v-if="showScrollToBottomButton"
66+
@click="scrollContainer.scrollToBottom();"
67+
class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2
68+
bg-lightPrimary/20 dark:bg-darkPrimary/10
69+
border border-lightPrimary dark:border-darkPrimary
70+
text-lightPrimary dark:text-darkPrimary
71+
backdrop-blur-sm rounded-full
72+
w-10 h-10 flex items-center justify-center gap-0.5"
73+
:class="{ 'w-12 h-8': showAnimationInScrollToBottomButton }"
74+
>
75+
<IconArrowDownOutline
76+
v-if="!showAnimationInScrollToBottomButton"
77+
class="p-2 w-10 h-10 transition-opacity duration-100 ease-in "
78+
:disabled="!showScrollToBottomButton"
79+
/>
80+
<ThreeDotsAnimation
81+
v-else
82+
:disabled="!showScrollToBottomButton"
83+
/>
84+
</button>
85+
</Transition>
6586
</div>
6687
</template>
6788

6889

6990
<script setup lang="ts">
7091
import type { IMessage } from '../types';
71-
import { useTemplateRef, ref, onMounted, onUnmounted, watch, nextTick, defineAsyncComponent } from 'vue';
92+
import { useTemplateRef, ref, onMounted, onUnmounted, watch, nextTick, defineAsyncComponent, computed } from 'vue';
7293
import { IconArrowDownOutline } from '@iconify-prerendered/vue-flowbite';
7394
import SessionsHistory from '../SessionsHistory.vue';
7495
import { useAgentStore } from '../composables/useAgentStore';
7596
import { useAgentTransitions } from '../composables/useAgentTransitions';
7697
import MessageRenderer from './MessageRenderer.vue';
98+
import ThreeDotsAnimation from './ThreeDotsAnimation.vue';
7799
78100
const CustomAutoScrollContainer = defineAsyncComponent(() => import('../CustomAutoScrollContainer.vue'));
79101
@@ -114,6 +136,10 @@ let updateSpacerFrameId: number | null = null;
114136
let pendingSpacerUpdate: Promise<void> | null = null;
115137
let spacerUpdateQueued = false;
116138
139+
const showAnimationInScrollToBottomButton = computed(() => {
140+
return agentStore.isResponseInProgress && showScrollToBottomButton.value;
141+
});
142+
117143
onMounted(async () => {
118144
messageResizeObserver = new ResizeObserver(() => {
119145
scheduleSpacerHeightUpdate();

custom/conversation_area/ThreeDotsAnimation.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
1313
.bounce-dot2 {
1414
animation: bounce 1.5s infinite;
15-
animation-delay: 0.1s;
15+
animation-delay: 0.2s;
1616
}
1717
1818
.bounce-dot3 {
1919
animation: bounce 1.5s infinite;
20-
animation-delay: 0.2s;
20+
animation-delay: 0.4s;
2121
}
2222
2323
@keyframes bounce {
2424
0%, 100% {
2525
transform: translateY(20%);
26-
opacity: 0.3;
26+
opacity: 0.4;
2727
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
2828
}
2929
50% {

0 commit comments

Comments
 (0)