You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
import { connect } from 'react-redux';
 | 
						|
import { LeftPane } from '../../components/LeftPane';
 | 
						|
import { StateType } from '../reducer';
 | 
						|
 | 
						|
import { getQuery, getSearchResults, isSearching } from '../selectors/search';
 | 
						|
import { getIntl, getOurNumber } from '../selectors/user';
 | 
						|
import {
 | 
						|
  getLeftPaneLists,
 | 
						|
  getOurPrimaryConversation,
 | 
						|
} from '../selectors/conversations';
 | 
						|
import { mapDispatchToProps } from '../actions';
 | 
						|
import { getFocusedSection } from '../selectors/section';
 | 
						|
import { getTheme } from '../selectors/theme';
 | 
						|
 | 
						|
// Workaround: A react component's required properties are filtering up through connect()
 | 
						|
//   https://github.com/DefinitelyTyped/DefinitelyTyped/issues/3136k3
 | 
						|
 | 
						|
const mapStateToProps = (state: StateType) => {
 | 
						|
  const showSearch = isSearching(state);
 | 
						|
 | 
						|
  const leftPaneList = getLeftPaneLists(state);
 | 
						|
  const lists = showSearch ? undefined : leftPaneList;
 | 
						|
  const searchResults = showSearch ? getSearchResults(state) : undefined;
 | 
						|
  return {
 | 
						|
    ...lists,
 | 
						|
    ourPrimaryConversation: getOurPrimaryConversation(state), // used in actionPanel
 | 
						|
    searchTerm: getQuery(state),
 | 
						|
    ourNumber: getOurNumber(state),
 | 
						|
    searchResults,
 | 
						|
    i18n: getIntl(state),
 | 
						|
    unreadMessageCount: leftPaneList.unreadCount,
 | 
						|
    theme: getTheme(state),
 | 
						|
    focusedSection: getFocusedSection(state),
 | 
						|
  };
 | 
						|
};
 | 
						|
 | 
						|
const smart = connect(mapStateToProps, mapDispatchToProps);
 | 
						|
 | 
						|
export const SmartLeftPane = smart(LeftPane);
 |