import 'dayjs/locale/ru'; // load on demand

import _ from 'lodash';

import { ShmChannelMessageType } from '../../../api/types';
import FileTypeIcon from './FileTypeIcon';

const MessageReplayItem = ({ msg, onClick }: {
    msg: ShmChannelMessageType
    onClick: () => void;
}) => {



    return (
        <div className='mb-2 mt-2 border-l-2 border-gray-500 pl-2'>

            <div
                onClick={(e) => {
                    e.stopPropagation();
                    // e.preventDefault();

                    onClick();
                }}
                id={`replay-msg-${msg._id}`}>


                <div>{msg.text}</div>


                {msg.voice?.url && <div
                    className='text-sm '
                >Аудио сообщение</div>}

                {msg.attachments?.map((attachment) => {

                    return <div

                        className="cursor-pointer active:opacity-50 flex items-center space-x-2"
                    >


                        <FileTypeIcon doc={attachment} />

                        <div>{attachment.name}</div>

                    </div>

                })}



            </div>




        </div>

    );
};

export default MessageReplayItem;
