import { Image } from 'antd'; import { useState } from 'react'; import { IChatItem } from '../ChatLogsType'; import styles from './index.module.scss'; export const ChatImage: React.FC = (props) => { const [visible, setVisible] = useState(false); function content() { try { const msg = JSON.parse(props.chat?.content as string); return (
{ setVisible(value); }, }} src={`/api/${msg.path}`} style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }} alt="" />
); } catch (_e) { return (
{props.chat?.content}
); } } return ( <> {props.from?.user_id == props.chat?.msg_from ? (
{props.from?.name}
{content()}
{props.from?.name[0]}
) : (
{props.to?.cust_info.name}
{content()}
)} ); };