diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index dd234a258..be40ecff6 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -4,7 +4,6 @@ import { Notification, notificationActions, authActions, - embedStream } from '../../coral-framework'; import {connect} from 'react-redux'; import CommentBox from '../../coral-plugin-commentbox/CommentBox'; @@ -26,15 +25,13 @@ import SettingsContainer from '../../coral-settings/containers/SettingsContainer const {addItem, updateItem, postItem, getStream, postAction, deleteAction, appendItemArray} = itemActions; const {addNotification, clearNotification} = notificationActions; const {logout} = authActions; -const {changeTab} = embedStream; const mapStateToProps = (state) => { return { config: state.config.toJS(), items: state.items.toJS(), notification: state.notification.toJS(), - auth: state.auth.toJS(), - embedStream: state.embedStream.toJS() + auth: state.auth.toJS() }; }; @@ -52,11 +49,26 @@ const mapDispatchToProps = (dispatch) => ({ appendItemArray: (item, property, value, addToFront, itemType) => dispatch(appendItemArray(item, property, value, addToFront, itemType)), logout: () => dispatch(logout()), - changeTab: activeTab => dispatch(changeTab(activeTab)) }); class CommentStream extends Component { + constructor (props) { + super(props); + + this.state = { + activeTab: 0 + }; + + this.changeTab = this.changeTab.bind(this); + } + + changeTab (tab) { + this.setState({ + activeTab: tab + }); + } + static propTypes = { items: PropTypes.object.isRequired, addItem: PropTypes.func.isRequired, @@ -96,13 +108,13 @@ class CommentStream extends Component { const rootItem = this.props.items.assets && this.props.items.assets[rootItemId]; const {actions, users, comments} = this.props.items; const {loggedIn, user, showSignInDialog} = this.props.auth; - const {activeTab} = this.props.embedStream; + const {activeTab} = this.state; return
{ rootItem ?
- + Settings @@ -235,9 +247,9 @@ class CommentStream extends Component { notification={this.props.notification} /> - + - +
: 'Loading' } diff --git a/client/coral-framework/actions/embedStream.js b/client/coral-framework/actions/embedStream.js deleted file mode 100644 index f50e4f506..000000000 --- a/client/coral-framework/actions/embedStream.js +++ /dev/null @@ -1,22 +0,0 @@ -import {base, handleResp, getInit} from '../helpers/response'; -import * as actions from '../constants/embedStream'; - -export const changeTab = activeTab => dispatch => - dispatch({ - type: actions.CHANGE_TAB, - activeTab - }); - -const userBioRequest = () => ({type: actions.FETCH_USER_BIO_REQUEST}); -const userBioSuccess = userBio => ({type: actions.FETCH_USER_BIO_SUCCESS, userBio}); -const userBioFailure = error => ({type: actions.FETCH_USER_BIO_FAILURE, error}); - -export const fetchUserBio = () => dispatch => { - dispatch(userBioRequest()); - fetch(`${base}/bio`, getInit('GET')) - .then(handleResp) - .then(({bio}) => { - dispatch(userBioSuccess(bio)); - }) - .catch(() => dispatch(userBioFailure())); -}; diff --git a/client/coral-framework/constants/embedStream.js b/client/coral-framework/constants/embedStream.js deleted file mode 100644 index 5b0344234..000000000 --- a/client/coral-framework/constants/embedStream.js +++ /dev/null @@ -1 +0,0 @@ -export const CHANGE_TAB = 'CHANGE_VIEW'; diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js index 478c395bd..c11510cf4 100644 --- a/client/coral-framework/index.js +++ b/client/coral-framework/index.js @@ -5,7 +5,6 @@ import * as itemActions from './actions/items'; import I18n from './modules/i18n/i18n'; import * as notificationActions from './actions/notification'; import * as authActions from './actions/auth'; -import * as embedStream from './actions/embedStream'; export { Notification, @@ -15,5 +14,4 @@ export { I18n, notificationActions, authActions, - embedStream }; diff --git a/client/coral-framework/reducers/embedStream.js b/client/coral-framework/reducers/embedStream.js deleted file mode 100644 index 2d235ebab..000000000 --- a/client/coral-framework/reducers/embedStream.js +++ /dev/null @@ -1,16 +0,0 @@ -import {Map} from 'immutable'; -import * as actions from '../constants/embedStream'; - -const initialState = Map({ - activeTab: 0 -}); - -export default function embedStream (state = initialState, action) { - switch (action.type) { - case actions.CHANGE_TAB : - return state - .set('activeTab', action.activeTab); - default : - return state; - } -} diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js index 964774000..90eaa7cb7 100644 --- a/client/coral-framework/reducers/index.js +++ b/client/coral-framework/reducers/index.js @@ -5,7 +5,6 @@ import config from './config'; import items from './items'; import notification from './notification'; import auth from './auth'; -import embedStream from './embedStream'; /** * Expose the combined main reducer @@ -16,5 +15,4 @@ export default combineReducers({ items, notification, auth, - embedStream }); diff --git a/client/coral-settings/containers/SettingsContainer.js b/client/coral-settings/containers/SettingsContainer.js index 8aa01211e..224eb6c6a 100644 --- a/client/coral-settings/containers/SettingsContainer.js +++ b/client/coral-settings/containers/SettingsContainer.js @@ -1,7 +1,6 @@ import React, {Component} from 'react'; import {connect} from 'react-redux'; -import {} from '../../coral-framework/actions/embedStream'; import {TabBar, Tab} from '../../coral-ui'; import Bio from '../components/Bio'; @@ -46,8 +45,7 @@ class SignInContainer extends Component { } } -const mapStateToProps = state => ({ - embedStream: state.embedStream.toJS() +const mapStateToProps = () => ({ }); const mapDispatchToProps = dispatch => ({