Double click on torrent opens torrent details

This commit is contained in:
John Furrow
2017-02-04 11:06:35 -08:00
parent 2f415d6169
commit 0361a48f17
3 changed files with 19 additions and 12 deletions
@@ -34,6 +34,7 @@ const ICONS = {
const METHODS_TO_BIND = [
'handleClick',
'handleDoubleClick',
'handleRightClick'
];
@@ -114,11 +115,21 @@ class Torrent extends React.Component {
});
}
getWidth(slug) {
const {defaultWidth, defaultPropWidths, propWidths} = this.props;
return propWidths[slug] || defaultPropWidths[slug] || defaultWidth;
}
handleClick(event) {
this.setState({isSelected: true});
this.props.handleClick(this.props.torrent.hash, event);
}
handleDoubleClick(event) {
this.props.handleDoubleClick(this.props.torrent, event);
}
handleRightClick(event) {
if (!this.state.isSelected) {
this.handleClick(event);
@@ -127,16 +138,6 @@ class Torrent extends React.Component {
this.props.handleRightClick(this.props.torrent, event);
}
handleSettingsChange() {
console.log('settings change');
}
getWidth(slug) {
const {defaultWidth, defaultPropWidths, propWidths} = this.props;
return propWidths[slug] || defaultPropWidths[slug] || defaultWidth;
}
render() {
const {isSelected} = this.state;
const {isCondensed, torrent} = this.props;
@@ -153,6 +154,7 @@ class Torrent extends React.Component {
if (isCondensed) {
return (
<li className={torrentClasses} onClick={this.handleClick}
onDoubleClick={this.handleDoubleClick}
onContextMenu={this.handleRightClick}>
<TorrentDetail className="table__cell"
slug="name"
@@ -321,6 +321,10 @@ class TorrentListContainer extends React.Component {
});
}
handleDoubleClick(torrent, event) {
this.handleDetailsClick(torrent, event);
}
handleContextMenuClick(torrent, event) {
event.preventDefault();
@@ -511,6 +515,7 @@ class TorrentListContainer extends React.Component {
defaultWidth={defaultWidth}
handleClick={this.handleTorrentClick}
handleDetailsClick={this.handleDetailsClick}
handleDoubleClick={this.handleDoubleClick}
handleRightClick={this.handleContextMenuClick}
index={index}
isCondensed={options.isCondensed}
+2 -2
View File
File diff suppressed because one or more lines are too long