Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 14x 11x 2x 1x | /*
* Copyright 2021 Harness Inc. All rights reserved.
* Use of this source code is governed by the PolyForm Shield 1.0.0 license
* that can be found in the licenses directory at the root of this repository, also available at
* https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
*/
import { toggleSection } from './toggleSection'
import { updateSectionData } from './updateSectionData'
import { createSections } from './createSections'
import { fetchSectionData } from './fetchSectionData'
import { fetchingSectionData } from './fetchingSectionData'
import { resetSectionData } from './resetSectionData'
import { search } from './search'
import { resetSearch } from './resetSearch'
import { goToNextSearchResult } from './goToNextSearchResult'
import { goToPrevSearchResult } from './goToPrevSearchResult'
import { ActionType, Action, State } from './types'
export function reducer<T extends ActionType>(state: State, action: Action<T>): State {
switch (action.type) {
// Action for creating the sections
case ActionType.CreateSections:
return createSections(state, action as Action<ActionType.CreateSections>)
// Action to fetch the section data
case ActionType.FetchSectionData:
return fetchSectionData(state, action as Action<ActionType.FetchSectionData>)
// Action for fetching the section data
case ActionType.FetchingSectionData:
return fetchingSectionData(state, action as Action<ActionType.FetchingSectionData>)
// Action for updating the section data
case ActionType.UpdateSectionData:
return updateSectionData(state, action as Action<ActionType.UpdateSectionData>)
// Action for toggling a section
case ActionType.ResetSection:
return resetSectionData(state, action as Action<ActionType.ResetSection>)
// Action for toggling a section
case ActionType.ToggleSection:
return toggleSection(state, action as Action<ActionType.ToggleSection>)
case ActionType.Search:
return search(state, action as Action<ActionType.Search>)
case ActionType.ResetSearch:
return resetSearch(state, action as Action<ActionType.ResetSearch>)
case ActionType.GoToNextSearchResult:
return goToNextSearchResult(state, action as Action<ActionType.GoToNextSearchResult>)
case ActionType.GoToPrevSearchResult:
return goToPrevSearchResult(state, action as Action<ActionType.GoToPrevSearchResult>)
default:
return state
}
}
|