Esempio n. 1
0
const previousChapter = chapters => {
  let previous = currentChapterIndex(chapters) - 1

  if (previous <= 0) {
    previous = 0
  }

  return chapters.map(setActiveByIndex(previous))
}
Esempio n. 2
0
    [UPDATE_CHAPTER]: (state, { payload }) => {
      const chapters = state.list.map(setActiveByPlaytime(payload))

      if (currentChapterIndex(chapters) === -1) {
        return state
      }

      return generateState(chapters)
    },
Esempio n. 3
0
const nextChapter = chapters => {
  let next = currentChapterIndex(chapters) + 1

  if (next >= chapters.length - 1) {
    next = chapters.length - 1
  }

  return chapters.map(setActiveByIndex(next))
}