import React from 'react';
import Reflux from 'reflux';
import RefluxImmutableStoreMixin from 'reflux-immutable/StoreMixin';
import QandaStore from 'trc-client-core/src/qanda/QandaStore';   

import Col from 'trc-client-core/src/components/Col';
import Grid from 'trc-client-core/src/components/Grid';
import Sidebar from 'trc-client-core/src/qanda/QandaSidebar';
import Question from 'trc-client-core/src/qanda/Question';

var QuestionPage = React.createClass({
    displayName: 'QuestionPage',
    mixins: [
        Reflux.listenTo(QandaStore, 'onStoreChange'),
        RefluxImmutableStoreMixin
    ],
    getStoreState() {
        return {
            question: QandaStore.get('question')
        };
    },
    render() {
        console.log(this.state.question.toJS())
        return (
            <Grid>
                <Col width={7}>
                    <Question question={this.state.question} isActive={this.props.history.isActive} params={this.props.params} ></Question>
                </Col>
                <Col width={3}>
                    <Sidebar></Sidebar>
                </Col>               
            </Grid>
        ); 
    }
});

module.exports = QuestionPage;