правильный тайтл на страницах
This commit is contained in:
parent
1b799747eb
commit
8cfcdbaf3c
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="fragment" content="!" />
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||
<title>BT Search</title>
|
||||
</head>
|
||||
|
18
src/app.js
18
src/app.js
@ -14,9 +14,27 @@ injectTapEventPlugin();
|
||||
|
||||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
|
||||
|
||||
let loadersCount = 0;
|
||||
let appReady = false;
|
||||
window.customLoader = (func) => {
|
||||
loadersCount++;
|
||||
return (...args) => {
|
||||
func(...args);
|
||||
loadersCount--;
|
||||
}
|
||||
};
|
||||
|
||||
window.isReady = () => {
|
||||
return (appReady && loadersCount === 0)
|
||||
}
|
||||
|
||||
class App extends Component {
|
||||
componentDidMount() {
|
||||
window.router()
|
||||
appReady = true;
|
||||
}
|
||||
componentWillUnmount() {
|
||||
appReady = false;
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import Page from './page';
|
||||
|
||||
import RecentTorrents from './recent-torrents'
|
||||
import Search from './search'
|
||||
@ -25,7 +26,11 @@ const Header = (props) => {
|
||||
|
||||
export {Header}
|
||||
|
||||
export default class IndexPage extends Component {
|
||||
export default class IndexPage extends Page {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.setTitle('Welcome to files/torrents search engine');
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
|
@ -172,7 +172,7 @@ export default class RecentTorrents extends Component {
|
||||
this.state = { pause: false }
|
||||
}
|
||||
componentDidMount() {
|
||||
window.torrentSocket.emit('recentTorrents', (data) => {
|
||||
window.torrentSocket.emit('recentTorrents', window.customLoader((data) => {
|
||||
if(data) {
|
||||
this.torrents = data;
|
||||
this.forceUpdate();
|
||||
@ -206,7 +206,7 @@ export default class RecentTorrents extends Component {
|
||||
setTimeout(this.displayNewTorrent, speed);
|
||||
}
|
||||
this.displayNewTorrent();
|
||||
});
|
||||
}));
|
||||
this.newTorrentFunc = (torrent) => {
|
||||
if(this.displayQueue.length < this.maxDisplaySize) {
|
||||
this.displayQueue.push(torrent);
|
||||
|
@ -20,7 +20,7 @@ export default class Search extends Component {
|
||||
});
|
||||
this.searchData = [];
|
||||
let queries = 2;
|
||||
window.torrentSocket.emit('searchTorrent', this.searchValue, {limit: 10}, (torrents) => {
|
||||
window.torrentSocket.emit('searchTorrent', this.searchValue, {limit: 10}, window.customLoader((torrents) => {
|
||||
if(torrents) {
|
||||
this.searchData = this.searchData.concat(torrents);
|
||||
}
|
||||
@ -31,8 +31,8 @@ export default class Search extends Component {
|
||||
} else {
|
||||
this.forceUpdate();
|
||||
}
|
||||
});
|
||||
window.torrentSocket.emit('searchFiles', this.searchValue, {limit: 10}, (torrents) => {
|
||||
}));
|
||||
window.torrentSocket.emit('searchFiles', this.searchValue, {limit: 10}, window.customLoader((torrents) => {
|
||||
if(torrents) {
|
||||
this.searchData = this.searchData.concat(torrents);
|
||||
}
|
||||
@ -43,7 +43,7 @@ export default class Search extends Component {
|
||||
} else {
|
||||
this.forceUpdate();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
componentDidMount() {
|
||||
this.newStatisticFunc = (statistic) => {
|
||||
@ -52,7 +52,7 @@ export default class Search extends Component {
|
||||
this.forceUpdate();
|
||||
}
|
||||
};
|
||||
window.torrentSocket.emit('statistic', this.newStatisticFunc);
|
||||
window.torrentSocket.emit('statistic', window.customLoader(this.newStatisticFunc));
|
||||
window.torrentSocket.on('newStatistic', this.newStatisticFunc);
|
||||
}
|
||||
componentWillUnmount()
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import Page from './page';
|
||||
import formatBytes from './format-bytes'
|
||||
|
||||
import {List, ListItem} from 'material-ui/List';
|
||||
@ -118,12 +119,13 @@ const TorrentInformation = (props) => {
|
||||
);
|
||||
}
|
||||
|
||||
export default class TorrentPage extends Component {
|
||||
export default class TorrentPage extends Page {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
value: 'info',
|
||||
};
|
||||
this.setTitle('Information about torrent');
|
||||
}
|
||||
|
||||
handleChange = (value) => {
|
||||
@ -140,6 +142,7 @@ export default class TorrentPage extends Component {
|
||||
window.torrentSocket.emit('torrent', this.props.hash, {files: true}, (data) => {
|
||||
if(data) {
|
||||
this.torrent = data
|
||||
this.setTitle('Download ' + this.torrent.name);
|
||||
this.forceUpdate();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user