Features/bottombar redux #97

Merged
A-Nilfgaardian merged 7 commits from features/bottombar-redux into master 2021-01-20 14:34:28 +00:00
4 changed files with 41 additions and 8 deletions
Showing only changes of commit 4a4754618c - Show all commits

View File

@ -1,12 +1,21 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux';
import './../../../css/bottombar/subscomponents/trigger.css'; import './../../../css/bottombar/subscomponents/trigger.css';
function Trigger() { class Trigger extends React.Component<any, any> {
render() {
return ( return (
<div className="TriggerStatus"> <div className="TriggerStatus">
Trig:CH1, Mode:RisingEdge Trig:CH{this.props.triggerWidget.triggerChannel}, Mode:{this.props.triggerWidget.triggerType}
</div> </div>
) )
}
} }
export default Trigger; function mapStateToProps(state: { triggerWidget: any; }) {
return {
triggerWidget: state.triggerWidget
};
}
export default connect(mapStateToProps)(Trigger);

View File

@ -0,0 +1,6 @@
enum TriggerType {
RisingEdge = "RisingEdge",
FallingEdge = "FallingEdge"
}
export default TriggerType;

View File

@ -2,11 +2,13 @@ import { combineReducers } from 'redux';
import horizontalWidgetReducer from './horizontalWidgetReducer'; import horizontalWidgetReducer from './horizontalWidgetReducer';
import verticalWidgetReducer from './verticalWidgetReducer'; import verticalWidgetReducer from './verticalWidgetReducer';
import measurementsWidgetReducer from './measurementsWidgetReducer'; import measurementsWidgetReducer from './measurementsWidgetReducer';
import triggerWidgetReducer from './triggerWidgetReducer';
export default combineReducers( export default combineReducers(
{ {
horizontalWidget: horizontalWidgetReducer, horizontalWidget: horizontalWidgetReducer,
verticalWidget: verticalWidgetReducer, verticalWidget: verticalWidgetReducer,
measurementsWidget: measurementsWidgetReducer measurementsWidget: measurementsWidgetReducer,
triggerWidget: triggerWidgetReducer
} }
); );

View File

@ -0,0 +1,16 @@
import TriggerType from '../../configuration/enums/triggerType';
const initialState = {
triggerChannel: 1,
triggerType: TriggerType.RisingEdge,
triggerLevel: 0
};
export default function(state = initialState, action: {type: any, payload: any}) {
switch(action.type) {
case "trigger/test":
return { ...state };
default:
return state;
}
}