diff --git a/src/app/app.css b/src/app/app.css index 2e217c1..1dce62b 100644 --- a/src/app/app.css +++ b/src/app/app.css @@ -20,4 +20,12 @@ .header.sticky .header-main > div > div > div:nth-child(2) > div > div:nth-child(1) { opacity:0; +} + +.header .counter-statistic { + transition: 0.5s; +} + +.header.sticky .counter-statistic { + opacity: 0; } \ No newline at end of file diff --git a/src/app/header.js b/src/app/header.js index 8065a5c..1ab14a5 100644 --- a/src/app/header.js +++ b/src/app/header.js @@ -247,35 +247,13 @@ class Header extends React.Component { } /> - { - ((window.currentWindow && !window.currentWindow.isModal()) || typeof WEB !== 'undefined') - && -
0 ? '#42f445' : 'white', + marginTop: '-10px', zIndex: 2 }}> - -
rats peers: {window.peers} [{window.peersTorrents} torrents] {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'}
- { - window.p2pStatus == 0 - && -
external connections not available (check port forwarding)
- } - { - window.p2pStatus == 1 - && -
port not available, but connections redirected
- } - { - window.p2pStatus == 2 - && -
port connections fully available
- }
- } diff --git a/src/app/search.js b/src/app/search.js index 4be39b3..b662e2b 100644 --- a/src/app/search.js +++ b/src/app/search.js @@ -1,6 +1,8 @@ import React, { Component } from 'react'; import AdvancedSearch from './search-advanced-controls' +import TorrentsStatistic from './torrent-statistic' + import TextField from 'material-ui/TextField'; import RaisedButton from 'material-ui/RaisedButton'; import RefreshIndicator from 'material-ui/RefreshIndicator'; @@ -11,42 +13,9 @@ import VisibilityOff from 'material-ui/svg-icons/action/visibility-off'; import AddIcon from 'material-ui/svg-icons/content/add'; import RemoveIcon from 'material-ui/svg-icons/content/remove'; -import formatBytes from './format-bytes' - import _ from 'lodash' import singleton from './singleton'; -class TorrentsStatistic extends Component { - constructor(props) - { - super(props) - - this.stats = props.stats || {} - } - componentDidMount() - { - this.newTorrentFunc = (torrent) => { - this.stats.size += torrent.size; - this.stats.torrents++; - this.stats.files += torrent.files; - this.forceUpdate() - } - - window.torrentSocket.on('newTorrent', this.newTorrentFunc); - } - componentWillUnmount() - { - if(this.newTorrentFunc) - window.torrentSocket.off('newTorrent', this.newTorrentFunc); - } - render() - { - return ( -
you have information about {this.stats.torrents} torrents and around {this.stats.files} files and { formatBytes(this.stats.size, 1) } of data
- ) - } -} - class Search extends Component { constructor(props) { diff --git a/src/app/torrent-statistic.js b/src/app/torrent-statistic.js new file mode 100644 index 0000000..59adbc1 --- /dev/null +++ b/src/app/torrent-statistic.js @@ -0,0 +1,282 @@ +import React, { Component } from 'react'; +import formatBytes from './format-bytes' + +export default class TorrentsStatistic extends Component { + constructor(props) + { + super(props) + + this.stats = props.stats || {} + } + componentDidMount() + { + this.newTorrentFunc = (torrent) => { + this.stats.size += torrent.size; + this.stats.torrents++; + this.stats.files += torrent.files; + this.forceUpdate() + } + + window.torrentSocket.on('newTorrent', this.newTorrentFunc); + } + componentWillUnmount() + { + if(this.newTorrentFunc) + window.torrentSocket.off('newTorrent', this.newTorrentFunc); + } + render() + { + return ( +
+
+
+ + + +
{ formatBytes(this.stats.size, 1) } data
+
+ +
+ + + + + +
{this.stats.torrents} torrents
+
+ +
+ + + + + +
{this.stats.files} files
+
+
+ +
+
0 ? '#19c632' : 'white', fontSize: '1.15em', fill: window.peers > 0 ? '#19c632' : 'white'}}> + + + + + + + + + + +
{window.peers} peers
+
+ +
0 ? '#19c687' : 'white', fontSize: '1.15em', fill: window.peersTorrents > 0 ? '#19c687' : 'white', marginLeft: '20px'}}> + + + + + +
{window.peersTorrents} remote torrents
+
+ +
+ { + window.p2pStatus == 0 + && +
+ + + + + + + + +
not available
+
+ } + { + window.p2pStatus == 1 + && +
+ + + + + +
redirect
+
+ } + { + window.p2pStatus == 2 + && +
+ + + + + +
direct
+
+ } +
+
+ +
+ ) + } +} \ No newline at end of file