import { useUIKit } from '@tencentcloud/uikit-base-component-react'; import cs from 'classnames'; import { Avatar } from 'tuikit-atomicx-react/chat'; import { SearchMessageItem } from '../SearchMessageItem'; import styles from './SearchMessageList.module.scss'; import type { MessageInfo } from 'tuikit-atomicx-react/chat'; interface SearchMessageListProps { /** Flattened messages to render. */ messages: MessageInfo[]; /** Keyword used for highlight within text content. */ keyword: string; isLoading?: boolean; isLoadingMore?: boolean; error?: string | null; /** True when a search has been performed (distinguishes "no query" from "no hits"). */ hasSearched?: boolean; hasMore?: boolean; onLoadMore?: (() => void) | undefined; /** * When provided, tapping a row locates the message. On H5 the whole row * is the tap target (no hover locate button). */ onLocateMessage?: ((message: MessageInfo) => void) | undefined; className?: string; } /** * Shared in-conversation message result list. * * Consumed by both EmbeddedSearch (sidebar, whole list) and StandardSearch * (right-hand detail pane), so "search messages within one conversation" has * exactly one rendering implementation. */ export function SearchMessageList({ messages, keyword, isLoading = false, isLoadingMore = false, error = null, hasSearched = false, hasMore = false, onLoadMore, onLocateMessage, className, }: SearchMessageListProps) { const { t } = useUIKit(); const isEmpty = hasSearched && !isLoading && !error && messages.length === 0; if (isLoading) { return