diff options
Diffstat (limited to 'app/assets/javascripts/components/containers')
-rw-r--r-- | app/assets/javascripts/components/containers/navigation_container.jsx | 8 | ||||
-rw-r--r-- | app/assets/javascripts/components/containers/root.jsx | 22 |
2 files changed, 20 insertions, 10 deletions
diff --git a/app/assets/javascripts/components/containers/navigation_container.jsx b/app/assets/javascripts/components/containers/navigation_container.jsx new file mode 100644 index 000000000..4aeea4c37 --- /dev/null +++ b/app/assets/javascripts/components/containers/navigation_container.jsx @@ -0,0 +1,8 @@ +import { connect } from 'react-redux'; +import NavigationBar from '../components/navigation_bar'; + +const mapStateToProps = (state, props) => ({ + account: state.getIn(['timelines', 'accounts', state.getIn(['timelines', 'me'])]) +}); + +export default connect(mapStateToProps)(NavigationBar); diff --git a/app/assets/javascripts/components/containers/root.jsx b/app/assets/javascripts/components/containers/root.jsx index e2baefa24..1ded95d3c 100644 --- a/app/assets/javascripts/components/containers/root.jsx +++ b/app/assets/javascripts/components/containers/root.jsx @@ -3,25 +3,25 @@ import configureStore fro import Frontend from '../components/frontend'; import { setTimeline, updateTimeline, deleteFromTimelines, refreshTimeline } from '../actions/timelines'; import { setAccessToken } from '../actions/meta'; +import { setAccountSelf } from '../actions/accounts'; import PureRenderMixin from 'react-addons-pure-render-mixin'; -import { Router, Route, createMemoryHistory } from 'react-router'; -import AccountRoute from '../routes/account_route'; -import StatusRoute from '../routes/status_route'; +import { Router, Route, hashHistory } from 'react-router'; -const store = configureStore(); -const history = createMemoryHistory(); +const store = configureStore(); const Root = React.createClass({ propTypes: { token: React.PropTypes.string.isRequired, - timelines: React.PropTypes.object + timelines: React.PropTypes.object, + account: React.PropTypes.string }, mixins: [PureRenderMixin], componentWillMount() { store.dispatch(setAccessToken(this.props.token)); + store.dispatch(setAccountSelf(JSON.parse(this.props.account))); for (var timelineType in this.props.timelines) { if (this.props.timelines.hasOwnProperty(timelineType)) { @@ -53,10 +53,12 @@ const Root = React.createClass({ render () { return ( <Provider store={store}> - <Router history={history}> - <Route path="/" component={Frontend}> - <Route path="/accounts/:account_id" component={AccountRoute} /> - <Route path="/statuses/:status_id" component={StatusRoute} /> + <Router history={hashHistory}> + <Route path='/' component={Frontend}> + <Route path='/settings' component={null} /> + <Route path='/subscriptions' component={null} /> + <Route path='/statuses/:statusId' component={null} /> + <Route path='/accounts/:accountId' component={null} /> </Route> </Router> </Provider> |