All files / src/components/pages/chat/chat-other-chat index.tsx

35.48% Statements 11/31
100% Branches 0/0
0% Functions 0/1
35.48% Lines 11/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                          
import { ProfileImage } from '@/components/shared';
import { formatKoreanTime } from '@/lib/formatDateTime';
import { ChatMessage } from '@/types/service/chat';
 
import { ExpandableText } from '../chat-long-text';
 
interface IProps {
  item: ChatMessage;
}
 
export const OtherChat = ({ item }: IProps) => {
  const { senderProfileImage, senderName, content, timestamp, createdAt } = item;
  const time = timestamp ?? createdAt;
  return (
    <div className='flex'>
      <ProfileImage className='mr-3' size='sm' src={senderProfileImage} />

      <div className='mr-1.5 max-w-60'>
        <span className='text-text-xs-medium text-gray-800'>{senderName}</span>

        <div className='bg-mono-white mt-1 rounded-tl-sm rounded-tr-2xl rounded-br-2xl rounded-bl-2xl px-4 py-3 break-words'>
          <ExpandableText text={content} />
        </div>
      </div>

      <div className='text-text-2xs-regular flex items-end py-1 text-gray-500'>
        {time && formatKoreanTime(time)}
      </div>
    </div>
  );
};