From f09c6ab43f16e6f65fc7cd38bb5493c31d05834b Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 16 Jun 2018 23:29:58 +0300 Subject: [PATCH] feat(activity): activity page / feed separate --- src/app/activity-page.js | 20 +++++++ src/app/css/izi/components.css | 4 +- src/app/header.js | 70 +++++++++++++++--------- src/app/index-page.js | 98 ---------------------------------- src/app/router.js | 10 +++- src/background/api.js | 2 +- 6 files changed, 76 insertions(+), 128 deletions(-) create mode 100644 src/app/activity-page.js delete mode 100644 src/app/index-page.js diff --git a/src/app/activity-page.js b/src/app/activity-page.js new file mode 100644 index 0000000..d16730e --- /dev/null +++ b/src/app/activity-page.js @@ -0,0 +1,20 @@ +import React from 'react'; +import Page from './page'; + +import RecentTorrents from './recent-torrents' + +export default class ActivityPage extends Page { + constructor(props) { + super(props) + this.setTitle('Rats On The Boat - Content Search Engine'); + } + render() { + return ( +
+
+ +
+
+ ); + } +} diff --git a/src/app/css/izi/components.css b/src/app/css/izi/components.css index 21bc5b4..49590e6 100644 --- a/src/app/css/izi/components.css +++ b/src/app/css/izi/components.css @@ -85,12 +85,12 @@ } } -@media only screen and (max-width: 840px) +@media only screen and (max-width: 912px) { .header-row { flex-wrap: wrap; align-content: flex-start; - justify-content: flex-start; + justify-content: center; } .search-panel { diff --git a/src/app/header.js b/src/app/header.js index 018ca8b..72e0d51 100644 --- a/src/app/header.js +++ b/src/app/header.js @@ -163,7 +163,7 @@ class Header extends React.Component { transition: '1s' }}> { window.router('/') }} @@ -171,30 +171,16 @@ class Header extends React.Component { labelColor='white' style={{height: 60, borderRadius: 6, margin: 5, zIndex: 1}} buttonStyle={{borderRadius: 5}} - icon={ - - - - - - - - - - - - + icon={ + + + + + + + } @@ -246,6 +232,40 @@ class Header extends React.Component { } + /> + { + window.router('/activity') + }} + backgroundColor='#2a5cba' + labelColor='white' + style={{height: 60, width: 150, borderRadius: 5, margin: 5, zIndex: 1}} + buttonStyle={{borderRadius: 5}} + icon={ + + + + + + + } />
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} - /> -
-
- - -
-
- ); - } -} diff --git a/src/app/router.js b/src/app/router.js index 77d72bb..d780495 100644 --- a/src/app/router.js +++ b/src/app/router.js @@ -1,7 +1,8 @@ //import router from 'page'; import PagesPie from './pages-pie.js'; -import IndexPage from './index-page.js' +import FeedPage from './feed-page.js' +import ActivityPage from './activity-page' import TorrentPage from './torrent-page.js' import DMCAPage from './dmca-page.js' import ConfigPage from './config-page.js' @@ -54,7 +55,7 @@ window.router = router; router('/', () => { //singleton - PagesPie.instance().open(IndexPage, {replace: 'all'}); + PagesPie.instance().open(FeedPage, {replace: 'all'}); }); router('/torrent/:hash', (e) => { @@ -91,6 +92,11 @@ router('/downloads', () => { PagesPie.instance().open(DownloadPage, {replace: 'all'}); }); +router('/activity', () => { + //singleton + PagesPie.instance().open(ActivityPage, {replace: 'all'}); +}); + router('/changelog', () => { //singleton PagesPie.instance().open(ChangelogPage, {replace: 'all'}); diff --git a/src/background/api.js b/src/background/api.js index ef82de8..df0ac3c 100644 --- a/src/background/api.js +++ b/src/background/api.js @@ -779,7 +779,7 @@ module.exports = async ({ // call once to get bigest feed let feedLock = false - this.p2p.events.on('peer', () => { + p2p.events.on('peer', () => { if(feedLock) return feedLock = true