refactor: clean up imports and improve ConversationList structure
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { UserIcon } from "lucide-react"
|
import { UserIcon } from "lucide-react";
|
||||||
|
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||||
import { ScrollArea } from "@/components/ui/scroll-area"
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
import { formatDateTime } from "@/lib/utils"
|
import { getEnumLabel } from "@/lib/enums";
|
||||||
import { useAgentConversationsStore } from "@/lib/stores/agent-conversations"
|
|
||||||
import {
|
import {
|
||||||
IMConversationStatus,
|
IMConversationStatus,
|
||||||
IMConversationStatusLabels,
|
IMConversationStatusLabels,
|
||||||
} from "@/lib/generated/enums"
|
} from "@/lib/generated/enums";
|
||||||
import { getEnumLabel } from "@/lib/enums"
|
import { useAgentConversationsStore } from "@/lib/stores/agent-conversations";
|
||||||
|
import { formatDateTime } from "@/lib/utils";
|
||||||
|
|
||||||
function getStatusVariant(status: number) {
|
function getStatusVariant(status: number) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@@ -38,8 +38,7 @@ export function ConversationList({ onAfterSelect }: ConversationListProps) {
|
|||||||
const selectConversation = useAgentConversationsStore((state) => state.selectConversation)
|
const selectConversation = useAgentConversationsStore((state) => state.selectConversation)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollArea className="flex-1 bg-transparent">
|
<ScrollArea className="overflow-auto">
|
||||||
<div className="divide-y divide-border">
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="p-6 text-center text-sm text-muted-foreground">
|
<div className="p-6 text-center text-sm text-muted-foreground">
|
||||||
加载中...
|
加载中...
|
||||||
@@ -50,7 +49,7 @@ export function ConversationList({ onAfterSelect }: ConversationListProps) {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={conversation.id}
|
key={conversation.id}
|
||||||
className={`cursor-pointer px-2.5 py-1.5 transition-colors hover:bg-muted/50 ${
|
className={`cursor-pointer px-2.5 py-1.5 transition-colors hover:bg-muted/50 border-b ${
|
||||||
isSelected ? "bg-muted/80" : ""
|
isSelected ? "bg-muted/80" : ""
|
||||||
}`}
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -117,7 +116,6 @@ export function ConversationList({ onAfterSelect }: ConversationListProps) {
|
|||||||
暂无会话
|
暂无会话
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user