import React from 'react'; import moment from 'moment'; import PropTypes from 'prop-types'; import { RetinaImg } from 'mailspring-component-kit'; import { DateUtils } from 'mailspring-exports'; import { updateReminderMetadata } from './send-reminders-utils'; import { PLUGIN_ID } from './send-reminders-constants'; export function NotificationExplanationMessageHeader({ thread, message }) { const { shouldNotify, sentHeaderMessageId } = thread.metadataForPluginId(PLUGIN_ID) || {}; if (!shouldNotify) { return ; } if (message.headerMessageId !== sentHeaderMessageId) { return ; } return (
Reminder
); } NotificationExplanationMessageHeader.displayName = 'NotificationExplanationMessageHeader'; NotificationExplanationMessageHeader.containerRequired = false; NotificationExplanationMessageHeader.propTypes = { messages: PropTypes.array, message: PropTypes.object, thread: PropTypes.object, }; export function ScheduledReminderThreadHeader({ thread }) { const metadata = thread.metadataForPluginId(PLUGIN_ID) || {}; if (!metadata.expiration) { return ; } const onClearReminder = () => { updateReminderMetadata(thread, {}); }; return (
{` ${moment(metadata.expiration).format(DateUtils.DATE_FORMAT_LONG_NO_YEAR)}`} Cancel
); } ScheduledReminderThreadHeader.displayName = 'ScheduledReminderThreadHeader'; ScheduledReminderThreadHeader.containerRequired = false; ScheduledReminderThreadHeader.propTypes = { thread: PropTypes.object, messages: PropTypes.array, };