Skip to content

Commit

Permalink
Remove console logs #217
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Jul 16, 2015
1 parent 1eef3b5 commit d68a86c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
35 changes: 23 additions & 12 deletions build/main.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,16 +461,15 @@ var Conversation = React.createClass({
submitted: false,
text: null, // this.props.conversation && this.props.conversation.text || 'Error: Text not found',
title: null, // this.props.conversation && this.props.conversation.title || 'No Title',
hideButton: false,
author: this.props.account
hideButton: false
};
},
onClick: function onClick() {
// TODO Make sure that userId and id should be the same
// Shim the author ID.
var author = {};
if (this.state.author) {
author.id = this.state.author.userId;
if (this.props.account) {
author.id = this.props.account.userId;
} else {
// TODO Log in the user programmatically automatically
throw new Error('You must log in before saving a conversation');
Expand Down Expand Up @@ -569,16 +568,19 @@ module.exports = exports = React.createClass({
},
getInitialState: function getInitialState() {
return {
conversations: this.props.conversations
conversations: []
};
},
componentWillMount: function componentWillMount() {
this.getAvatars(this.props.conversations);
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
console.log('next', nextProps.conversations);
// console.log('next', nextProps.conversations)
this.getAvatars(nextProps.conversations);
},
componentDidUpdate: function componentDidUpdate() {
console.log('State updated', this.state.conversations);
},
getAvatars: function getAvatars(props) {
var dummyImage = 'http://upload.wikimedia.org/wikipedia/en/4/42/Richard_Feynman_Nobel.jpg';
var userPromises = [];
Expand All @@ -599,7 +601,7 @@ module.exports = exports = React.createClass({
return _.each(keys, function (key) {
db.getUser(key).then(function (res) {
// TODO Add in popovers with the user name if they have one, and link to a profile section
console.log('key', res);
// console.log('key', res)
if (res.avatar) {
conversation.avatars.push(res.avatar);
return;
Expand All @@ -622,7 +624,6 @@ module.exports = exports = React.createClass({
}

Promise.all(userPromises).then((function () {
console.log('clone', clone);
this.setState({ conversations: clone });
}).bind(this))['catch'](function (err) {
console.log('Catch promise err', err);
Expand Down Expand Up @@ -652,7 +653,7 @@ module.exports = exports = React.createClass({
margin: '7px 0px'
};

console.log('conversations', this.state.conversations);
// console.log('conversations', this.state.conversations)

return React.createElement('div', null, this.state.conversations.map(function (conversation) {
return React.createElement('div', { style: listingStyle }, React.createElement('p', { style: titleStyle }, conversation.title), React.createElement('div', { style: imageWrapperStyle },
Expand Down Expand Up @@ -1193,12 +1194,23 @@ var React = require('react');
var DropdownButton = require('react-bootstrap').DropdownButton;
var MenuItem = require('react-bootstrap').MenuItem;

function preventDefault() {}

var PermissionsDropdown = React.createClass({
displayName: 'PermissionsDropdown',
getInitialState: function getInitialState() {
return {};
},
onClick: function onClick() {},
handleRead: function handleRead() {
console.log('read');
},
handleWrite: function handleWrite() {
console.log('write');
},

handleShare: function handleShare() {
console.log('share');
},

render: function render() {

Expand All @@ -1212,12 +1224,11 @@ var PermissionsDropdown = React.createClass({

// TODO Change the z-index so it doesn't get snipped

return React.createElement(DropdownButton, { title: title, style: style }, React.createElement(MenuItem, { eventKey: 1 }, React.createElement('i', { className: 'fa fa-eye' }), ' Readers can view'), React.createElement(MenuItem, { eventKey: 2 }, React.createElement('i', { className: 'fa fa-pencil' }), ' Writers can add content'), React.createElement(MenuItem, { eventKey: 3 }, React.createElement('i', { className: 'fa fa-user' }), ' Sharers can invite others'));
return React.createElement(DropdownButton, { title: title, style: style }, React.createElement(MenuItem, { eventKey: 1, onSelect: this.handleRead }, React.createElement('i', { className: 'fa fa-eye' }), ' Readers can view'), React.createElement(MenuItem, { eventKey: 2, onSelect: this.handleWrite }, React.createElement('i', { className: 'fa fa-pencil' }), ' Writers can add content'), React.createElement(MenuItem, { eventKey: 3, onSelect: this.handleShare }, React.createElement('i', { className: 'fa fa-user' }), ' Sharers can invite others'));
}
});

module.exports = exports = PermissionsDropdown;

// TODO Change the permissions of the user being selected

},{"react":"/Users/richard/src/beagle/node_modules/react/react.js","react-bootstrap":"/Users/richard/src/beagle/node_modules/react-bootstrap/lib/index.js"}],"/Users/richard/src/beagle/js/components/publication.jsx":[function(require,module,exports){
Expand Down
12 changes: 7 additions & 5 deletions js/components/conversations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ module.exports = exports = React.createClass({
},
getInitialState: function () {
return {
conversations: this.props.conversations
conversations: []
}
},
componentWillMount: function () {
this.getAvatars(this.props.conversations)
},
componentWillReceiveProps: function (nextProps) {
console.log('next', nextProps.conversations)
// console.log('next', nextProps.conversations)
this.getAvatars(nextProps.conversations)
},
componentDidUpdate: function () {
console.log('State updated', this.state.conversations)
},
getAvatars: function (props) {
let dummyImage = 'http://upload.wikimedia.org/wikipedia/en/4/42/Richard_Feynman_Nobel.jpg'
let userPromises = []
Expand All @@ -47,7 +50,7 @@ module.exports = exports = React.createClass({
return _.each(keys, function (key) {
db.getUser(key).then(function (res) {
// TODO Add in popovers with the user name if they have one, and link to a profile section
console.log('key', res)
// console.log('key', res)
if (res.avatar) {
conversation.avatars.push(res.avatar)
return
Expand All @@ -71,7 +74,6 @@ module.exports = exports = React.createClass({
}

Promise.all(userPromises).then(function () {
console.log('clone', clone)
this.setState({conversations: clone})
}.bind(this)).catch(function (err) {
console.log('Catch promise err', err)
Expand Down Expand Up @@ -101,7 +103,7 @@ module.exports = exports = React.createClass({
margin: '7px 0px'
}

console.log('conversations', this.state.conversations)
// console.log('conversations', this.state.conversations)

return (
<div>
Expand Down

0 comments on commit d68a86c

Please sign in to comment.