Mailspring/internal_packages/send-later/lib/send-later-status.jsx
Juan Tejada 76bda1dbe4 feat(snooze/send-later): Add snooze and send later plugins
Summary:
- Add initial version of snooze and send later plugins
- Tests are missing since this will probably heavily change before we are done with them

Test Plan: - TODO

Reviewers: drew, bengotow, evan

Reviewed By: bengotow, evan

Differential Revision: https://phab.nylas.com/D2578
2016-02-18 10:06:21 -08:00

40 lines
1.2 KiB
JavaScript

import React, {Component, PropTypes} from 'react'
import moment from 'moment'
import {DateUtils} from 'nylas-exports'
import {RetinaImg} from 'nylas-component-kit'
import SendLaterActions from './send-later-actions'
import {PLUGIN_ID, DATE_FORMAT_SHORT} from './send-later-constants'
export default class SendLaterStatus extends Component {
static displayName = 'SendLaterStatus';
static propTypes = {
draft: PropTypes.object,
};
onCancelSendLater = ()=> {
SendLaterActions.cancelSendLater(this.props.draft.clientId)
};
render() {
const {draft} = this.props
const metadata = draft.metadataForPluginId(PLUGIN_ID)
if (metadata && metadata.sendLaterDate) {
const {sendLaterDate} = metadata
const formatted = DateUtils.format(moment(sendLaterDate), DATE_FORMAT_SHORT)
return (
<div className="send-later-status">
<em className="send-later-status">
{`Scheduled for ${formatted}`}
</em>
<RetinaImg
name="image-cancel-button.png"
title="Cancel Send Later"
onClick={this.onCancelSendLater}
mode={RetinaImg.Mode.ContentPreserve} />
</div>
)
}
return <span />
}
}