just-paja/radio-drama-queen

View on GitHub
src/sounds/selectors/index.js

Summary

Maintainability
A
0 mins
Test Coverage
import { createSelector } from 'reselect'
import { getFlag } from 'react-saga-rest'
import { soundStore } from '../store'

export const getSoundPlayingStatus = getFlag(soundStore.getObject, 'playing')
export const getSoundLoopStatus = getFlag(soundStore.getObject, 'loop')

export const getPlayingSounds = createSelector(
  soundStore.getAll,
  sounds => sounds.filter(sound => sound.playing)
)

export const getPlayingSoundsUuids = createSelector(
  getPlayingSounds,
  sounds => sounds.map(sound => sound.uuid)
)

export const isAnySoundPlaying = createSelector(
  getPlayingSounds,
  sounds => sounds.length > 0
)