/** * @file components/chat/ChatMessages.tsx * @description Message history container component displaying initial channel greeting and rendering a list of individual chat messages. */ "use client"; import { ChatItem, type MessageWithMember } from "./ChatItem"; /** * Properties for the ChatMessages component. * * @interface ChatMessagesProps * @property {string} channelName - The name of the active chat channel to display in the header greeting. * @property {MessageWithMember[]} messages - Array of message objects, each containing message details and associated member information. * @property {string} [currentUserId] - The unique identifier of the currently logged-in user. */ interface ChatMessagesProps { channelName: string; messages: MessageWithMember[]; currentUserId?: string; } /** * Renders the scrollable message list along with a welcoming channel header. * * @param {ChatMessagesProps} props - The component props. * @param {string} props.channelName - The name of the active chat channel to display in the header greeting. * @param {MessageWithMember[]} props.messages - Array of message objects, each containing message details and associated member information. * @param {string} [props.currentUserId] - The unique identifier of the currently logged-in user. * @returns {JSX.Element} The rendered chat messages container. */ export function ChatMessages({ channelName, messages, currentUserId, }: ChatMessagesProps) { return (
This is the beginning of the channel #{channelName}.