'use client'; import { PropsWithChildren } from 'react'; import Link from 'next/link'; import { useParams } from 'next/navigation'; import { cn } from '@/lib/utils'; import { ChatEntity } from '@/lib/types'; import Image from 'next/image'; import clsx from 'clsx'; import Img from '../ui/Img'; type ChatCardProps = PropsWithChildren<{ chat: ChatEntity; }>; export const ChatCardLayout: React.FC< PropsWithChildren<{ link: string; classNames?: clsx.ClassValue }> > = ({ link, children, classNames }) => { return ( {children} ); }; const ChatCard: React.FC = ({ chat }) => { const { id: chatIdFromParam } = useParams(); const { id, url, messages, user } = chat; const firstMessage = messages?.[0]?.content; const title = firstMessage ? firstMessage.length > 50 ? firstMessage.slice(0, 50) + '...' : firstMessage : '(No messages yet)'; return (

{title}

); }; export default ChatCard;