Sha256: ef0db98ff3b5948090324cb3f006582090ef9f25d4cbd5686e71d84804516bfa

Contents?: true

Size: 1.65 KB

Versions: 17

Compression:

Stored size: 1.65 KB

Contents

var React = require('react');
var Mui = require('material-ui');
var ActivitiesGrid = require('./ActivitiesGrid');
var Footer = require('./Footer');

var Main = React.createClass({

    componentDidMount: function() {
        var self = this;

        // Get current configs
        nutella.net.request('configs/retrieve', 'all', function (response) {
            self.setConfigs(response);

            // Subscribe for future changes
            nutella.net.subscribe('configs/updated', function (message, from) {
                self.setConfigs(message);

            });

            // Get current selected config
            nutella.net.request('currentConfig/retrieve', '', function (response) {
                self.setCurrentConfig(response);

                // Subscribe for future changes
                nutella.net.subscribe('currentConfig/ack_updated', function (message, from) {
                    self.setCurrentConfig(message);
                });

            });

        });
    },

    getInitialState: function () {
        return  {
            currentConfig: '1',
            configs: []
        }
    },

    setConfigs: function(configs) {
        this.setState({
            configs: configs
        });
    },

    setCurrentConfig: function(config) {
        this.setState({
            currentConfig: config
        });
    },

    render: function () {

        return (

            <div className='main-div' >

                <ActivitiesGrid
                    configs={this.state.configs}
                    currentConfig={this.state.currentConfig} />

                <Footer />

            </div>

        );
    }

});

module.exports = Main;

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
nutella_framework-0.6.5 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.6.4 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.6.3 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.6.2 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.6.1 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.6.0 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.5.1 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.5.0 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.32 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.31 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.30 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.29 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.28 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.27 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.26 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.25 framework_components/roomcast-teacher-controls/src/app/components/main.js
nutella_framework-0.4.24 framework_components/roomcast-teacher-controls/src/app/components/main.js