(props)
| 10 | * @param {Object} props - The properties for the component. |
| 11 | */ |
| 12 | const Message = (props) => { |
| 13 | const { id, createdAt, text, ai = false, selected } = props.message; |
| 14 | |
| 15 | return ( |
| 16 | <div |
| 17 | key={id} |
| 18 | className={`flex items-end my-2 gap-2 ${ |
| 19 | ai ? 'flex-row-reverse justify-end' : 'flex-row justify-end' |
| 20 | }`}> |
| 21 | {selected === 'DALL·E' && ai ? ( |
| 22 | <Image url={text} /> |
| 23 | ) : ( |
| 24 | <div |
| 25 | className={` w-screen overflow-hidden chat ${ |
| 26 | ai ? 'chat-start' : 'chat-end' |
| 27 | }`}> |
| 28 | <div className='chat-bubble text-neutral-content'> |
| 29 | <Markdown markdownText={text} /> |
| 30 | <div className={`${ai ? 'text-left' : 'text-right'} text-xs`}> |
| 31 | {moment(createdAt).calendar()} |
| 32 | </div> |
| 33 | </div> |
| 34 | </div> |
| 35 | )} |
| 36 | |
| 37 | <div className='avatar'> |
| 38 | <div className='w-8 border rounded-full border-slate-400'> |
| 39 | {ai ? ( |
| 40 | <MdComputer className='w-6 h-full m-auto' /> |
| 41 | ) : ( |
| 42 | <MdPerson className='w-6 h-full m-auto' /> |
| 43 | )} |
| 44 | </div> |
| 45 | </div> |
| 46 | </div> |
| 47 | ); |
| 48 | }; |
| 49 | |
| 50 | export default Message; |
| 51 |
nothing calls this directly
no outgoing calls
no test coverage detected