Merge branch 'master' of https://github.com/LLK/scratch-www into hotfix/conference-livestream

* 'master' of https://github.com/LLK/scratch-www:
  Only redirect approved educators to My Classes
  Lint
  Add "Request Account" button to Educators landing
  Add `align` prop to `SubNavigation` component
This commit is contained in:
Matthew Taylor 2016-08-03 16:19:09 -04:00
commit 4a527fdd2e
6 changed files with 51 additions and 30 deletions

View file

@ -9,10 +9,21 @@ require('./subnavigation.scss');
*/ */
var SubNavigation = React.createClass({ var SubNavigation = React.createClass({
type: 'SubNavigation', type: 'SubNavigation',
getDefaultProps: function () {
return {
align: 'middle'
};
},
render: function () { render: function () {
var classes = classNames( var classes = classNames(
'sub-nav', [
this.props.className 'sub-nav',
this.props.className
],
{
'sub-nav-align-left': this.props.align === 'left',
'sub-nav-align-right': this.props.align === 'right'
}
); );
return ( return (
<div className={classes}> <div className={classes}>

View file

@ -53,4 +53,18 @@
} }
} }
} }
&.sub-nav-align-left {
justify-content: flex-start;
li {
&:first-child {
margin-left: 0;
}
}
}
&.sub-nav-align-right {
justify-content: flex-end;
}
} }

View file

@ -19,5 +19,5 @@
"teacherlanding.creativeComputing": "The <a href=\"http://scratched.gse.harvard.edu/guide/\">Creative Computing Curriculum Guide</a> provides plans, activities, and strategies for introducing creative computing.", "teacherlanding.creativeComputing": "The <a href=\"http://scratched.gse.harvard.edu/guide/\">Creative Computing Curriculum Guide</a> provides plans, activities, and strategies for introducing creative computing.",
"teacherlanding.accountsTitle": "Teacher Accounts in Scratch", "teacherlanding.accountsTitle": "Teacher Accounts in Scratch",
"teacherlanding.accountsDescription": "As an educator, you can request a Scratch Teacher Account, which makes it easier to create accounts for groups of students and to manage your students projects and comments. To learn more, see the <a href=\"/educators/faq\">Teacher Account FAQ page</a>.", "teacherlanding.accountsDescription": "As an educator, you can request a Scratch Teacher Account, which makes it easier to create accounts for groups of students and to manage your students projects and comments. To learn more, see the <a href=\"/educators/faq\">Teacher Account FAQ page</a>.",
"teacherlanding.accountsButton": "Coming Soon" "teacherlanding.requestAccount": "Request Account"
} }

View file

@ -109,7 +109,11 @@ var Landing = injectIntl(React.createClass({
<p> <p>
<FormattedHTMLMessage id="teacherlanding.accountsDescription" /> <FormattedHTMLMessage id="teacherlanding.accountsDescription" />
</p> </p>
<div className="coming-soon"><FormattedMessage id="teacherlanding.accountsButton" /></div> <SubNavigation className="teacher-account-buttons" align="left">
<a href="/educators/register">
<li><FormattedMessage id="teacherlanding.requestAccount" /></li>
</a>
</SubNavigation>
</div> </div>
<img src="/images/teachers/teacher-account.png" alt="teacher account" id="teacher-icon"/> <img src="/images/teachers/teacher-account.png" alt="teacher account" id="teacher-icon"/>
</div> </div>

View file

@ -220,6 +220,15 @@ $story-width: $cols3;
color: $ui-white; color: $ui-white;
} }
.teacher-account-buttons {
li {
border: 2px solid $ui-white;
padding: 16px;
font-size: 16px;
font-weight: 500;
}
}
#left { #left {
width: $cols4; width: $cols4;
max-width: $cols4; max-width: $cols4;
@ -229,24 +238,6 @@ $story-width: $cols3;
p { p {
margin-bottom: 3.5rem; margin-bottom: 3.5rem;
} }
.coming-soon {
border: 2px solid $ui-white;
border-radius: 50px;
box-shadow: none;
background-color: transparent;
padding: 16px 16px;
width: $cols5 / 2;
text-align: center;
color: $ui-white;
font-size: 16px;
font-weight: 500;
box-sizing: border-box;
&:hover {
box-shadow: none;
}
}
} }
img { img {

View file

@ -11,27 +11,28 @@ require('./teacherwaitingroom.scss');
var TeacherWaitingRoom = React.createClass({ var TeacherWaitingRoom = React.createClass({
displayName: 'TeacherWaitingRoom', displayName: 'TeacherWaitingRoom',
componentWillReceiveProps: function (nextProps) { componentWillReceiveProps: function (nextProps) {
if (nextProps.session.permissions.educator && nextProps.session.permissions.social) { if (nextProps.approved) {
window.location.href = '/educators/classes/'; window.location.href = '/educators/classes/';
} }
}, },
render: function () { render: function () {
var permissions = this.props.session.permissions || {};
var user = this.props.session.user || {};
return ( return (
<Deck className={classNames('teacher-waitingroom', this.props.className)}> <Deck className={classNames('teacher-waitingroom', this.props.className)}>
<TeacherApprovalStep confirmed={permissions.social} <TeacherApprovalStep {... this.props} />
invited={permissions.educator_invitee}
educator={permissions.educator}
email={user.email} />
</Deck> </Deck>
); );
} }
}); });
var mapStateToProps = function (state) { var mapStateToProps = function (state) {
var permissions = state.session.session.permissions || {};
var user = state.session.session.user || {};
return { return {
session: state.session.session approved: permissions && permissions.educator && !permissions.educator_invitee && permissions.social,
confirmed: permissions && permissions.social,
invited: permissions && permissions.educator_invitee,
educator: permissions && permissions.educator,
email: user && user.email
}; };
}; };