Этот коммит содержится в:
Saturnino Abril
2017-07-06 04:21:04 +08:00
коммит произвёл Joram Wilander
родитель 4efb0f37b7
Коммит 81a893b556
10 изменённых файлов: 155 добавлений и 82 удалений

Просмотреть файл

@@ -31,18 +31,22 @@ export default class ChannelView extends React.Component {
this.state = this.getStateFromStores(props);
}
getStateFromStores() {
return {
channelId: ChannelStore.getCurrentId(),
tutorialStep: PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999)
};
}
isStateValid() {
return this.state.channelId !== '';
}
updateState() {
this.setState(this.getStateFromStores(this.props));
}
componentDidMount() {
ChannelStore.addChangeListener(this.updateState);
@@ -53,14 +57,17 @@ export default class ChannelView extends React.Component {
$('body').addClass('browser--ie');
}
}
componentWillUnmount() {
ChannelStore.removeChangeListener(this.updateState);
$('body').removeClass('app__body');
}
componentWillReceiveProps(nextProps) {
this.setState(this.getStateFromStores(nextProps));
}
shouldComponentUpdate(nextProps, nextState) {
if (!Utils.areObjectsEqual(nextProps.params, this.props.params)) {
return true;
@@ -72,6 +79,11 @@ export default class ChannelView extends React.Component {
return false;
}
getChannelView = () => {
return this.refs.channelView;
}
render() {
if (this.state.tutorialStep <= TutorialSteps.INTRO_SCREENS) {
return (<TutorialView/>);
@@ -79,6 +91,7 @@ export default class ChannelView extends React.Component {
return (
<div
ref='channelView'
id='app-content'
className='app__content'
>
@@ -93,7 +106,7 @@ export default class ChannelView extends React.Component {
className='post-create__container'
id='post-create'
>
<CreatePost/>
<CreatePost getChannelView={this.getChannelView}/>
</div>
</div>
);