2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2019-2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-01-14 21:49:58 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
import { mapDispatchToProps } from '../actions';
|
2019-01-14 21:49:58 +00:00
|
|
|
import { StateType } from '../reducer';
|
|
|
|
|
|
|
|
import { MessageSearchResult } from '../../components/MessageSearchResult';
|
2019-08-09 00:46:49 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { getMessageSearchResultSelector } from '../selectors/search';
|
2019-01-14 21:49:58 +00:00
|
|
|
|
|
|
|
type SmartProps = {
|
|
|
|
id: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
function mapStateToProps(state: StateType, ourProps: SmartProps) {
|
|
|
|
const { id } = ourProps;
|
|
|
|
|
2019-08-09 00:46:49 +00:00
|
|
|
const props = getMessageSearchResultSelector(state)(id);
|
|
|
|
|
|
|
|
return {
|
|
|
|
...props,
|
|
|
|
i18n: getIntl(state),
|
|
|
|
};
|
2019-01-14 21:49:58 +00:00
|
|
|
}
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartMessageSearchResult = smart(MessageSearchResult);
|