diff --git a/src/components/activity/activity.jsx b/src/components/activity/activity.jsx index 7d585e5c8..4e55441a9 100644 --- a/src/components/activity/activity.jsx +++ b/src/components/activity/activity.jsx @@ -6,6 +6,7 @@ var Format = require('../../lib/format.js'); require('./activity.scss'); var Activity = React.createClass({ + type: 'Activity', propTypes: { items: React.PropTypes.array }, diff --git a/src/components/avatar/avatar.jsx b/src/components/avatar/avatar.jsx index 2cf6ab3a0..5830e5ffb 100644 --- a/src/components/avatar/avatar.jsx +++ b/src/components/avatar/avatar.jsx @@ -2,6 +2,7 @@ var React = require('react'); var classNames = require('classnames'); var Avatar = React.createClass({ + type: 'Avatar', propTypes: { src: React.PropTypes.string }, diff --git a/src/components/box/box.jsx b/src/components/box/box.jsx index 1d6695842..dbb033697 100644 --- a/src/components/box/box.jsx +++ b/src/components/box/box.jsx @@ -3,6 +3,7 @@ var React = require('react'); require('./box.scss'); var Box = React.createClass({ + type: 'Box', propTypes: { title: React.PropTypes.string.isRequired, moreTitle: React.PropTypes.string, diff --git a/src/components/carousel/carousel.jsx b/src/components/carousel/carousel.jsx index 00c6beb52..3f475a1cb 100644 --- a/src/components/carousel/carousel.jsx +++ b/src/components/carousel/carousel.jsx @@ -7,6 +7,7 @@ require('slick-carousel/slick/slick-theme.scss'); require('./carousel.scss'); var Carousel = React.createClass({ + type: 'Carousel', propTypes: { items: React.PropTypes.array }, diff --git a/src/components/footer/footer.jsx b/src/components/footer/footer.jsx index f5b604846..7e2594627 100644 --- a/src/components/footer/footer.jsx +++ b/src/components/footer/footer.jsx @@ -3,6 +3,7 @@ var React = require('react'); require('./footer.scss'); var Footer = React.createClass({ + type: 'Footer', render: function () { return (
diff --git a/src/components/forms/button.jsx b/src/components/forms/button.jsx index a27053040..2c12d7db7 100644 --- a/src/components/forms/button.jsx +++ b/src/components/forms/button.jsx @@ -4,6 +4,7 @@ var classNames = require('classnames'); require('./button.scss'); var Button = React.createClass({ + type: 'Button', propTypes: { }, diff --git a/src/components/forms/input.jsx b/src/components/forms/input.jsx index 3577bd876..e35a09e2e 100644 --- a/src/components/forms/input.jsx +++ b/src/components/forms/input.jsx @@ -4,6 +4,7 @@ var classNames = require('classnames'); require('./input.scss'); var Input = React.createClass({ + type: 'Input', propTypes: { }, diff --git a/src/components/intro/intro.jsx b/src/components/intro/intro.jsx index 12738200c..98ac2c250 100644 --- a/src/components/intro/intro.jsx +++ b/src/components/intro/intro.jsx @@ -6,6 +6,7 @@ require('./intro.scss'); Modal.setAppElement(document.getElementById('view')); var Intro = React.createClass({ + type: 'Intro', propTypes: { projectCount: React.PropTypes.number }, diff --git a/src/components/login/login.jsx b/src/components/login/login.jsx index af69c8914..da65adcf7 100644 --- a/src/components/login/login.jsx +++ b/src/components/login/login.jsx @@ -5,6 +5,7 @@ var Button = require('../forms/button.jsx'); require('./login.scss'); var Login = React.createClass({ + type: 'Login', propTypes: { onLogIn: React.PropTypes.func, error: React.PropTypes.string diff --git a/src/components/modal/modal.jsx b/src/components/modal/modal.jsx index 43cfcf388..aceaedd5c 100644 --- a/src/components/modal/modal.jsx +++ b/src/components/modal/modal.jsx @@ -5,6 +5,7 @@ require('./modal.scss'); var Modal = React.createClass({ + type: 'Modal', statics: { setAppElement: ReactModal.setAppElement }, diff --git a/src/components/navigation/dropdown.jsx b/src/components/navigation/dropdown.jsx index 951808680..83990264b 100644 --- a/src/components/navigation/dropdown.jsx +++ b/src/components/navigation/dropdown.jsx @@ -4,6 +4,7 @@ var classNames = require('classnames'); require('./dropdown.scss'); var Dropdown = React.createClass({ + type: 'Dropdown', mixins: [ require('react-onclickoutside') ], diff --git a/src/components/navigation/navigation.jsx b/src/components/navigation/navigation.jsx index 685de3076..40adb528b 100644 --- a/src/components/navigation/navigation.jsx +++ b/src/components/navigation/navigation.jsx @@ -15,6 +15,7 @@ var Login = require('../login/login.jsx'); require('./navigation.scss'); var Navigation = React.createClass({ + type: 'Navigation', mixins: [ Api, Session diff --git a/src/components/news/news.jsx b/src/components/news/news.jsx index b123ee51f..f241ac955 100644 --- a/src/components/news/news.jsx +++ b/src/components/news/news.jsx @@ -5,6 +5,7 @@ var Box = require('../box/box.jsx'); require('./news.scss'); var News = React.createClass({ + type: 'News', propTypes: { items: React.PropTypes.array }, diff --git a/src/components/thumbnail/thumbnail.jsx b/src/components/thumbnail/thumbnail.jsx index 9e4acf0eb..b078776da 100644 --- a/src/components/thumbnail/thumbnail.jsx +++ b/src/components/thumbnail/thumbnail.jsx @@ -4,6 +4,7 @@ var classNames = require('classnames'); require('./thumbnail.scss'); var Thumbnail = React.createClass({ + type: 'Thumbnail', propTypes: { src: React.PropTypes.string }, diff --git a/src/environment.js b/src/environment.js index ff3e2d7c4..dc05b740b 100644 --- a/src/environment.js +++ b/src/environment.js @@ -1,4 +1,5 @@ var Environment = { + NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'), API_HOST: JSON.stringify(process.env.API_HOST || 'https://api-staging.scratch.mit.edu') }; diff --git a/src/lib/renderer.jsx b/src/lib/renderer.jsx new file mode 100644 index 000000000..ec3209ef4 --- /dev/null +++ b/src/lib/renderer.jsx @@ -0,0 +1,13 @@ +var React = require('react'); + +var Renderer = { + render: function (jsx, toElement) { + var rendered = React.render(jsx, toElement); + if (process.env.NODE_ENV != 'production') { + window.renderedComponents = window.renderedComponents || []; + window.renderedComponents.push(rendered); + } + } +}; + +module.exports = Renderer; diff --git a/src/main.jsx b/src/main.jsx index 9845b0ad1..8372f839a 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,9 +1,9 @@ -var React = require('react'); +var Renderer = require('./lib/renderer.jsx'); require('./main.scss'); var Navigation = require('./components/navigation/navigation.jsx'); var Footer = require('./components/footer/footer.jsx'); -React.render(, document.getElementById('navigation')); -React.render(