|
| 1 | +import React, { Component } from 'react'; |
| 2 | +import './MeetingMessage.css'; |
| 3 | + |
| 4 | +import FaCalendar from 'react-icons/lib/fa/calendar'; |
| 5 | +import MdMoreHoriz from 'react-icons/lib/md/more-horiz' |
| 6 | +import IoVideoCamera from 'react-icons/lib/io/ios-videocam' |
| 7 | + |
| 8 | +import { |
| 9 | + format, |
| 10 | +} from'timeago.js'; |
| 11 | + |
| 12 | +import Avatar from '../Avatar/Avatar'; |
| 13 | + |
| 14 | +import classNames from 'classnames'; |
| 15 | + |
| 16 | +export class MeetingMessage extends Component { |
| 17 | + constructor(props) { |
| 18 | + super(props); |
| 19 | + |
| 20 | + } |
| 21 | + |
| 22 | + toggleClick(id) { |
| 23 | + var x = document.getElementById(id); |
| 24 | + if (x.style.display === "none" || x.style.display === "") { |
| 25 | + x.style.display = "flex"; |
| 26 | + } else { |
| 27 | + x.style.display = "none"; |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + render() { |
| 32 | + const { |
| 33 | + id, |
| 34 | + title, |
| 35 | + meetSubject, |
| 36 | + onClick, |
| 37 | + date, |
| 38 | + dataSource, |
| 39 | + } = this.props; |
| 40 | + |
| 41 | + const dateText = date && !isNaN(date) && (format(date)); |
| 42 | + |
| 43 | + return ( |
| 44 | + <div |
| 45 | + className="rce-mbox-mtmg" |
| 46 | + onClick={onClick}> |
| 47 | + <div className="rce-mtmg"> |
| 48 | + <div |
| 49 | + className="rce-mtmg-subject"> |
| 50 | + {meetSubject || 'Unknown'} |
| 51 | + </div> |
| 52 | + <div |
| 53 | + className="rce-mtmg-toogleClick" |
| 54 | + onClick={() => this.toggleClick(id)}> |
| 55 | + <div className="rce-mtmg-item"> |
| 56 | + <FaCalendar /> |
| 57 | + <div className="rce-mtmg-content"> |
| 58 | + <span className="rce-mtmg-title"> |
| 59 | + {title} |
| 60 | + </span> |
| 61 | + <span className='rce-mtmg-date'> |
| 62 | + {dateText} |
| 63 | + </span> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + <div className="rce-mtmg-right-icon"> |
| 67 | + <MdMoreHoriz/> |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + <div id={id} |
| 71 | + className="rce-mtmg-toogleContent" |
| 72 | + style={{display: "none"}} > |
| 73 | + { |
| 74 | + dataSource && |
| 75 | + dataSource.map((x, i) => { |
| 76 | + return ( |
| 77 | + <div className="rce-mitem"> |
| 78 | + <div className="rce-mitem-body"> |
| 79 | + <div className="rce-mitem-body--top"> |
| 80 | + <div className="rce-mitem-body--top-title"> |
| 81 | + {x.title} |
| 82 | + </div> |
| 83 | + <div className="rce-mitem-body--top-time"> |
| 84 | + { |
| 85 | + x.date && |
| 86 | + !isNaN(x.date) && |
| 87 | + (format(x.date)) |
| 88 | + } |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + <div className="rce-mitem-body--bottom"> |
| 92 | + <div |
| 93 | + className="rce-mitem-body--bottom-title" > |
| 94 | + {x.message} |
| 95 | + </div> |
| 96 | + </div> |
| 97 | + </div> |
| 98 | + </div> |
| 99 | + ) |
| 100 | + }) |
| 101 | + } |
| 102 | + </div> |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + ); |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +MeetingMessage.defaultProps = { |
| 110 | + id: '', |
| 111 | + alt: '', |
| 112 | + title: '', |
| 113 | + meetSubject: '', |
| 114 | + message: '', |
| 115 | + dataSource: [], |
| 116 | + date: new Date(), |
| 117 | + onClick: () => void(0), |
| 118 | + onAvatarError: () => void(0), |
| 119 | +}; |
| 120 | + |
| 121 | +export default MeetingMessage; |
0 commit comments