Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default orbs;
// SELECTORS
export const getOrbs = createSelector(
["orbs.orbs"],
orbModels => orbModels
);
export const getOrbById = createSelector(
["orbs.orbs", "id"],
(orbModels, id) => {
return orbModels[id];
}
);
export const getOrbsTouched = createSelector([
"orbs.touchedOrbs",
touchedOrbs => touchedOrbs
]);
export const getOrbTouched = createSelector(
["orbs.touchedOrbs", "id"],
(touchedOrbs, id) => touchedOrbs.indexOf(id) > -1
);
export const getOrbsComplete = createSelector([
"orbs.completedOrbs",
completedOrbs => completedOrbs
]);
export const getOrbComplete = createSelector(
["orbs.completedOrbs", "id"],
export default chapters;
// SELECTORS
export const getActiveChapterIndex = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => activeChapterIndex
);
export const getActiveChapterData = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex]
);
export const getActiveChapterId = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex].id
);
export const getActiveChapterDuration = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex].duration
);
export const getChapterById = createSelector(
["id"],
id => CHAPTERS.find(chapter => chapter.id === id)
);
chapterTimer.reset();
return initialState;
}
});
/* eslint-enable no-param-reassign */
export default tasksReducer;
// SELECTORS
export const getEndingChapter = createSelector(
["tasks.endingChapter"],
endingChapter => endingChapter
);
export const getAllTasks = createSelector(
["tasks.tasks"],
_tasks => _tasks
);
export const getActiveTask = createSelector(
["tasks.taskOrder", "tasks.activeTaskIndex"],
(taskOrder, activeTaskIndex) => {
return taskOrder[activeTaskIndex];
}
);
export const getActiveTaskIndex = createSelector(
["tasks.activeTaskIndex"],
activeTaskIndex => activeTaskIndex
);
// INITIAL STATE
const initialState = SettingsFactory.getInitialSettings();
// CONSTANTS
export const actionTypes = {};
// ACTIONS
// REDUCERS
export const settings = createReducer(initialState, {});
export default settings;
// SELECTORS
export const getOrbCount = createSelector(
["settings.orbCount"],
orbCount => orbCount
);
export const getOrbSize = createSelector(
["settings.orbSize"],
orbSize => orbSize
);
export const getPeriod = createSelector(
["settings.period"],
period => period
);
export const getVelocityRange = createSelector(
[
imageAlt: taskData.imageAlt,
locations: taskData.locations,
weighting: modifiedTaskWeight,
points: taskData.points
};
result.push(genericItem);
return result;
}, []);
return possibleTasks;
}
);
// Returns pets / people save obj. Doesn't include first 2 "Save Yourself" tasks
export const getSavedMetrics = createSelector(
["tasks.taskOrder"],
taskOrder => {
return taskOrder.reduce(
(accumulator, task, index) => {
if (index > 1) {
accumulator.people += task.completedResults.people;
accumulator.pets += task.completedResults.pets;
}
return accumulator;
},
{
people: 0,
pets: 0
}
);
}
chapterTimer.reset();
return initialState;
}
});
/* eslint-enable no-param-reassign */
export default tasksReducer;
// SELECTORS
export const getEndingChapter = createSelector(
["tasks.endingChapter"],
endingChapter => endingChapter
);
export const getAllTasks = createSelector(
["tasks.tasks"],
_tasks => _tasks
);
export const getActiveTask = createSelector(
["tasks.taskOrder", "tasks.activeTaskIndex"],
(taskOrder, activeTaskIndex) => {
return taskOrder[activeTaskIndex];
}
);
export const getActiveTaskIndex = createSelector(
["tasks.activeTaskIndex"],
activeTaskIndex => activeTaskIndex
);
export const getActiveTaskIndex = createSelector(
["tasks.activeTaskIndex"],
activeTaskIndex => activeTaskIndex
);
export const getTaskPhase = createSelector(
["tasks.activeTaskPhase"],
activeTaskPhase => activeTaskPhase
);
export const getAllTaskPhaseData = createSelector(
["tasks.taskPhases"],
allTaskPhaseData => allTaskPhaseData
);
export const getWeightedTasks = createSelector(
["tasks.tasks", "tasks.tasksForEnvironment", "tasks.activeEnvironment"],
(allTasks, tasksForEnv, activeEnvironment) => {
const environmentTasks = tasksForEnv[activeEnvironment];
const environmentTasksArray = [].concat(
environmentTasks.saveYourself,
environmentTasks.saveOthers
);
const genericWeighting = 1 / size(allTasks);
const possibleTasks = Object.keys(allTasks).reduce((result, taskKey) => {
const taskData = allTasks[taskKey];
const modifiedTaskWeight = environmentTasksArray.includes(taskData.id)
? genericWeighting * 2
: genericWeighting;
const genericItem = {
export const getActiveChapterIndex = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => activeChapterIndex
);
export const getActiveChapterData = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex]
);
export const getActiveChapterId = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex].id
);
export const getActiveChapterDuration = createSelector(
["chapters.activeChapterIndex"],
activeChapterIndex => CHAPTERS[activeChapterIndex].duration
);
export const getChapterById = createSelector(
["id"],
id => CHAPTERS.find(chapter => chapter.id === id)
);
(accumulator, task, index) => {
if (index > 1) {
accumulator.people += task.completedResults.people;
accumulator.pets += task.completedResults.pets;
}
return accumulator;
},
{
people: 0,
pets: 0
}
);
}
);
export const getBadges = createSelector(
["tasks.badges"],
_badges => _badges
);
export const getNextBadgeToShow = createSelector(
["tasks"],
_tasks => getNewBadgeEarned(_tasks)
);
export const getFinalBadgeShown = createSelector(
["tasks.finalBadgeShown"],
finalBadgeShown => finalBadgeShown
);
export const getOrbsTouched = createSelector([
"orbs.touchedOrbs",
touchedOrbs => touchedOrbs
]);
export const getOrbTouched = createSelector(
["orbs.touchedOrbs", "id"],
(touchedOrbs, id) => touchedOrbs.indexOf(id) > -1
);
export const getOrbsComplete = createSelector([
"orbs.completedOrbs",
completedOrbs => completedOrbs
]);
export const getOrbComplete = createSelector(
["orbs.completedOrbs", "id"],
(completedOrbs, id) => completedOrbs.indexOf(id) > -1
);