Merge pull request #323 from mewtaylor/bugfix/readme-update

Added some more documentation
This commit is contained in:
Matthew Taylor 2016-01-19 16:11:49 -05:00
commit 2e79a5aa6b
11 changed files with 47 additions and 9 deletions

View file

@ -39,7 +39,7 @@ Use `^C` to stop the node process `npm start` starts.
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | | `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
| `FALLBACK` | `''` | Pass-through location for old site | | `FALLBACK` | `''` | Pass-through location for old site |
**NOTE:** Because by default both `API_HOST=https://api.scratch.mit.edu` and `FALLBACK=https://scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website. **NOTE:** Because by default `API_HOST=https://api.scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website.
### To Test ### To Test
```bash ```bash
@ -56,3 +56,5 @@ Most of the issues we have currently revolve around the use of `FALLBACK`. This
Setting `FALLBACK=https://scratch.mit.edu` allows the web client to retrieve data from the Scratch website in your development environment. However, because of security concerns, trying to send data to Scratch through your development environment won't work. This means the following things will be broken for the time being: Setting `FALLBACK=https://scratch.mit.edu` allows the web client to retrieve data from the Scratch website in your development environment. However, because of security concerns, trying to send data to Scratch through your development environment won't work. This means the following things will be broken for the time being:
* Login on the splash page (*In the process of being fixed*) * Login on the splash page (*In the process of being fixed*)
* Some update attempts to production data made through a development version of the web client * Some update attempts to production data made through a development version of the web client
Additionally, if you set `FALLBACK=https://scratch.mit.edu`, be aware that clicking on links to parts of the website not yet migrated over (currently such as `Explore`, `Discuss`, `Profile`, etc.) will take you to the Scratch website itself.

View file

@ -3,6 +3,10 @@ var React = require('react');
require('./banner.scss'); require('./banner.scss');
/**
* Container for messages displayed below the nav bar that can be dismissed
* (See: email not confirmed banner)
*/
var Banner = React.createClass({ var Banner = React.createClass({
type: 'Banner', type: 'Banner',
propTypes: { propTypes: {

View file

@ -9,6 +9,9 @@ require('slick-carousel/slick/slick.scss');
require('slick-carousel/slick/slick-theme.scss'); require('slick-carousel/slick/slick-theme.scss');
require('./carousel.scss'); require('./carousel.scss');
/**
* Displays content in horizontal scrolling box. Example usage: splash page rows.
*/
var Carousel = React.createClass({ var Carousel = React.createClass({
type: 'Carousel', type: 'Carousel',
propTypes: { propTypes: {

View file

@ -8,6 +8,9 @@ var Select = require('../forms/select.jsx');
require('./languagechooser.scss'); require('./languagechooser.scss');
/**
* Footer dropdown menu that allows one to change their language.
*/
var LanguageChooser = React.createClass({ var LanguageChooser = React.createClass({
type: 'LanguageChooser', type: 'LanguageChooser',
mixins: [ mixins: [

View file

@ -25,6 +25,9 @@ var defaultStyle = {
} }
}; };
/**
* Container for pop up windows (See: registration window)
*/
var Modal = React.createClass({ var Modal = React.createClass({
type: 'Modal', type: 'Modal',
statics: { statics: {

View file

@ -47,14 +47,14 @@ var Navigation = React.createClass({
loginOpen: false, loginOpen: false,
loginError: null, loginError: null,
registrationOpen: false, registrationOpen: false,
unreadMessageCount: 0, unreadMessageCount: 0, // bubble number to display how many notifications someone has.
messageCountIntervalId: -1 messageCountIntervalId: -1 // javascript method interval id for getting messsage count.
}; };
}, },
componentDidMount: function () { componentDidMount: function () {
if (this.state.session.user) { if (this.state.session.user) {
this.getMessageCount(); this.getMessageCount();
var intervalId = setInterval(this.getMessageCount, 120000); var intervalId = setInterval(this.getMessageCount, 120000); // check for new messages every 2 mins.
this.setState({'messageCountIntervalId': intervalId}); this.setState({'messageCountIntervalId': intervalId});
} }
}, },

View file

@ -3,6 +3,10 @@ var React = require('react');
require('./subnavigation.scss'); require('./subnavigation.scss');
/**
* Container for a custom, horizontal list of navigation elements
* that can be displayed within a view or component.
*/
var SubNavigation = React.createClass({ var SubNavigation = React.createClass({
type: 'SubNavigation', type: 'SubNavigation',
render: function () { render: function () {

View file

@ -2,6 +2,9 @@ var ReactIntl = require('react-intl');
var customLanguages = require('../../custom-locales.json'); var customLanguages = require('../../custom-locales.json');
/**
* Add custom locales to react-intl if it doesn't have them.
*/
for (var locale in customLanguages) { for (var locale in customLanguages) {
ReactIntl.addLocaleData(customLanguages[locale]); ReactIntl.addLocaleData(customLanguages[locale]);
} }

View file

@ -1,6 +1,14 @@
var cookie = require('cookie'); var cookie = require('cookie');
var xhr = require('xhr'); var xhr = require('xhr');
/**
* Module that handles coookie interactions.
* (Cookies?!?! Jar?!?! Get it?!?! WE'RE AMAZING!!!!)
*
* get(name, callback) can be sync or async, as callback is optional
* set(name, value) synchronously sets the cookie
* use(name, uri, callback) can by sync or async, gets cookie from the uri if not there.
*/
var Jar = {}; var Jar = {};
Jar.get = function (name, callback) { Jar.get = function (name, callback) {

View file

@ -6,6 +6,14 @@ var log = require('../lib/log.js');
var CookieMixinFactory = require('./cookieMixinFactory.jsx'); var CookieMixinFactory = require('./cookieMixinFactory.jsx');
/**
* Component mixin that constructs requests to the scratch api.
* Custom arguments:
* - useCsrf [boolean] handles unique csrf token retrieval for POST requests. This prevents
* CSRF forgeries (see: https://www.squarefree.com/securitytips/web-developers.html#CSRF)
*
* It also takes in other arguments specified in the xhr library spec.
*/
var Api = { var Api = {
mixins: [ mixins: [
// Provides useScratchcsrftoken // Provides useScratchcsrftoken

View file

@ -28,11 +28,11 @@ var Splash = injectIntl(React.createClass({
getInitialState: function () { getInitialState: function () {
return { return {
projectCount: 10569070, projectCount: 10569070,
activity: [], activity: [], // recent social actions taken by users someone is following
news: [], news: [], // gets news posts from the scratch Tumblr
featuredCustom: {}, featuredCustom: {}, // custom homepage rows, such as "Projects by Scratchers I'm Following"
featuredGlobal: {}, featuredGlobal: {}, // global homepage rows, such as "Featured Projects"
showEmailConfirmationModal: false, showEmailConfirmationModal: false, // flag that determines whether to show banner to request email conf.
refreshCacheStatus: 'notrequested' refreshCacheStatus: 'notrequested'
}; };
}, },