2021-10-05 16:47:06 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { ConversationView } from '../../components/conversation/ConversationView';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { StateType } from '../reducer';
|
|
|
|
import type { CompositionAreaPropsType } from './CompositionArea';
|
|
|
|
import { SmartCompositionArea } from './CompositionArea';
|
|
|
|
import type { OwnProps as ConversationHeaderPropsType } from './ConversationHeader';
|
|
|
|
import { SmartConversationHeader } from './ConversationHeader';
|
|
|
|
import type { TimelinePropsType } from './Timeline';
|
|
|
|
import { SmartTimeline } from './Timeline';
|
2021-10-05 16:47:06 +00:00
|
|
|
|
|
|
|
export type PropsType = {
|
|
|
|
compositionAreaProps: Pick<
|
|
|
|
CompositionAreaPropsType,
|
|
|
|
| 'clearQuotedMessage'
|
|
|
|
| 'compositionApi'
|
|
|
|
| 'getQuotedMessage'
|
|
|
|
| 'handleClickQuotedMessage'
|
|
|
|
| 'id'
|
|
|
|
| 'onAccept'
|
|
|
|
| 'onBlock'
|
|
|
|
| 'onBlockAndReportSpam'
|
|
|
|
| 'onCancelJoinRequest'
|
|
|
|
| 'onClearAttachments'
|
|
|
|
| 'onClickAddPack'
|
|
|
|
| 'onCloseLinkPreview'
|
|
|
|
| 'onDelete'
|
|
|
|
| 'onEditorStateChange'
|
|
|
|
| 'onPickSticker'
|
|
|
|
| 'onSelectMediaQuality'
|
|
|
|
| 'onSendMessage'
|
|
|
|
| 'onStartGroupMigration'
|
|
|
|
| 'onTextTooLong'
|
|
|
|
| 'onUnblock'
|
|
|
|
| 'openConversation'
|
|
|
|
>;
|
|
|
|
conversationHeaderProps: ConversationHeaderPropsType;
|
|
|
|
timelineProps: TimelinePropsType;
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = (_state: StateType, props: PropsType) => {
|
2021-11-11 22:43:05 +00:00
|
|
|
const { compositionAreaProps, conversationHeaderProps, timelineProps } =
|
|
|
|
props;
|
2021-10-05 16:47:06 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
renderCompositionArea: () => (
|
|
|
|
<SmartCompositionArea {...compositionAreaProps} />
|
|
|
|
),
|
|
|
|
renderConversationHeader: () => (
|
|
|
|
<SmartConversationHeader {...conversationHeaderProps} />
|
|
|
|
),
|
|
|
|
renderTimeline: () => <SmartTimeline {...timelineProps} />,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartConversationView = smart(ConversationView);
|