// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import { useSelector } from 'react-redux'; import type { CompositionAreaPropsType } from './CompositionArea'; import type { OwnProps as ConversationHeaderPropsType } from './ConversationHeader'; import type { StateType } from '../reducer'; import type { ReactPanelRenderType } from '../../types/Panels'; import type { TimelinePropsType } from './Timeline'; import * as log from '../../logging/log'; import { ContactDetail } from '../../components/conversation/ContactDetail'; import { ConversationView } from '../../components/conversation/ConversationView'; import { PanelType } from '../../types/Panels'; import { SmartAllMedia } from './AllMedia'; import { SmartChatColorPicker } from './ChatColorPicker'; import { SmartCompositionArea } from './CompositionArea'; import { SmartConversationDetails } from './ConversationDetails'; import { SmartConversationHeader } from './ConversationHeader'; import { SmartConversationNotificationsSettings } from './ConversationNotificationsSettings'; import { SmartGV1Members } from './GV1Members'; import { SmartGroupLinkManagement } from './GroupLinkManagement'; import { SmartGroupV2Permissions } from './GroupV2Permissions'; import { SmartPendingInvites } from './PendingInvites'; import { SmartStickerManager } from './StickerManager'; import { SmartTimeline } from './Timeline'; import { getIntl } from '../selectors/user'; import { getTopPanelRenderableByReact } from '../selectors/conversations'; import { startConversation } from '../../util/startConversation'; import { useComposerActions } from '../ducks/composer'; export type PropsType = { conversationId: string; compositionAreaProps: Pick< CompositionAreaPropsType, | 'id' | 'onCancelJoinRequest' | 'onClearAttachments' | 'onCloseLinkPreview' | 'onEditorStateChange' | 'onSelectMediaQuality' | 'onTextTooLong' >; conversationHeaderProps: ConversationHeaderPropsType; timelineProps: TimelinePropsType; }; export function SmartConversationView({ compositionAreaProps, conversationHeaderProps, conversationId, timelineProps, }: PropsType): JSX.Element { const topPanel = useSelector( getTopPanelRenderableByReact ); const { processAttachments } = useComposerActions(); const i18n = useSelector(getIntl); return ( ( )} renderConversationHeader={() => ( )} renderTimeline={() => } renderPanel={() => { if (!topPanel) { return; } if (topPanel.type === PanelType.AllMedia) { return (
); } if (topPanel.type === PanelType.ChatColorEditor) { return (
); } if (topPanel.type === PanelType.ContactDetails) { const { contact, signalAccount } = topPanel.args; return (
{ if (signalAccount) { startConversation( signalAccount.phoneNumber, signalAccount.uuid ); } }} />
); } if (topPanel.type === PanelType.ConversationDetails) { return (
); } if (topPanel.type === PanelType.GroupInvites) { return (
); } if (topPanel.type === PanelType.GroupLinkManagement) { return (
); } if (topPanel.type === PanelType.GroupPermissions) { return (
); } if (topPanel.type === PanelType.GroupV1Members) { return (
); } if (topPanel.type === PanelType.NotificationSettings) { return (
); } if (topPanel.type === PanelType.StickerManager) { return (
); } log.warn('renderPanel: Got unexpected panel', topPanel); return undefined; }} /> ); }