gab-social/app/javascript/gabsocial/reducers/timeline_injections.js
mgabdev d198695bdb Added Timeline Injections
• Added:
- Timeline Injections
- FeaturedGroupsInjection, GroupCategoriesInjection, ProUpgradeInjection, PWAInjection, ShopInjection, TimelineInjectionBase, TimelineInjectionLayout, TimelineInjectionRoot, UserSuggestionsInjection
- Constants
- Redux for timeline_injections
- settings for setting
- popover for dismissing and saving weight
2020-09-14 11:40:42 -05:00

28 lines
863 B
JavaScript

import Immutable from 'immutable'
import {
TIMELINE_INJECTION_SHOW,
TIMELINE_INJECTION_HIDE,
} from '../actions/timeline_injections'
const initialState = Immutable.Map({
visibleIds: Immutable.List(),
hiddenIds: Immutable.List(),
})
export default function timeline_injection(state = initialState, action) {
switch(action.type) {
case TIMELINE_INJECTION_SHOW:
return state.withMutations((map) => {
map.update('hiddenIds', (list) => list.filterNot((id) => id === action.injectionId))
map.update('visibleIds', (list) => list.push(action.injectionId))
})
case TIMELINE_INJECTION_HIDE:
return state.withMutations((map) => {
map.update('visibleIds', (list) => list.filterNot((id) => id === action.injectionId))
map.update('hiddenIds', (list) => list.push(action.injectionId))
})
default:
return state
}
}