feat: one hour of progress

This commit is contained in:
Joshua Seigler 2020-02-18 16:05:59 -05:00
parent 5684ef36ec
commit 9242ce66ec
6 changed files with 88 additions and 47 deletions

View file

@ -2,34 +2,21 @@ import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
const initialState = {
lastUpdate: 0,
light: false,
count: 0,
columns: [
{ name: 'Backlog', headerColor: '#8E6E95', cards: [{}, {}] },
{ name: 'In Progress', headerColor: '#8E6E95', headerColor: '#39A59C', cards: [{}, {}] },
{ name: 'Ready for Review', headerColor: '#344759', cards: [{}, {}] },
{ name: 'Completed', headerColor: '#E8741E', cards: [{}, {}] },
]
}
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'TICK':
const reducer = (state = initialState, {type, payload}) => {
switch (type) {
case 'ADD_CARD':
newCards = [...state.columns[action.payload.column].cards, { text: payload.text }];
return {
...state,
lastUpdate: action.lastUpdate,
light: !!action.light,
}
case 'INCREMENT':
return {
...state,
count: state.count + 1,
}
case 'DECREMENT':
return {
...state,
count: state.count - 1,
}
case 'RESET':
return {
...state,
count: initialState.count,
}
};
default:
return state
}