Skip to content

Commit

Permalink
Show list on exit. needs double click, not finished #223
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Jul 16, 2015
1 parent 5de55aa commit 3e301b2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
21 changes: 8 additions & 13 deletions build/main.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,15 @@ module.exports = React.createClass({

showConversation: function showConversation() {
this.setState({
'conversation': null
});
this.setState({
'showConversation': !this.state.showConversation
'conversation': null,
'showConversation': this.state.showConversation ? null : true
});
},

setConversation: function setConversation(conversation) {
this.setState({
'conversation': conversation,
'showConversation': !this.state.showConversation
'showConversation': this.state.showConversation ? null : true
});
},

Expand Down Expand Up @@ -622,9 +620,7 @@ module.exports = exports = React.createClass({
if (nextProps.conversations) {
this.getAvatars(nextProps.conversations);
}
if (nextProps.showConversation) {
this.setState({ showConversation: nextProps.showConversation });
}
this.setState({ showConversation: nextProps.showConversation });
},
// componentDidUpdate: function () {
// console.log('State updated', this.state.conversations)
Expand Down Expand Up @@ -708,7 +704,7 @@ module.exports = exports = React.createClass({

var ConversationList;

if (!this.state.showConversation && this.state.conversations) {
if (this.state.showConversation === null && this.state.conversations) {
var _this = this;
ConversationList = React.createElement('div', null, this.state.conversations.map(function (conversation) {
return React.createElement('div', { style: listingStyle, onClick: _this.handleClick.bind(this, conversation) }, React.createElement('p', { style: titleStyle }, conversation.title), React.createElement('div', { style: imageWrapperStyle },
Expand All @@ -720,6 +716,8 @@ module.exports = exports = React.createClass({
}));
}

console.log('Conve', this.state.showConversation, this.state.conversations);

return React.createElement('div', null, ConversationList);
}

Expand Down Expand Up @@ -1636,11 +1634,8 @@ var Toolbar = React.createClass({
// screenshot: React.PropTypes.boolean,
// flag: React.PropTypes.boolean
},
showConversation: function showConversation() {
this.props.showConversation();
},
render: function render() {
return React.createElement(ButtonToolbar, null, React.createElement(Button, { onClick: this.showConversation }, 'Note'), React.createElement(Button, null, React.createElement(Highlight, { location: this.props.location, fingerprint: this.props.fingerprint })), React.createElement(Button, null, React.createElement(Screenshot, { fingerprint: this.props.fingerprint, location: this.props.location }))
return React.createElement(ButtonToolbar, null, React.createElement(Button, { onClick: this.props.showConversation }, 'Note'), React.createElement(Button, null, React.createElement(Highlight, { location: this.props.location, fingerprint: this.props.fingerprint })), React.createElement(Button, null, React.createElement(Screenshot, { fingerprint: this.props.fingerprint, location: this.props.location }))
/*
// TODO Add in Flag functionality
<Button>Flag</Button>
Expand Down
8 changes: 3 additions & 5 deletions js/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,15 @@ module.exports = React.createClass({

showConversation: function () {
this.setState({
'conversation': null
})
this.setState({
'showConversation': !this.state.showConversation
'conversation': null,
'showConversation': (this.state.showConversation) ? null : true
})
},

setConversation: function (conversation) {
this.setState({
'conversation': conversation,
'showConversation': !this.state.showConversation
'showConversation': (this.state.showConversation) ? null : true
})
},

Expand Down
8 changes: 4 additions & 4 deletions js/components/conversations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ module.exports = exports = React.createClass({
if (nextProps.conversations) {
this.getAvatars(nextProps.conversations)
}
if (nextProps.showConversation) {
this.setState({showConversation: nextProps.showConversation})
}
this.setState({showConversation: nextProps.showConversation})
},
// componentDidUpdate: function () {
// console.log('State updated', this.state.conversations)
Expand Down Expand Up @@ -118,7 +116,7 @@ module.exports = exports = React.createClass({

var ConversationList

if (!this.state.showConversation && this.state.conversations) {
if (this.state.showConversation === null && this.state.conversations) {
var _this = this
ConversationList = (
<div>
Expand Down Expand Up @@ -146,6 +144,8 @@ module.exports = exports = React.createClass({
)
}

console.log('Conve', this.state.showConversation, this.state.conversations)

return (
<div>
{ConversationList}
Expand Down
5 changes: 1 addition & 4 deletions js/components/toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ var Toolbar = React.createClass({
// screenshot: React.PropTypes.boolean,
// flag: React.PropTypes.boolean
},
showConversation: function () {
this.props.showConversation()
},
render: function () {
return (
<ButtonToolbar>
<Button onClick={this.showConversation} >
<Button onClick={this.props.showConversation} >
Note
</Button>
<Button>
Expand Down

0 comments on commit 3e301b2

Please sign in to comment.