Adding public timeline

This commit is contained in:
Eugen Rochko
2016-10-07 16:00:11 +02:00
parent 06016453bd
commit 1f650d327d
21 changed files with 229 additions and 71 deletions

View File

@ -18,6 +18,7 @@ import {
import Account from '../features/account';
import Status from '../features/status';
import GettingStarted from '../features/getting_started';
import PublicTimeline from '../features/public_timeline';
import UI from '../features/ui';
const store = configureStore();
@ -43,14 +44,7 @@ const Mastodon = React.createClass({
}
if (typeof App !== 'undefined') {
App.timeline = App.cable.subscriptions.create("TimelineChannel", {
connected () {
},
disconnected () {
},
this.subscription = App.cable.subscriptions.create('TimelineChannel', {
received (data) {
switch(data.type) {
@ -65,16 +59,24 @@ const Mastodon = React.createClass({
return store.dispatch(refreshTimeline('mentions'));
}
}
});
}
},
componentWillUnmount () {
if (typeof this.subscription !== 'undefined') {
this.subscription.unsubscribe();
}
},
render () {
return (
<Provider store={store}>
<Router history={hashHistory}>
<Route path='/' component={UI}>
<IndexRoute component={GettingStarted} />
<Route path='/statuses/all' component={PublicTimeline} />
<Route path='/statuses/:statusId' component={Status} />
<Route path='/accounts/:accountId' component={Account} />
</Route>