From 545a0676c0a20503233c30226c3a0280d52f768d Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 16 Jun 2018 23:21:20 +0300 Subject: [PATCH] fix(feed): fix p2p load error --- src/app/feed-page.js | 96 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/app/feed-page.js diff --git a/src/app/feed-page.js b/src/app/feed-page.js new file mode 100644 index 0000000..41cad0d --- /dev/null +++ b/src/app/feed-page.js @@ -0,0 +1,96 @@ +import React from 'react'; +import Page from './page'; + +import SearchResults from './search-results' +import Search from './search' +import SelectField from 'material-ui/SelectField'; +import MenuItem from 'material-ui/MenuItem'; +import Feed from './feed'; + +export default class FeedPage extends Page { + constructor(props) { + super(props) + this.setTitle('Rats On The Boat - Content Search Engine'); + } + componentDidMount() + { + Search.instance().onSearchUpdate = () => this.forceUpdate() + } + componentWillUnmount() + { + Search.instance().onSearchUpdate = () => {} + } + render() { + const orderText = (text, field) => { + if(field !== Search.instance().state.orderBy) + return text; + + if(Search.instance().state.orderDesc) + return text + ' ⇩' + else + return text + ' ⇧' + } + + return ( +
+
+ { + event.preventDefault(); // fix overclick on torrent + if(value === 'none') { + Search.instance().setState({orderBy: null}, () => { + Search.instance().search(true) + }) + return; + } + + if(value === Search.instance().state.orderBy) + { + Search.instance().setState({orderDesc: !Search.instance().state.orderDesc}, () => { + Search.instance().search(true) + }) + return; + } + + Search.instance().setState({ + orderBy: value, + orderDesc: (value === 'seeders' || value === 'completed' || value === 'added') ? true : Search.instance().state.orderDesc + }, () => { + Search.instance().search(true) + }) + }} + > + + + + + + + + + } + + moreTorrentsEnabled={Search.instance().moreSearchTorrents && !Search.instance().state.searchingIndicator} + moreFilesEnabled={Search.instance().moreSearchFiles && !Search.instance().state.searchingIndicator} + onMoreTorrents={() => Search.instance().moreTorrents()} + onMoreFiles={() => Search.instance().moreFiles()} + moreTorrentsIndicator={Search.instance().state.moreTorrentsIndicator} + moreFilesIndicator={Search.instance().state.moreFilesIndicator} + /> +
+
+ +
+
+ ); + } +}