#8: Add tooltips to settings [partial]

This commit is contained in:
2019-08-30 16:51:49 -05:00
parent 42515a08c3
commit 7e6e3cbc49
6 changed files with 116 additions and 6 deletions

View File

@@ -1,13 +1,17 @@
import {createReducer} from 'redux-starter-kit';
import {
CLEAR_ERROR,
SET_ERROR_INFO
CLEAR_INFO,
SET_ERROR_INFO,
SET_INFO
} from '../actions/error_actions';
export const errorReducer = createReducer({
DisplayError: false,
DisplayInfo: false,
ErrorCritical: false,
ErrorStack: [],
InfoStack: [],
}, {
[CLEAR_ERROR]: state => {
const errorStack = (state.ErrorStack.length > 0) ? state.ErrorStack.slice(1) : [];
@@ -17,6 +21,14 @@ export const errorReducer = createReducer({
ErrorStack: errorStack,
}
},
[CLEAR_INFO]: state => {
const infoStack = (state.InfoStack.length > 0) ? state.InfoStack.slice(1) : [];
return {
...state,
DisplayInfo: (infoStack.length > 0),
InfoStack: infoStack,
}
},
[SET_ERROR_INFO]: (state, action) => {
const errorStack = [action.payload.msg, ...state.ErrorStack];
return {
@@ -25,5 +37,16 @@ export const errorReducer = createReducer({
ErrorCritical: state.ErrorCritical || action.payload.critical,
ErrorStack: errorStack,
}
},
[SET_INFO]: (state, action) => {
const infoStack = [{
title: action.payload.title,
message: action.payload.msg
}, ...state.InfoStack];
return {
...state,
DisplayInfo: true,
InfoStack: infoStack,
}
}
});