Skip to content

Commit f2f8eeb

Browse files
committed
Fix activity bug
1 parent b5c9095 commit f2f8eeb

File tree

11 files changed

+59
-50
lines changed

11 files changed

+59
-50
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
client/logs
2424
client/*.log
2525
client/npm-debug.log*
26+
client/.git
27+
client/.gitignore
2628

2729
# Dependency directories
2830
client/node_modules/

client/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ☑︎ Djello
2+
![](https://user-images.githubusercontent.com/22121223/33110355-3769d06c-cf82-11e7-827f-249ee6fb7258.png)
3+
4+
## Live Demo of Djello
5+
Live demo of Djello, a simple, clean, [Trello](http://trello.com) clone.
6+
7+
Give Djello a whirl at [http://yxlau.github.io/project_djello_react](http://yxlau.github.io/project_djello_react).
8+
9+
### Logging In
10+
Sign in with any of the following email addresses: `[email protected]`, `[email protected]`, `[email protected]`
11+
12+
Password: `password!`
13+
14+
### Signing Up
15+
Alternatively, you can create your own account at the site.
16+
17+
## About
18+
Visit the main repo at [https://github.com/yxlau/project_djello](https://github.com/yxlau/project_djello) to find out more.
19+
20+
## Authors
21+
- yxlau ([https://github.com/yxlau](https://github.com/yxlau))

client/dist/bundle.js

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/actions/cardActions.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ export function removeCardMember(card_id, user_id) {
8585
if (!response.ok) {
8686
throw setError(response)
8787
}
88+
return response.json()
8889
})
89-
.then(() => {
90+
.then((json) => {
9091
dispatch(deleteCardMemberSuccess({
9192
card_id: card_id,
92-
member_id: user_id
93+
member_id: user_id,
94+
activities: json.activities
9395
}))
9496
})
9597
.catch(error => {
@@ -130,8 +132,7 @@ export function updateCard(data, card_id) {
130132
}
131133
return response.json()
132134
}).then(json => {
133-
const massaged = arrayToObjectByID([json])
134-
dispatch(updateCardSuccess(massaged))
135+
dispatch(updateCardSuccess(json))
135136
}).catch(error => {
136137
dispatch(updateCardFailure(error))
137138
})

client/src/components/ListCard.js

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ListCard extends Component {
4747
const { title, member_ids, description, activities, id } = card
4848
let memberList = ''
4949

50+
console.log('activities', activities)
5051

5152
if (member_ids) {
5253
memberList = member_ids.map(member_id => {

client/src/helpers/actionHelpers.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export const baseURL = 'https://nameless-beyond-77500.herokuapp.com'
1+
// export const baseURL = 'https://nameless-beyond-77500.herokuapp.com'
2+
export const baseURL = 'http://localhost:3000'
23

34
export function arrayToObjectByID(data) {
45
let massaged = {}

client/src/helpers/activityHelpers.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// updated card
2-
// object: list, title, description, card, membership
3-
// verb: update, create, destroy
4-
// value: ...
5-
// user: name
6-
71
export function activitySentence(name, verb, object, value) {
82

93

@@ -13,8 +7,8 @@ export function activitySentence(name, verb, object, value) {
137
card: `${name} created this card`
148
},
159
update: {
16-
title: `${name} changed the title to ${value}`,
17-
description: `${name} changed the description to ${value}`,
10+
title: `${name} changed the title to '${value}'`,
11+
description: `${name} changed the description to '${value}'`,
1812
list: `${name} moved the card to ${value}`
1913
},
2014
destroy: {

client/src/reducers/authReducer.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function authentication(state = initialState, action) {
3737
return {
3838
...state,
3939
token: null,
40+
isLoggedIn: false,
4041
}
4142
case Actions.CREATE_USER_SUCCESS:
4243
return {

client/src/reducers/boardReducer.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@ export default function board(state = initialState, action) {
2020
}
2121
case Actions.GET_BOARD_SUCCESS:
2222
case Actions.CREATE_BOARD_SUCCESS:
23-
return {
24-
...state,
25-
...data.board,
26-
isFetching: false
27-
}
2823
case Actions.UPDATE_BOARD_SUCCESS:
2924
return {
3025
...state,
31-
isFetching: false,
3226
...data.board,
27+
isFetching: false
3328
}
3429
case Actions.GET_BOARD_FAILURE:
3530
case Actions.UPDATE_BOARD_FAILURE:

client/src/reducers/cardReducer.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function cards(state = initialState, action) {
3636
case Actions.UPDATE_CARD_SUCCESS:
3737
return {
3838
...state,
39-
error: null,
39+
error: {},
4040
isFetching: false,
4141
cards: {
4242
...state.cards,
@@ -53,27 +53,30 @@ export default function cards(state = initialState, action) {
5353
case Actions.DELETE_CARD_MEMBER_SUCCESS:
5454
return {
5555
...state,
56-
error: null,
56+
error: {},
5757
isFetching: false,
5858
cards: {
5959
...state.cards,
6060
[data.card_id]: {
6161
...state.cards[data.card_id],
6262
member_ids: state.cards[data.card_id]['member_ids'].filter(member =>
63-
member !== data.member_id)
63+
member !== data.member_id),
64+
activities: data.activities
65+
6466
}
6567
},
6668
}
6769
case Actions.ADD_CARD_MEMBER_SUCCESS:
6870
return {
6971
...state,
70-
error: null,
72+
error: {},
7173
isFetching: false,
7274
cards: {
7375
...state.cards,
7476
[data.card_id]: {
7577
...state.cards[data.card_id],
76-
member_ids: [...state.cards[data.card_id]['member_ids'], data.member_id]
78+
member_ids: [...state.cards[data.card_id]['member_ids'], data.member_id],
79+
activities: data.activities
7780
}
7881
},
7982
}

client/src/reducers/userReducer.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ function user(state = initialState, action) {
1313
const data = action.data
1414
switch (action.type) {
1515
case Actions.GET_USER_REQUEST:
16+
case Actions.CREATE_USER_REQUEST:
1617
return {
1718
...state,
1819
isFetching: true,
19-
error: null,
20-
...action.data
20+
error: {},
2121
}
2222
case Actions.GET_USER_FAILURE:
23+
case Actions.CREATE_USER_FAILURE:
24+
2325
return {
2426
...state,
2527
isFetching: false,
@@ -37,25 +39,13 @@ function user(state = initialState, action) {
3739
...state,
3840
users: data.users
3941
}
40-
case Actions.CREATE_USER_REQUEST:
41-
return {
42-
...state,
43-
isFetching: true,
44-
error: {}
45-
}
4642
case Actions.CREATE_USER_SUCCESS:
4743
return {
4844
...state,
4945
isFetching: false,
5046
name: action.data.name,
5147
id: action.data.id
5248
}
53-
case Actions.CREATE_USER_FAILURE:
54-
return {
55-
...state,
56-
isFetching: false,
57-
error: action.data
58-
}
5949
default:
6050
return state
6151
}

0 commit comments

Comments
 (0)