import React, { ReactNode } from "react";
import { Avatar } from "@sparkle/components/Avatar";
import { ListItem } from "@sparkle/components/ListItem";
export interface ReplySectionProps {
totalMessages: number;
newMessages: number;
avatars: Array<{
name?: string;
emoji?: string;
visual?: string | React.ReactNode;
isRounded?: boolean;
backgroundColor?: string;
}>;
lastMessageBy: string;
}
export function ReplySection({
totalMessages,
newMessages,
avatars,
lastMessageBy,
}: ReplySectionProps) {
return (
{newMessages === 0 ? (
{totalMessages} Replies
) : newMessages === totalMessages ? (
{newMessages} Unread
) : (
<>
{newMessages} Unread
{" "}
({totalMessages} replies)
>
)}
. Last by {lastMessageBy}.
);
}
export interface ConversationListItemProps {
conversation: {
id: string;
title: string;
description?: string;
updatedAt: Date;
};
avatar?: {
name?: string;
emoji?: string;
visual?: string | React.ReactNode;
isRounded?: boolean;
backgroundColor?: string;
};
creator?: {
fullName: string;
portrait?: string;
};
time: string;
replySection?: ReactNode;
onClick?: () => void;
}
export function ConversationListItem({
conversation,
avatar,
creator,
time,
replySection,
onClick,
}: ConversationListItemProps) {
return (
{creator ? (
) : avatar ? (
) : null}
{creator && {creator.fullName}}
{conversation.title}
{time}
{conversation.description && (
{conversation.description}
)}
{replySection && replySection}
);
}