Fix directly loading a torrent detail page
This commit is contained in:
parent
6983703672
commit
d939ca662e
34
src/index.js
34
src/index.js
|
@ -12,27 +12,23 @@ import { filter_subscribe } from './actions/filter_subscribe';
|
||||||
|
|
||||||
import Nav from './ui/navigation';
|
import Nav from './ui/navigation';
|
||||||
import Main from './ui/main';
|
import Main from './ui/main';
|
||||||
|
import Connection from './ui/connection';
|
||||||
|
|
||||||
|
const root = document.getElementById('root');
|
||||||
|
ReactDOM.render(<Connection />, root);
|
||||||
|
|
||||||
ws_init(() => {
|
ws_init(() => {
|
||||||
store.dispatch(filter_subscribe());
|
store.dispatch(filter_subscribe());
|
||||||
store.dispatch(filter_subscribe('server'));
|
store.dispatch(filter_subscribe('server'));
|
||||||
});
|
ReactDOM.render(
|
||||||
|
<Provider store={store}>
|
||||||
const render = App => ReactDOM.render(
|
<ConnectedRouter history={history}>
|
||||||
<Provider store={store}>
|
<div>
|
||||||
<ConnectedRouter history={history}>
|
<Nav />
|
||||||
<div>
|
<div className="container">
|
||||||
<Nav />
|
<Main />
|
||||||
<div className="container">
|
</div>
|
||||||
<App />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ConnectedRouter>
|
||||||
</ConnectedRouter>
|
</Provider>, root);
|
||||||
</Provider>,
|
});
|
||||||
document.getElementById('root'));
|
|
||||||
|
|
||||||
render(Main);
|
|
||||||
|
|
||||||
if (module.hot) {
|
|
||||||
module.hot.accept('./ui/main', () => render(Main));
|
|
||||||
}
|
|
||||||
|
|
9
src/ui/connection.js
Normal file
9
src/ui/connection.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
|
export default class Connection extends Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<p>Connecting...</p>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,9 +13,8 @@ import {
|
||||||
Progress
|
Progress
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
import ws_send from '../socket';
|
import ws_send from '../socket';
|
||||||
|
import selectTorrent, { UNION } from '../actions/selection';
|
||||||
|
|
||||||
// TODO: use component lifecycle functions here to invoke
|
|
||||||
// torrent_state.updateSubscriptions
|
|
||||||
// TODO: fix navigating directly to torrent pages
|
// TODO: fix navigating directly to torrent pages
|
||||||
|
|
||||||
function File({ file }) {
|
function File({ file }) {
|
||||||
|
@ -152,6 +151,13 @@ class TorrentDetails extends Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { ids } = this.props.match.params;
|
||||||
|
const _ids = ids.split(",");
|
||||||
|
_ids.forEach(id => dispatch(selectTorrent(id, UNION)));
|
||||||
|
}
|
||||||
|
|
||||||
renderHeader(selection) {
|
renderHeader(selection) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -197,5 +203,6 @@ export default connect(state => ({
|
||||||
router: state.router,
|
router: state.router,
|
||||||
torrents: state.torrents,
|
torrents: state.torrents,
|
||||||
files: state.files,
|
files: state.files,
|
||||||
selection: state.selection
|
selection: state.selection,
|
||||||
|
server: state.server
|
||||||
}))(TorrentDetails);
|
}))(TorrentDetails);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user