2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-27 21:37:06 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
|
|
|
|
import { ConversationHero } from '../../components/conversation/ConversationHero';
|
|
|
|
|
|
|
|
import { StateType } from '../reducer';
|
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
|
|
|
|
type ExternalProps = {
|
|
|
|
id: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
|
|
|
const { id } = props;
|
|
|
|
|
|
|
|
const conversation = state.conversations.conversationLookup[id];
|
|
|
|
|
|
|
|
if (!conversation) {
|
|
|
|
throw new Error(`Did not find conversation ${id} in state!`);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
i18n: getIntl(state),
|
2020-07-29 23:20:05 +00:00
|
|
|
...conversation,
|
2020-05-27 21:37:06 +00:00
|
|
|
conversationType: conversation.type,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartHeroRow = smart(ConversationHero);
|