import React from 'react'; import { ContactName } from './ContactName'; import { Intl } from '../Intl'; import { LocalizerType } from '../../types/Util'; import { missingCaseError } from '../../util/missingCaseError'; import { SessionIcon, SessionIconSize, SessionIconType } from '../session/icon'; interface Props { type: 'fromOther' | 'fromMe' | 'fromSync'; phoneNumber: string; profileName?: string; name?: string; disabled: boolean; timespan: string; } export class TimerNotification extends React.Component { public renderContents() { const { phoneNumber, profileName, timespan, type, disabled } = this.props; const changeKey = disabled ? 'disabledDisappearingMessages' : 'theyChangedTheTimer'; const displayedPubkey = profileName ? window.shortenPubkey(phoneNumber) : phoneNumber; switch (type) { case 'fromOther': return ( , timespan, ]} /> ); case 'fromMe': return disabled ? window.i18n('youDisabledDisappearingMessages') : window.i18n('youChangedTheTimer', [timespan]); case 'fromSync': return disabled ? window.i18n('disappearingMessagesDisabled') : window.i18n('timerSetOnSync', [timespan]); default: throw missingCaseError(type); } } public render() { return (
{this.renderContents()}
); } }