import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { RetinaImg } from 'nylas-component-kit'; import moment from 'moment'; import { FocusedPerspectiveStore } from 'nylas-exports'; import { updateReminderMetadata } from './send-reminders-utils'; import { PLUGIN_ID } from './send-reminders-constants'; class SendRemindersThreadTimestamp extends Component { static displayName = 'SendRemindersThreadTimestamp'; static propTypes = { thread: PropTypes.object, fallback: PropTypes.func, }; static containerRequired = false; onRemoveReminder(thread) { updateReminderMetadata(thread, {}); } render() { const Fallback = this.props.fallback; const current = FocusedPerspectiveStore.current(); if (!current.isReminders) { return ; } const { expiration } = this.props.thread.metadataForPluginId(PLUGIN_ID); if (!expiration) { return ; } const mExpiration = moment(expiration); return ( {`in ${mExpiration.fromNow(true)}`} ); } } export default SendRemindersThreadTimestamp;