0
0
Fork 0

Refactor initial state: "me" (#5563)

* Refactor initial state: "me"

* remove "me" from reducers/meta.js
This commit is contained in:
Nolan Lawson 2017-10-30 19:27:48 -07:00 committed by Yamagishi Kazutoshi
parent 29609fbb6a
commit b254e6ca5f
24 changed files with 44 additions and 60 deletions

View file

@ -11,6 +11,7 @@ import Search from '../../compose/components/search';
import NavigationBar from '../../compose/components/navigation_bar';
import ColumnHeader from './column_header';
import { List as ImmutableList } from 'immutable';
import { me } from '../../../initial_state';
const noop = () => { };
@ -40,11 +41,11 @@ PageOne.propTypes = {
domain: PropTypes.string.isRequired,
};
const PageTwo = ({ me }) => (
const PageTwo = ({ myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-two'>
<div className='figure non-interactive'>
<div className='pseudo-drawer'>
<NavigationBar account={me} />
<NavigationBar account={myAccount} />
</div>
<ComposeForm
text='Awoo! #introductions'
@ -68,10 +69,10 @@ const PageTwo = ({ me }) => (
);
PageTwo.propTypes = {
me: ImmutablePropTypes.map.isRequired,
myAccount: ImmutablePropTypes.map.isRequired,
};
const PageThree = ({ me }) => (
const PageThree = ({ myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-three'>
<div className='figure non-interactive'>
<Search
@ -83,7 +84,7 @@ const PageThree = ({ me }) => (
/>
<div className='pseudo-drawer'>
<NavigationBar account={me} />
<NavigationBar account={myAccount} />
</div>
</div>
@ -93,7 +94,7 @@ const PageThree = ({ me }) => (
);
PageThree.propTypes = {
me: ImmutablePropTypes.map.isRequired,
myAccount: ImmutablePropTypes.map.isRequired,
};
const PageFour = ({ domain, intl }) => (
@ -161,7 +162,7 @@ PageSix.propTypes = {
};
const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
myAccount: state.getIn(['accounts', me]),
admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
domain: state.getIn(['meta', 'domain']),
});
@ -173,7 +174,7 @@ export default class OnboardingModal extends React.PureComponent {
static propTypes = {
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired,
myAccount: ImmutablePropTypes.map.isRequired,
domain: PropTypes.string.isRequired,
admin: ImmutablePropTypes.map,
};
@ -183,11 +184,11 @@ export default class OnboardingModal extends React.PureComponent {
};
componentWillMount() {
const { me, admin, domain, intl } = this.props;
const { myAccount, admin, domain, intl } = this.props;
this.pages = [
<PageOne acct={me.get('acct')} domain={domain} />,
<PageTwo me={me} />,
<PageThree me={me} />,
<PageOne acct={myAccount.get('acct')} domain={domain} />,
<PageTwo myAccount={myAccount} />,
<PageThree myAccount={myAccount} />,
<PageFour domain={domain} intl={intl} />,
<PageSix admin={admin} domain={domain} />,
];