mirror of
https://github.com/zoriya/flood.git
synced 2026-05-31 02:15:12 +00:00
Add notification system
This commit is contained in:
@@ -1,47 +1,13 @@
|
||||
import classnames from 'classnames';
|
||||
import React from 'react';
|
||||
|
||||
import ActionBar from '../torrent-list/ActionBar';
|
||||
import ApplicationPanel from '../layout/ApplicationPanel';
|
||||
import EventTypes from '../../constants/EventTypes';
|
||||
import TorrentListContainer from '../torrent-list/TorrentListContainer';
|
||||
import TorrentStore from '../../stores/TorrentStore';
|
||||
import UIStore from '../../stores/UIStore';
|
||||
|
||||
const METHODS_TO_BIND = ['onOpenChange'];
|
||||
|
||||
class TorrentListView extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.state = {
|
||||
isTorrentDetailsOpen: false
|
||||
};
|
||||
|
||||
METHODS_TO_BIND.forEach((method) => {
|
||||
this[method] = this[method].bind(this);
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
UIStore.listen(EventTypes.UI_TORRENT_DETAILS_OPEN_CHANGE, this.onOpenChange);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
UIStore.unlisten(EventTypes.UI_TORRENT_DETAILS_OPEN_CHANGE, this.onOpenChange);
|
||||
}
|
||||
|
||||
onOpenChange() {
|
||||
this.setState({
|
||||
isTorrentDetailsOpen: UIStore.isTorrentDetailsOpen()
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let classes = classnames({'is-open': this.state.isTorrentDetailsOpen}, 'view--torrent-list');
|
||||
|
||||
return (
|
||||
<ApplicationPanel modifier="torrent-list" className={classes}>
|
||||
<ApplicationPanel modifier="torrent-list" className="view--torrent-list">
|
||||
<ActionBar />
|
||||
<TorrentListContainer />
|
||||
</ApplicationPanel>
|
||||
|
||||
Reference in New Issue
Block a user