App does something :)

This commit is contained in:
Martin Bauer
2020-06-02 22:43:48 +02:00
parent 2584d2249f
commit 3cefa3fdbf
8 changed files with 89 additions and 106 deletions

View File

@@ -3,6 +3,7 @@ export const NEW_DEVICE_DATA = "NEW_DEVICE_DATA";
export const CHANGE_USER_NAME = "SET_USERNAME";
export const CHANGE_THEME = "CHANGE_THEME";
export const START_SESSION = "START_SESSION";
export const STOP_SESSION = "STOP_SESSION";
export const reportDeviceData = (sessionId, newDataStart, data, analysis) => ({
type: NEW_DEVICE_DATA,
@@ -24,4 +25,8 @@ export const changeTheme = newThemeName => ({
export const startSession = () => ({
type: START_SESSION
})
export const stopSession = () => ({
type: STOP_SESSION
})

View File

@@ -1,16 +1,16 @@
import { combineReducers } from 'redux';
import { List } from 'immutable';
import { CHANGE_THEME, CHANGE_USER_NAME, NEW_DEVICE_DATA, START_SESSION } from './ActionCreators';
import { CHANGE_THEME, CHANGE_USER_NAME, NEW_DEVICE_DATA, START_SESSION, STOP_SESSION } from './ActionCreators';
const INITIAL_SETTINGS = {
theme: "hot",
username: "",
deviceURL: "192.168.178.105",
deviceURL: "http://192.168.178.105",
peaksPerLap: 30,
// advanced
peakDetector: 'SIMPLE', // either 'SIMPLE' or 'ZSCORE'
peakDetectorSimpleThreshold: 500,
peakDetectorSimpleThreshold: 2000,
peakDetectorZScoreLag: 8, // peak detector z-score values
peakDetectorZScoreThreshold: 2,
@@ -53,18 +53,23 @@ const currentSessionReducer = (state = INITIAL_CURRENT_SESSION, action) => {
rawData: List(),
analysis: INITIAL_CURRENT_SESSION.analysis
};
case STOP_SESSION:
return {
running: false,
rawData: List(),
analysis: INITIAL_CURRENT_SESSION.analysis
};
case NEW_DEVICE_DATA:
return {
running: action.data.length > 0,
running: action.data.size > 0,
rawData: action.data,
analysis: { ...state.analysis, ...analysis },
analysis: { ...state.analysis, ...action.analysis },
}
default:
return state
}
};
export default combineReducers({
settings: settingsReducer,
session: currentSessionReducer,