import React from 'react'; import { LeftPaneSections, SectionType } from './session/LeftPaneSections'; import { LeftPaneMessageSection } from './session/LeftPaneMessageSection'; import { PropsData as ConversationListItemPropsType } from './ConversationListItem'; import { PropsData as SearchResultsProps } from './SearchResults'; import { SearchOptions } from '../types/Search'; interface State { selectedSection: SectionType; } interface Props { conversations?: Array; searchResults?: SearchResultsProps; searchTerm: string; isSecondaryDevice: boolean; // Action Creators startNewConversation: ( query: string, options: { regionCode: string } ) => void; openConversationInternal: (id: string, messageId?: string) => void; updateSearchTerm: (searchTerm: string) => void; search: (query: string, options: SearchOptions) => void; clearSearch: () => void; } export class LeftPane extends React.Component { public state = { selectedSection: SectionType.Message, }; public constructor(props: any) { super(props); this.handleSectionSelected = this.handleSectionSelected.bind(this); } public handleSectionSelected(section: SectionType) { this.setState({ selectedSection: section }); } public render(): JSX.Element { return (
{this.state.selectedSection === SectionType.Message && this.renderMessageSection()}
); } private renderMessageSection() { const { startNewConversation, openConversationInternal, conversations, searchResults, searchTerm, isSecondaryDevice, updateSearchTerm, search, clearSearch, } = this.props; return ( ); } }