mirror of
https://github.com/zoriya/flood.git
synced 2026-06-01 18:47:44 +00:00
Double click on torrent opens torrent details
This commit is contained in:
@@ -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}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user