2018-01-30 11:53:12 -05:00
|
|
|
const bindAll = require('lodash.bindall');
|
|
|
|
const connect = require('react-redux').connect;
|
|
|
|
const PropTypes = require('prop-types');
|
|
|
|
const React = require('react');
|
2015-10-21 14:12:34 -04:00
|
|
|
|
2018-01-30 11:53:12 -05:00
|
|
|
const sessionActions = require('../../redux/session.js');
|
2016-03-18 11:51:22 -04:00
|
|
|
|
2018-01-30 11:53:12 -05:00
|
|
|
const IframeModal = require('../modal/iframe/modal.jsx');
|
|
|
|
const Registration = require('../registration/registration.jsx');
|
2015-09-09 22:16:03 -04:00
|
|
|
|
|
|
|
require('./intro.scss');
|
|
|
|
|
2018-01-30 11:53:12 -05:00
|
|
|
class Intro extends React.Component {
|
|
|
|
constructor (props) {
|
|
|
|
super(props);
|
|
|
|
bindAll(this, [
|
|
|
|
'handleShowVideo',
|
|
|
|
'handleCloseVideo',
|
|
|
|
'handleJoinClick',
|
|
|
|
'handleCloseRegistration',
|
|
|
|
'handleCompleteRegistration'
|
|
|
|
]);
|
|
|
|
this.state = {
|
2015-09-09 22:16:03 -04:00
|
|
|
videoOpen: false
|
|
|
|
};
|
2018-01-30 11:53:12 -05:00
|
|
|
}
|
|
|
|
handleShowVideo () {
|
2015-09-09 22:16:03 -04:00
|
|
|
this.setState({videoOpen: true});
|
2018-01-30 11:53:12 -05:00
|
|
|
}
|
|
|
|
handleCloseVideo () {
|
2015-09-09 22:16:03 -04:00
|
|
|
this.setState({videoOpen: false});
|
2018-01-30 11:53:12 -05:00
|
|
|
}
|
|
|
|
handleJoinClick (e) {
|
2015-10-23 08:32:56 -04:00
|
|
|
e.preventDefault();
|
2018-01-30 11:53:12 -05:00
|
|
|
this.setState({registrationOpen: true});
|
|
|
|
}
|
|
|
|
handleCloseRegistration () {
|
|
|
|
this.setState({registrationOpen: false});
|
|
|
|
}
|
|
|
|
handleCompleteRegistration () {
|
2016-05-19 16:55:25 -04:00
|
|
|
this.props.dispatch(sessionActions.refreshSession());
|
2015-10-23 08:32:56 -04:00
|
|
|
this.closeRegistration();
|
2018-01-30 11:53:12 -05:00
|
|
|
}
|
|
|
|
render () {
|
2015-09-09 22:16:03 -04:00
|
|
|
return (
|
2015-09-11 09:43:10 -04:00
|
|
|
<div className="intro">
|
2015-09-09 22:16:03 -04:00
|
|
|
<div className="content">
|
2018-01-30 11:53:12 -05:00
|
|
|
<h1
|
|
|
|
dangerouslySetInnerHTML={{ // eslint-disable-line react/no-danger
|
|
|
|
__html: this.props.messages['intro.tagLine']
|
|
|
|
}}
|
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
<div className="sprites">
|
2018-01-30 11:53:12 -05:00
|
|
|
<a
|
|
|
|
className="sprite sprite-1"
|
|
|
|
href="/projects/editor/?tip_bar=getStarted"
|
|
|
|
>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Scratch Cat"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-1"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/cat-a.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Scratch Cat"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-2"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/cat-b.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
|
|
|
<div className="circle" />
|
2015-10-16 11:04:01 -04:00
|
|
|
<div className="text">
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.tryItOut']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</div>
|
2015-09-09 22:16:03 -04:00
|
|
|
</a>
|
2018-01-30 11:53:12 -05:00
|
|
|
<a
|
|
|
|
className="sprite sprite-2"
|
|
|
|
href="/starter_projects/"
|
|
|
|
>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Tera"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-1"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/tera-a.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Tera"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-2"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/tera-b.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
|
|
|
<div className="circle" />
|
2015-10-16 11:04:01 -04:00
|
|
|
<div className="text">
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.seeExamples']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</div>
|
2015-09-09 22:16:03 -04:00
|
|
|
</a>
|
2018-01-30 11:53:12 -05:00
|
|
|
<a
|
|
|
|
className="sprite sprite-3"
|
|
|
|
href="#"
|
|
|
|
onClick={this.handleJoinClick}
|
|
|
|
>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Gobo"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-1"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/gobo-a.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
<img
|
2018-01-30 11:53:12 -05:00
|
|
|
alt="Gobo"
|
2015-09-11 09:43:10 -04:00
|
|
|
className="costume costume-2"
|
2016-01-25 08:30:10 -05:00
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/gobo-b.png"
|
2018-01-30 11:53:12 -05:00
|
|
|
/>
|
|
|
|
<div className="circle" />
|
2015-10-16 11:04:01 -04:00
|
|
|
<div className="text">
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.joinScratch']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</div>
|
2017-10-23 11:11:33 -04:00
|
|
|
<div className="text subtext">{this.props.messages['intro.itsFree']}</div>
|
2015-09-09 22:16:03 -04:00
|
|
|
</a>
|
2018-01-30 11:53:12 -05:00
|
|
|
<Registration
|
|
|
|
isOpen={this.state.registrationOpen}
|
|
|
|
key="registration"
|
|
|
|
onRegistrationDone={this.handleCompleteRegistration}
|
|
|
|
onRequestClose={this.handleCloseRegistration}
|
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
</div>
|
2018-01-30 11:53:12 -05:00
|
|
|
<div
|
|
|
|
className="description"
|
|
|
|
dangerouslySetInnerHTML={{ // eslint-disable-line react/no-danger
|
|
|
|
__html: this.props.messages['intro.description']
|
|
|
|
}}
|
|
|
|
/>
|
2015-09-11 09:43:10 -04:00
|
|
|
<div className="links">
|
2015-10-16 11:04:01 -04:00
|
|
|
<a href="/about/">
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.aboutScratch']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</a>
|
|
|
|
<a href="/educators/">
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.forEducators']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</a>
|
2018-01-30 11:53:12 -05:00
|
|
|
<a
|
|
|
|
className="last"
|
|
|
|
href="/parents/"
|
|
|
|
>
|
2016-01-07 09:57:34 -05:00
|
|
|
{this.props.messages['intro.forParents']}
|
2015-10-16 11:04:01 -04:00
|
|
|
</a>
|
2015-09-09 22:16:03 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-09-11 09:43:10 -04:00
|
|
|
<div className="video">
|
2018-01-30 11:53:12 -05:00
|
|
|
<div
|
|
|
|
className="play-button"
|
|
|
|
onClick={this.handleShowVideo}
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
alt="Intro Video"
|
|
|
|
src="//cdn.scratch.mit.edu/scratchr2/static/images/hp-video-screenshot.png"
|
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
</div>
|
2016-11-08 14:43:10 -05:00
|
|
|
<IframeModal
|
|
|
|
className="mod-intro-video"
|
|
|
|
isOpen={this.state.videoOpen}
|
|
|
|
src="//player.vimeo.com/video/65583694?title=0&byline=0&portrait=0"
|
2018-01-30 11:53:12 -05:00
|
|
|
onRequestClose={this.handleCloseVideo}
|
2016-11-08 14:43:10 -05:00
|
|
|
/>
|
2015-09-09 22:16:03 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2018-01-30 11:53:12 -05:00
|
|
|
}
|
2016-03-18 11:51:22 -04:00
|
|
|
|
2018-01-30 11:53:12 -05:00
|
|
|
Intro.propTypes = {
|
|
|
|
dispatch: PropTypes.func.isRequired,
|
|
|
|
messages: PropTypes.shape({
|
|
|
|
'intro.aboutScratch': PropTypes.string,
|
|
|
|
'intro.forEducators': PropTypes.string,
|
|
|
|
'intro.forParents': PropTypes.string,
|
|
|
|
'intro.itsFree': PropTypes.string,
|
|
|
|
'intro.joinScratch': PropTypes.string,
|
|
|
|
'intro.seeExamples': PropTypes.string,
|
|
|
|
'intro.tagLine': PropTypes.string,
|
|
|
|
'intro.tryItOut': PropTypes.string,
|
|
|
|
'intro.description': PropTypes.string
|
|
|
|
})
|
2018-01-19 14:06:26 -05:00
|
|
|
};
|
|
|
|
|
2018-01-30 11:53:12 -05:00
|
|
|
Intro.defaultProps = {
|
|
|
|
messages: {
|
|
|
|
'intro.aboutScratch': 'ABOUT SCRATCH',
|
|
|
|
'intro.forEducators': 'FOR EDUCATORS',
|
|
|
|
'intro.forParents': 'FOR PARENTS',
|
|
|
|
'intro.itsFree': 'it\'s free!',
|
|
|
|
'intro.joinScratch': 'JOIN SCRATCH',
|
|
|
|
'intro.seeExamples': 'SEE EXAMPLES',
|
|
|
|
'intro.tagLine': 'Create stories, games, and animations<br /> Share with others around the world',
|
|
|
|
'intro.tryItOut': 'TRY IT OUT',
|
|
|
|
'intro.description': 'A creative learning community with <span class="project-count"> ' +
|
|
|
|
'over 14 million </span>projects shared'
|
|
|
|
},
|
|
|
|
session: {}
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
session: state.session
|
|
|
|
});
|
|
|
|
|
|
|
|
const ConnectedIntro = connect(mapStateToProps)(Intro);
|
2016-03-18 11:51:22 -04:00
|
|
|
|
|
|
|
module.exports = ConnectedIntro;
|