diff --git a/client/coral-admin/src/actions/configure.js b/client/coral-admin/src/actions/configure.js index cf33a4d11..128de75bc 100644 --- a/client/coral-admin/src/actions/configure.js +++ b/client/coral-admin/src/actions/configure.js @@ -7,3 +7,7 @@ export const updatePending = ({updater, errorUpdater}) => { export const clearPending = () => { return {type: actions.CLEAR_PENDING}; }; + +export const setActiveSection = (section) => { + return {type: actions.SET_ACTIVE_SECTION, section}; +}; diff --git a/client/coral-admin/src/constants/configure.js b/client/coral-admin/src/constants/configure.js index f2d55a2c2..05673b5aa 100644 --- a/client/coral-admin/src/constants/configure.js +++ b/client/coral-admin/src/constants/configure.js @@ -1,4 +1,5 @@ -const prefix = 'CORAL_ADMIN'; +const prefix = 'TALK_ADMIN_CONFIGURE'; export const UPDATE_PENDING = `${prefix}_UPDATE_PENDING`; export const CLEAR_PENDING = `${prefix}_CLEAR_PENDING`; +export const SET_ACTIVE_SECTION = `${prefix}_SET_ACTIVE_SECTION`; diff --git a/client/coral-admin/src/reducers/configure.js b/client/coral-admin/src/reducers/configure.js index a692addc1..e03c9ea8f 100644 --- a/client/coral-admin/src/reducers/configure.js +++ b/client/coral-admin/src/reducers/configure.js @@ -6,6 +6,7 @@ const initialState = { canSave: false, pending: {}, errors: {}, + activeSection: 'stream', }; export default function configure(state = initialState, action) { @@ -36,6 +37,11 @@ export default function configure(state = initialState, action) { pending: {}, canSave: false, }; + case actions.SET_ACTIVE_SECTION: + return { + ...state, + activeSection: action.section, + }; } return state; } diff --git a/client/coral-admin/src/routes/Configure/components/Configure.js b/client/coral-admin/src/routes/Configure/components/Configure.js index b0bf5e064..cc765f2da 100644 --- a/client/coral-admin/src/routes/Configure/components/Configure.js +++ b/client/coral-admin/src/routes/Configure/components/Configure.js @@ -11,14 +11,6 @@ import PropTypes from 'prop-types'; export default class Configure extends Component { - state = { - activeSection: 'stream', - }; - - changeSection = (activeSection) => { - this.setState({activeSection}); - } - getSectionComponent(section) { switch(section){ case 'stream': @@ -32,9 +24,8 @@ export default class Configure extends Component { } render () { - const {activeSection} = this.state; + const {auth: {user}, canSave, savePending, setActiveSection, activeSection} = this.props; const SectionComponent = this.getSectionComponent(activeSection); - const {auth: {user}, canSave, savePending} = this.props; if (!can(user, 'UPDATE_CONFIG')) { return
You must be an administrator to access config settings. Please find the nearest Admin and ask them to level you up!
; @@ -43,7 +34,7 @@ export default class Configure extends Component { return (