diff --git a/src/components/CallLog.js b/src/components/CallLog.js index 1aaa76d..ce08559 100644 --- a/src/components/CallLog.js +++ b/src/components/CallLog.js @@ -6,7 +6,15 @@ import Paper from 'material-ui/Paper'; import { compose, getContext, withHandlers, withPropsOnChange, lifecycle } from 'recompose'; import { CALL_STATUS_IDLE } from 'react-sip'; import { connect } from 'react-redux'; -import List, { ListItem, ListItemText, ListSubheader } from 'material-ui/List'; +import List, { + ListItem, + ListItemText, + ListSubheader, + ListItemSecondaryAction, +} from 'material-ui/List'; +import ThumbUpIcon from 'material-ui-icons/ThumbUp'; +import ThumbDownIcon from 'material-ui-icons/ThumbDown'; +import IconButton from 'material-ui/IconButton'; const timeago = require('timeago.js'); @@ -39,7 +47,7 @@ const Wrapper = styled(Paper).attrs({ display: flex; `; -const DialLog = ({ entries, onListItemClick, allowListItemClicks }) => ( +const DialLog = ({ entries, onListItemClick, allowListItemClicks, onFeedbackButtonClick }) => ( Your Call Log}> {_.map(entries, (entry, i) => ( @@ -53,6 +61,24 @@ const DialLog = ({ entries, onListItemClick, allowListItemClicks }) => ( primary={entry.phoneNumber} secondary={timeagoInstance.format(entry.startTimestamp, 'custom')} /> + + + + + + + + ))} @@ -91,5 +117,12 @@ export default compose( value: e.currentTarget.dataset['phonenumber'], }); }, + onFeedbackButtonClick: ({ dispatch }) => (e) => { + dispatch({ + type: 'callLog/SET_FEEDBACK', + itemIndex: e.currentTarget.dataset['itemindex'] * 1, + value: e.currentTarget.dataset['value'], + }); + }, }), )(DialLog); diff --git a/src/redux/callLog/reducer.js b/src/redux/callLog/reducer.js index 861dd80..0b06090 100644 --- a/src/redux/callLog/reducer.js +++ b/src/redux/callLog/reducer.js @@ -19,6 +19,21 @@ export default (state = initialState, action) => { }); } + case 'callLog/SET_FEEDBACK': { + if (!action.value) { + return update(state, { + entries: { + [action.itemIndex]: { $unset: ['feedback'] }, + }, + }); + } + return update(state, { + entries: { + [action.itemIndex]: { feedback: { $set: action.value } }, + }, + }); + } + default: return state; }