import _ from 'lodash' ; import { createSelector } from 'reselect' ; import { ApplicationState } from 'store/reducers' ; param state return const getAppState = ( state ) => state . app ; param state return export const getChannel = createSelector ( [ getAppState ] , ( app ) => app . channel ) ; param state return export const getStatus = createSelector ( [ getAppState ] , ( app ) => app . status ) ; param state return export const getShouldReadChangelog = createSelector ( [ getAppState ] , ( app ) => app . shouldReadChangelog ) ; param state return export const getHistory = createSelector ( [ getAppState ] , ( app ) => app . history ) ; param state return export const getHistoryIndex = createSelector ( [ getAppState ] , ( app ) => app . historyIndex ) ; param state return export const getEmotes = createSelector ( [ getAppState ] , ( app ) => { return _ . sortBy ( _ . flatten ( _ . values ( app . emotes ) ) , 'code' ) ; } ) ; param state return export const getRoomState = createSelector ( [ getAppState ] , ( app ) => app . roomState ) ; param state return export const getChannelId = createSelector ( [ getAppState ] , ( app ) => _ . get ( app . roomState , 'roomId' ) ) ; param state return export const getLastWhisperSender = createSelector ( [ getAppState ] , ( app ) => app . lastWhisperSender ) ; param state return export const getEmotesSets = createSelector ( [ getAppState ] , ( app ) => { return _ . reduce ( app . emotes , ( emotes , setEmotes , setPrefix ) => { emotes [ setPrefix ] = _ . sortBy ( setEmotes , ( emote ) => emote . code . toLowerCase ( ) ) ; return emotes ; } , { } as typeof app . emotes ) ; } ) ;