signal-desktop/ts/state/smart/TimelineItem.tsx
2019-08-21 14:52:30 -07:00

28 lines
713 B
TypeScript

import { connect } from 'react-redux';
import { mapDispatchToProps } from '../actions';
import { StateType } from '../reducer';
import { TimelineItem } from '../../components/conversation/TimelineItem';
import { getIntl } from '../selectors/user';
import { getMessageSelector } from '../selectors/conversations';
type ExternalProps = {
id: string;
};
const mapStateToProps = (state: StateType, props: ExternalProps) => {
const { id } = props;
const messageSelector = getMessageSelector(state);
const item = messageSelector(id);
return {
item,
i18n: getIntl(state),
};
};
const smart = connect(mapStateToProps, mapDispatchToProps);
export const SmartTimelineItem = smart(TimelineItem);