2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import React from 'react';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { connect } from 'react-redux';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { mapDispatchToProps } from '../actions';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { LeftPane } from '../../components/LeftPane';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { StateType } from '../reducer';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-11 17:20:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { getSearchResults, isSearching } from '../selectors/search';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { getIntl } from '../selectors/user';
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getLeftPaneLists,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getSelectedConversation,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  getShowArchived,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								} from '../selectors/conversations';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { SmartExpiredBuildDialog } from './ExpiredBuildDialog';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { SmartMainHeader } from './MainHeader';
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-08 17:46:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { SmartMessageSearchResult } from './MessageSearchResult';
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { SmartNetworkStatus } from './NetworkStatus';
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-16 15:20:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { SmartRelinkDialog } from './RelinkDialog';
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { SmartUpdateDialog } from './UpdateDialog';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Workaround: A react component's required properties are filtering up through connect()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								//   https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31363
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartMainHeader = SmartMainHeader as any;
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-08 17:46:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartMessageSearchResult = SmartMessageSearchResult as any;
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartNetworkStatus = SmartNetworkStatus as any;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartUpdateDialog = SmartUpdateDialog as any;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartExpiredBuildDialog = SmartExpiredBuildDialog as any;
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-16 15:20:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const FilteredSmartRelinkDialog = SmartRelinkDialog as any;
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function renderExpiredBuildDialog(): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartExpiredBuildDialog />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function renderMainHeader(): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartMainHeader />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-08 17:46:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function renderMessageSearchResult(id: string): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartMessageSearchResult id={id} />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function renderNetworkStatus(): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartNetworkStatus />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-16 15:20:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function renderRelinkDialog(): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartRelinkDialog />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function renderUpdateDialog(): JSX.Element {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return <FilteredSmartUpdateDialog />;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const mapStateToProps = (state: StateType) => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const showSearch = isSearching(state);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-11 17:20:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const lists = showSearch ? undefined : getLeftPaneLists(state);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const searchResults = showSearch ? getSearchResults(state) : undefined;
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const selectedConversationId = getSelectedConversation(state);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-11 17:20:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return {
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-11 17:20:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ...lists,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    searchResults,
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-07 13:36:16 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    selectedConversationId,
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-11 17:20:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    showArchived: getShowArchived(state),
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    i18n: getIntl(state),
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderExpiredBuildDialog,
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-31 15:42:01 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderMainHeader,
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-08 17:46:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderMessageSearchResult,
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderNetworkStatus,
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-16 15:20:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderRelinkDialog,
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-12 13:30:58 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderUpdateDialog,
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 13:49:58 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const smart = connect(mapStateToProps, mapDispatchToProps);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export const SmartLeftPane = smart(LeftPane);
							 |