diff --git a/client/source/scripts/components/action-bar/AddTorrent.js b/client/source/scripts/components/action-bar/AddTorrent.js deleted file mode 100644 index 85b31a1b..00000000 --- a/client/source/scripts/components/action-bar/AddTorrent.js +++ /dev/null @@ -1,137 +0,0 @@ -import classnames from 'classnames'; -import CSSTransitionGroup from 'react-addons-css-transition-group'; -import React from 'react'; - -import Action from './Action'; - -const methodsToBind = [ - 'componentDidMount', - 'componentWillUnmount', - 'getChildren', - '_handleDestinationChange', - '_handleUrlChange', - '_handleAddTorrent', - '_handleButtonClick', - '_handleExternalClick', - '_handleExternalClick' -]; - -export default class AddTorrentPanel extends React.Component { - - constructor() { - super(); - - this.state = { - isExpanded: false - }; - - methodsToBind.forEach((method) => { - this[method] = this[method].bind(this); - }); - } - - componentDidMount() { - window.addEventListener('click', this._handleExternalClick); - } - - componentWillUnmount() { - window.removeEventListener('click', this._handleExternalClick); - } - - getChildren() { - return ( -
-
Add Torrent
-
-
- - -
-
- - -
-
- -
-
-
- ); - } - - render() { - let classSet = classnames({ - 'dropdown': true, - 'dropdown--align-right': true, - 'is-expanded': this.state.isExpanded - }); - let children = null; - - if (this.state.isExpanded) { - children = this.getChildren(); - } - - return ( -
- - - {children} - -
- ); - } - - _handleDestinationChange(event) { - this.setState({ - destination: event.target.value - }) - } - - _handleUrlChange(event) { - this.setState({ - url: event.target.value - }) - } - - _handleAddTorrent() { - // TorrentActions.add({ - // url: this.state.url, - // destination: this.state.destination - // }); - } - - _handleButtonClick(evt) { - evt.stopPropagation(); - this.setState({ - isExpanded: !this.state.isExpanded - }); - } - - _handleExternalClick() { - if (this.state.isExpanded) { - this.setState({ - isExpanded: false - }); - } - } - - _handleMenuWrapperClick(evt) { - evt.stopPropagation(); - } - -} diff --git a/client/source/scripts/components/modals/AddTorrent.js b/client/source/scripts/components/modals/AddTorrent.js new file mode 100644 index 00000000..73982a2c --- /dev/null +++ b/client/source/scripts/components/modals/AddTorrent.js @@ -0,0 +1,93 @@ +import classnames from 'classnames'; +import React from 'react'; + +const methodsToBind = [ + 'getContent', + 'handleDestinationChange', + 'handleUrlChange', + 'handleAddTorrent', + 'handleButtonClick' +]; + +export default class AddTorrentPanel extends React.Component { + + constructor() { + super(); + + this.state = { + isExpanded: false + }; + + methodsToBind.forEach((method) => { + this[method] = this[method].bind(this); + }); + } + + getContent() { + return ( +
+
Add Torrent
+
+
+ + +
+
+ + +
+
+ +
+
+
+ ); + } + + handleAddTorrent() { + // TorrentActions.add({ + // url: this.state.url, + // destination: this.state.destination + // }); + } + + handleButtonClick(evt) { + evt.stopPropagation(); + this.setState({ + isExpanded: !this.state.isExpanded + }); + } + + handleDestinationChange(event) { + this.setState({ + destination: event.target.value + }) + } + + handleMenuWrapperClick(evt) { + evt.stopPropagation(); + } + + handleUrlChange(event) { + this.setState({ + url: event.target.value + }) + } + + render() { + return this.getContent(); + } + +}