feat: add search drop down

This commit is contained in:
tim
2025-08-23 00:53:32 +08:00
parent d2bd949ac8
commit e8e7b9a245
4 changed files with 32 additions and 14 deletions

View File

@@ -18,7 +18,7 @@
--background-color-blur: rgba(255, 255, 255, 0.57); --background-color-blur: rgba(255, 255, 255, 0.57);
--menu-border-color: lightgray; --menu-border-color: lightgray;
--normal-border-color: lightgray; --normal-border-color: lightgray;
--menu-selected-background-color: rgba(208, 250, 255, 0.659); --menu-selected-background-color: rgba(228, 228, 228, 0.884);
--menu-text-color: black; --menu-text-color: black;
--scroller-background-color: rgba(130, 175, 180, 0.5); --scroller-background-color: rgba(130, 175, 180, 0.5);
/* --normal-background-color: rgb(241, 241, 241); */ /* --normal-background-color: rgb(241, 241, 241); */

View File

@@ -41,6 +41,12 @@ export default {
margin-top: 10px; margin-top: 10px;
} }
.timeline-item:hover {
background-color: var(--menu-selected-background-color);
transition: background-color 0.2s;
border-radius: 10px;
}
.timeline-icon { .timeline-icon {
position: sticky; position: sticky;
top: 0; top: 0;

View File

@@ -8,13 +8,15 @@
</div> </div>
<div class="messages-list" ref="messagesListEl"> <div class="messages-list" ref="messagesListEl">
<div v-if="loading" class="loading-container">加载中...</div> <div v-if="loading" class="loading-container">
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
</div>
<div v-else-if="error" class="error-container">{{ error }}</div> <div v-else-if="error" class="error-container">{{ error }}</div>
<template v-else> <template v-else>
<div class="load-more-container" v-if="hasMoreMessages"> <div class="load-more-container" v-if="hasMoreMessages">
<button @click="loadMoreMessages" :disabled="loadingMore" class="load-more-button"> <div @click="loadMoreMessages" :disabled="loadingMore" class="load-more-button">
{{ loadingMore ? '加载中...' : '查看更多消息' }} {{ loadingMore ? '加载中...' : '查看更多消息' }}
</button> </div>
</div> </div>
<BaseTimeline :items="messages"> <BaseTimeline :items="messages">
<template #item="{ item }"> <template #item="{ item }">
@@ -382,27 +384,21 @@ onUnmounted(() => {
padding-bottom: 100px; padding-bottom: 100px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.load-more-container { .load-more-container {
text-align: center; text-align: center;
margin-bottom: 20px;
} }
.load-more-button { .load-more-button {
background-color: var(--bg-color-soft); color: var(--primary-color);
border: 1px solid var(--border-color); font-size: 12px;
color: var(--text-color-primary);
padding: 8px 16px;
border-radius: 20px;
cursor: pointer; cursor: pointer;
transition: background-color 0.2s;
} }
.load-more-button:hover { .load-more-button:hover {
background-color: var(--border-color); text-decoration: underline;
} }
.message-item { .message-item {
@@ -458,7 +454,13 @@ onUnmounted(() => {
margin-right: 20px; margin-right: 20px;
} }
.loading-container, .loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 300px;
}
.error-container { .error-container {
text-align: center; text-align: center;
padding: 50px; padding: 50px;

View File

@@ -12,7 +12,12 @@
<div class="empty-text">暂无会话</div> <div class="empty-text">暂无会话</div>
</div> </div>
<div v-if="!loading" class="search-container">
<SearchDropdown />
</div>
<div <div
v-if="!loading"
v-for="convo in conversations" v-for="convo in conversations"
:key="convo.id" :key="convo.id"
class="conversation-item" class="conversation-item"
@@ -61,6 +66,7 @@ import { useWebSocket } from '~/composables/useWebSocket'
import { useUnreadCount } from '~/composables/useUnreadCount' import { useUnreadCount } from '~/composables/useUnreadCount'
import TimeManager from '~/utils/time' import TimeManager from '~/utils/time'
import { stripMarkdownLength } from '~/utils/markdown' import { stripMarkdownLength } from '~/utils/markdown'
import SearchDropdown from '~/components/SearchDropdown.vue'
const config = useRuntimeConfig() const config = useRuntimeConfig()
const conversations = ref([]) const conversations = ref([])
@@ -169,6 +175,10 @@ function goToConversation(id) {
height: 300px; height: 300px;
} }
.search-container {
margin-bottom: 24px;
}
.messages-header { .messages-header {
margin-bottom: 24px; margin-bottom: 24px;
} }