const React = require('react'); const DropDownButton = require('./DropDownButton.js'); const Store = require('./Store.js'); const Util = require('./Util.js'); var MessageView = module.exports = React.createClass({ formatLongDate: function(dt) { if (!(dt instanceof Date)) dt = new Date(dt.replace(' ', 'T')); var h = dt.getHours(); var m = dt.getMinutes(); var s = dt.getSeconds(); return Util.WeekDays[dt.getDay()]+' '+dt.getDate()+' '+Util.Months[dt.getMonth()]+' '+dt.getFullYear()+' '+(h < 10 ? '0' : '')+h+':'+(m < 10 ? '0' : '')+m+':'+(s < 10 ? '0' : '')+s //return dt.toLocaleString(); }, componentDidMount: function() { Store.on('quickReply', this.setQuickReply); Store.on('msg', this.setMsg); }, componentWillUnmount: function() { Store.un('quickReply', this.setQuickReply); Store.un('msg', this.setMsg); }, setQuickReply: function() { this.setState({ quickReply: Store.quickReply }); }, setMsg: function() { this.setState({ msg: Store.msg }); }, getInitialState: function() { return { quickReply: Store.quickReply }; }, render: function() { var msg = this.state.msg; return
Reply All Label
No message selected
{msg ? [
{this.formatLongDate(msg.time)}
{msg.subject}
From
{msg.from+' <'+msg.fromEmail+'>'}
To
{msg.to}
{msg.cc ?
Cc
{msg.cc.map(cc => {cc})}
: null} {msg.replyto ?
Reply-to
{msg.replyto}
: null}
, (msg.blockedImages ?
This message contains blocked images. Load Images
: null),
, this.state.quickReply ?
Quick Reply Quick Reply All
: null ] : null}
} });