import React from 'react'; import { LocalizerType } from '../../types/Util'; import { Message, PropsActions as MessageActionsType, PropsData as MessageProps, } from './Message'; import { PropsData as TimerNotificationProps, TimerNotification, } from './TimerNotification'; import { PropsActions as SafetyNumberActionsType, PropsData as SafetyNumberNotificationProps, SafetyNumberNotification, } from './SafetyNumberNotification'; import { PropsData as VerificationNotificationProps, VerificationNotification, } from './VerificationNotification'; import { GroupNotification, PropsData as GroupNotificationProps, } from './GroupNotification'; import { ResetSessionNotification } from './ResetSessionNotification'; type MessageType = { type: 'message'; data: MessageProps; }; type TimerNotificationType = { type: 'timerNotification'; data: TimerNotificationProps; }; type SafetyNumberNotificationType = { type: 'safetyNumberNotification'; data: SafetyNumberNotificationProps; }; type VerificationNotificationType = { type: 'verificationNotification'; data: VerificationNotificationProps; }; type GroupNotificationType = { type: 'groupNotification'; data: GroupNotificationProps; }; type ResetSessionNotificationType = { type: 'resetSessionNotification'; data: null; }; type PropsData = { item: | MessageType | TimerNotificationType | SafetyNumberNotificationType | VerificationNotificationType | ResetSessionNotificationType | GroupNotificationType; }; type PropsHousekeeping = { i18n: LocalizerType; }; type PropsActions = MessageActionsType & SafetyNumberActionsType; type Props = PropsData & PropsHousekeeping & PropsActions; export class TimelineItem extends React.PureComponent { public render() { const { item, i18n } = this.props; if (!item) { throw new Error('TimelineItem: Item was not provided!'); } if (item.type === 'message') { return ; } if (item.type === 'timerNotification') { return ; } if (item.type === 'safetyNumberNotification') { return ( ); } if (item.type === 'verificationNotification') { return ( ); } if (item.type === 'groupNotification') { return ; } if (item.type === 'resetSessionNotification') { return ( ); } throw new Error('TimelineItem: Unknown type!'); } }