'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'; 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.slice(0, 50); return (
{url}

{firstMessage ? firstMessage + ' ...' : '(No messages yet)'}

); }; export default ChatCard;