);
}
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 (
-
-
-
-
+
+
+
+
+
+
diff --git a/app/assets/javascripts/components/reducers/timelines.jsx b/app/assets/javascripts/components/reducers/timelines.jsx
index b6ecdfb1f..24adeccf8 100644
--- a/app/assets/javascripts/components/reducers/timelines.jsx
+++ b/app/assets/javascripts/components/reducers/timelines.jsx
@@ -1,12 +1,14 @@
import { TIMELINE_SET, TIMELINE_UPDATE, TIMELINE_DELETE } from '../actions/timelines';
import { REBLOG_SUCCESS, FAVOURITE_SUCCESS } from '../actions/interactions';
+import { ACCOUNT_SET_SELF } from '../actions/accounts';
import Immutable from 'immutable';
const initialState = Immutable.Map({
home: Immutable.List([]),
mentions: Immutable.List([]),
statuses: Immutable.Map(),
- accounts: Immutable.Map()
+ accounts: Immutable.Map(),
+ me: null
});
function statusToMaps(state, status) {
@@ -63,6 +65,11 @@ export default function timelines(state = initialState, action) {
case REBLOG_SUCCESS:
case FAVOURITE_SUCCESS:
return statusToMaps(state, Immutable.fromJS(action.response));
+ case ACCOUNT_SET_SELF:
+ return state.withMutations(map => {
+ map.setIn(['accounts', action.account.id], Immutable.fromJS(action.account));
+ map.set('me', action.account.id);
+ });
default:
return state;
}
diff --git a/app/assets/javascripts/components/routes/account_route.jsx b/app/assets/javascripts/components/routes/account_route.jsx
deleted file mode 100644
index 830621ed8..000000000
--- a/app/assets/javascripts/components/routes/account_route.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-const AccountRoute = React.createClass({
-
- render() {
- return (
-
- {this.props.params.account_id}
-
- )
- }
-
-});
-
-export default AccountRoute;
diff --git a/app/assets/javascripts/components/routes/status_route.jsx b/app/assets/javascripts/components/routes/status_route.jsx
deleted file mode 100644
index 358157f1e..000000000
--- a/app/assets/javascripts/components/routes/status_route.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-const StatusRoute = React.createClass({
-
- render() {
- return (
-
- {this.props.params.status_id}
-
- )
- }
-
-});
-
-export default StatusRoute;
diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb
index 23de56ac6..d08264e1e 100644
--- a/app/helpers/home_helper.rb
+++ b/app/helpers/home_helper.rb
@@ -1,2 +1,14 @@
module HomeHelper
+ def default_props
+ {
+ token: @token,
+
+ account: render(file: 'api/accounts/show', locals: { account: current_user.account }, formats: :json),
+
+ timelines: {
+ home: render(file: 'api/statuses/home', locals: { statuses: @home }, formats: :json),
+ mentions: render(file: 'api/statuses/mentions', locals: { statuses: @mentions }, formats: :json)
+ }
+ }
+ end
end
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 9279ae9ae..34028462c 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -1 +1 @@
-= react_component 'Root', { token: @token, timelines: { home: render(file: 'api/statuses/home', locals: { statuses: @home }, formats: :json), mentions: render(file: 'api/statuses/mentions', locals: { statuses: @mentions }, formats: :json) }}, class: 'app-holder', prerender: false
+= react_component 'Root', default_props, class: 'app-holder', prerender: false