mirror of
https://github.com/seigler/triplebyte-react-spa
synced 2025-07-26 15:26:08 +00:00
feat: one hour of progress
This commit is contained in:
parent
5684ef36ec
commit
9242ce66ec
6 changed files with 88 additions and 47 deletions
35
store.js
35
store.js
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue