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

35.71% Statements 10/28
100% Branches 0/0
0% Functions 0/1
35.71% Lines 10/28

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 291x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                      
import { formatKoreanTime } from '@/lib/formatDateTime';
import { ChatMessage } from '@/types/service/chat';
 
import { ExpandableText } from '../chat-long-text';
 
interface IProps {
  item: ChatMessage;
}
 
export const MyChat = ({ item }: IProps) => {
  const { content, timestamp, createdAt } = item;

  const time = timestamp ?? createdAt;

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

      <div className='ml-1.5'>
        <div className='bg-mint-200 mt-1 max-w-60 rounded-tl-2xl rounded-tr-sm rounded-br-2xl rounded-bl-2xl px-4 py-3 break-words'>
          <ExpandableText text={content} />
        </div>
      </div>
    </div>
  );
};