|
|
@ -3,6 +3,7 @@ import { parseText } from '../lib/parseText'
|
|
|
|
|
|
|
|
|
|
|
|
import { getNextBiggerNumber, getNextSmallerNumber } from '../lib/array-util.js'
|
|
|
|
import { getNextBiggerNumber, getNextSmallerNumber } from '../lib/array-util.js'
|
|
|
|
import { pivotize } from '../lib/pivotize'
|
|
|
|
import { pivotize } from '../lib/pivotize'
|
|
|
|
|
|
|
|
import { intervalModifier } from '../lib/intervalModifier'
|
|
|
|
|
|
|
|
|
|
|
|
// util
|
|
|
|
// util
|
|
|
|
const notNull = val => val != null
|
|
|
|
const notNull = val => val != null
|
|
|
@ -137,11 +138,27 @@ export const safeSelectPrevSentence = createSelector(
|
|
|
|
(has, sentence, idx) => (has ? sentence : idx)
|
|
|
|
(has, sentence, idx) => (has ? sentence : idx)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// options
|
|
|
|
// options2
|
|
|
|
|
|
|
|
|
|
|
|
export const selectWpm = state => state.wpm
|
|
|
|
export const selectWpm = state => state.wpm
|
|
|
|
export const selectInterval = createSelector(selectWpm, wpm => 60000 / wpm)
|
|
|
|
|
|
|
|
export const selectOffset = state => state.offset
|
|
|
|
export const selectOffset = state => state.offset
|
|
|
|
|
|
|
|
export const selectBaseInterval = createSelector(selectWpm, wpm => 60000 / wpm)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const selectIntervals = createSelector(
|
|
|
|
|
|
|
|
selectSegments,
|
|
|
|
|
|
|
|
selectBaseInterval,
|
|
|
|
|
|
|
|
(segments, interval) => segments.map(seg => interval * intervalModifier(seg))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const selectInterval = createSelector(
|
|
|
|
|
|
|
|
selectIntervals,
|
|
|
|
|
|
|
|
selectCurrentSegmentIndex,
|
|
|
|
|
|
|
|
(intervals, idx) => intervals[idx]
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const selectTotalTime = createSelector(selectIntervals, intervals =>
|
|
|
|
|
|
|
|
intervals.reduce((a, b) => a + b, 0)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// player
|
|
|
|
// player
|
|
|
|
|
|
|
|
|
|
|
|