Changeset View
Changeset View
Standalone View
Standalone View
web/redux/redux-setup.js
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
import reduceNavInfo from './nav-reducer.js'; | import reduceNavInfo from './nav-reducer.js'; | ||||
import { getVisibility } from './visibility.js'; | import { getVisibility } from './visibility.js'; | ||||
import { filterThreadIDsBelongingToCommunity } from '../selectors/calendar-selectors.js'; | import { filterThreadIDsBelongingToCommunity } from '../selectors/calendar-selectors.js'; | ||||
import { activeThreadSelector } from '../selectors/nav-selectors.js'; | import { activeThreadSelector } from '../selectors/nav-selectors.js'; | ||||
import { type NavInfo } from '../types/nav-types.js'; | import { type NavInfo } from '../types/nav-types.js'; | ||||
export type WindowDimensions = { width: number, height: number }; | export type WindowDimensions = { width: number, height: number }; | ||||
export type PickedCommunities = { | |||||
chat: ?string, | |||||
calendar: ?string, | |||||
}; | |||||
kamil: can you make those read-only? | |||||
export type AppState = { | export type AppState = { | ||||
navInfo: NavInfo, | navInfo: NavInfo, | ||||
deviceID: ?string, | deviceID: ?string, | ||||
currentUserInfo: ?CurrentUserInfo, | currentUserInfo: ?CurrentUserInfo, | ||||
draftStore: DraftStore, | draftStore: DraftStore, | ||||
sessionID: ?string, | sessionID: ?string, | ||||
entryStore: EntryStore, | entryStore: EntryStore, | ||||
threadStore: ThreadStore, | threadStore: ThreadStore, | ||||
userStore: UserStore, | userStore: UserStore, | ||||
messageStore: MessageStore, | messageStore: MessageStore, | ||||
updatesCurrentAsOf: number, | updatesCurrentAsOf: number, | ||||
loadingStatuses: { [key: string]: { [idx: number]: LoadingStatus } }, | loadingStatuses: { [key: string]: { [idx: number]: LoadingStatus } }, | ||||
calendarFilters: $ReadOnlyArray<CalendarFilter>, | calendarFilters: $ReadOnlyArray<CalendarFilter>, | ||||
calendarPickedCommunityID: ?string, | pickedCommunityIDs: PickedCommunities, | ||||
kamilUnsubmitted Not Done Inline Actionsfeeling confused about this naming, maybe simply pickedCommunities: PickedCommunities, will be better? But leaving this up to you kamil: feeling confused about this naming, maybe simply `pickedCommunities: PickedCommunities,` will… | |||||
tomekUnsubmitted Not Done Inline Actionshow about communityPickerStore? tomek: how about `communityPickerStore`? | |||||
urlPrefix: string, | urlPrefix: string, | ||||
windowDimensions: WindowDimensions, | windowDimensions: WindowDimensions, | ||||
cookie?: void, | cookie?: void, | ||||
deviceToken: ?string, | deviceToken: ?string, | ||||
baseHref: string, | baseHref: string, | ||||
connection: ConnectionInfo, | connection: ConnectionInfo, | ||||
watchedThreadIDs: $ReadOnlyArray<string>, | watchedThreadIDs: $ReadOnlyArray<string>, | ||||
lifecycleState: LifecycleState, | lifecycleState: LifecycleState, | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | return { | ||||
...state, | ...state, | ||||
calendarFilters: [ | calendarFilters: [ | ||||
...nonThreadFilters, | ...nonThreadFilters, | ||||
{ | { | ||||
type: calendarThreadFilterTypes.THREAD_LIST, | type: calendarThreadFilterTypes.THREAD_LIST, | ||||
threadIDs, | threadIDs, | ||||
}, | }, | ||||
], | ], | ||||
calendarPickedCommunityID: action.payload, | pickedCommunityIDs: { | ||||
...state.pickedCommunityIDs, | |||||
calendar: action.payload, | |||||
}, | |||||
}; | }; | ||||
} else if (action.type === clearCalendarCommunityFilter) { | } else if (action.type === clearCalendarCommunityFilter) { | ||||
const nonThreadFilters = nonThreadCalendarFilters(state.calendarFilters); | const nonThreadFilters = nonThreadCalendarFilters(state.calendarFilters); | ||||
return { | return { | ||||
...state, | ...state, | ||||
calendarFilters: nonThreadFilters, | calendarFilters: nonThreadFilters, | ||||
calendarPickedCommunityID: null, | pickedCommunityIDs: { | ||||
...state.pickedCommunityIDs, | |||||
calendar: null, | |||||
}, | |||||
}; | }; | ||||
} else if (action.type === setNewSessionActionType) { | } else if (action.type === setNewSessionActionType) { | ||||
if ( | if ( | ||||
invalidSessionDowngrade( | invalidSessionDowngrade( | ||||
oldState, | oldState, | ||||
action.payload.sessionChange.currentUserInfo, | action.payload.sessionChange.currentUserInfo, | ||||
action.payload.preRequestUserState, | action.payload.preRequestUserState, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines |
can you make those read-only?