mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
initial pass
This commit is contained in:
parent
d645e95bd7
commit
e402363576
3 changed files with 114 additions and 109 deletions
|
@ -225,99 +225,101 @@ var Navigation = React.createClass({
|
||||||
<Input type="hidden" name="sort_by" value="datetime_shared" />
|
<Input type="hidden" name="sort_by" value="datetime_shared" />
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
{this.props.session.user ? [
|
{this.props.session.loaded ? (
|
||||||
<li className="link right messages" key="messages">
|
this.props.session.user ? [
|
||||||
<a
|
<li className="link right messages" key="messages">
|
||||||
href="/messages/"
|
<a
|
||||||
title={formatMessage({id: 'general.messages'})}>
|
href="/messages/"
|
||||||
|
title={formatMessage({id: 'general.messages'})}>
|
||||||
|
|
||||||
<span className={messageClasses}>{this.state.unreadMessageCount}</span>
|
<span className={messageClasses}>{this.state.unreadMessageCount}</span>
|
||||||
<FormattedMessage id="general.messages" />
|
<FormattedMessage id="general.messages" />
|
||||||
</a>
|
</a>
|
||||||
</li>,
|
</li>,
|
||||||
<li className="link right mystuff" key="mystuff">
|
<li className="link right mystuff" key="mystuff">
|
||||||
<a
|
<a
|
||||||
href="/mystuff/"
|
href="/mystuff/"
|
||||||
title={formatMessage({id: 'general.myStuff'})}>
|
title={formatMessage({id: 'general.myStuff'})}>
|
||||||
|
|
||||||
<FormattedMessage id="general.myStuff" />
|
<FormattedMessage id="general.myStuff" />
|
||||||
</a>
|
</a>
|
||||||
</li>,
|
</li>,
|
||||||
<li className="link right account-nav" key="account-nav">
|
<li className="link right account-nav" key="account-nav">
|
||||||
<a className="user-info" href="#" onClick={this.handleAccountNavClick}>
|
<a className="user-info" href="#" onClick={this.handleAccountNavClick}>
|
||||||
<Avatar src={this.props.session.user.thumbnailUrl} alt="" />
|
<Avatar src={this.props.session.user.thumbnailUrl} alt="" />
|
||||||
{this.props.session.user.username}
|
{this.props.session.user.username}
|
||||||
</a>
|
</a>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
as="ul"
|
as="ul"
|
||||||
isOpen={this.state.accountNavOpen}
|
isOpen={this.state.accountNavOpen}
|
||||||
onRequestClose={this.closeAccountNav}>
|
onRequestClose={this.closeAccountNav}>
|
||||||
<li>
|
|
||||||
<a href={this.getProfileUrl()}>
|
|
||||||
<FormattedMessage id="general.profile" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="/mystuff/">
|
|
||||||
<FormattedMessage id="general.myStuff" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{this.props.session.permissions.educator ? [
|
|
||||||
<li>
|
<li>
|
||||||
<a href="/educators/classes/">
|
<a href={this.getProfileUrl()}>
|
||||||
<FormattedMessage id="general.myClasses" />
|
<FormattedMessage id="general.profile" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
] : []}
|
|
||||||
{this.props.session.permissions.student ? [
|
|
||||||
<li>
|
<li>
|
||||||
<a href={'/classes/' + this.props.session.user.classroomId + '/'}>
|
<a href="/mystuff/">
|
||||||
<FormattedMessage id="general.myClass" />
|
<FormattedMessage id="general.myStuff" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
] : []}
|
{this.props.session.permissions.educator ? [
|
||||||
<li>
|
<li>
|
||||||
<a href="/accounts/settings/">
|
<a href="/educators/classes/">
|
||||||
<FormattedMessage id="general.accountSettings" />
|
<FormattedMessage id="general.myClasses" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="divider">
|
] : []}
|
||||||
<a href="#" onClick={this.handleLogOut}>
|
{this.props.session.permissions.student ? [
|
||||||
<FormattedMessage id="navigation.signOut" />
|
<li>
|
||||||
</a>
|
<a href={'/classes/' + this.props.session.user.classroomId + '/'}>
|
||||||
</li>
|
<FormattedMessage id="general.myClass" />
|
||||||
</Dropdown>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
] : [
|
] : []}
|
||||||
<li className="link right join" key="join">
|
<li>
|
||||||
<a href="#" onClick={this.handleJoinClick}>
|
<a href="/accounts/settings/">
|
||||||
<FormattedMessage id="general.joinScratch" />
|
<FormattedMessage id="general.accountSettings" />
|
||||||
</a>
|
</a>
|
||||||
</li>,
|
</li>
|
||||||
<Registration
|
<li className="divider">
|
||||||
key="registration"
|
<a href="#" onClick={this.handleLogOut}>
|
||||||
isOpen={this.state.registrationOpen}
|
<FormattedMessage id="navigation.signOut" />
|
||||||
onRequestClose={this.closeRegistration}
|
</a>
|
||||||
onRegistrationDone={this.completeRegistration} />,
|
</li>
|
||||||
<li className="link right login-item" key="login">
|
</Dropdown>
|
||||||
<a
|
</li>
|
||||||
href="#"
|
] : [
|
||||||
onClick={this.handleLoginClick}
|
<li className="link right join" key="join">
|
||||||
className="ignore-react-onclickoutside"
|
<a href="#" onClick={this.handleJoinClick}>
|
||||||
key="login-link">
|
<FormattedMessage id="general.joinScratch" />
|
||||||
<FormattedMessage id="general.signIn" />
|
</a>
|
||||||
</a>
|
</li>,
|
||||||
<Dropdown
|
<Registration
|
||||||
className="login-dropdown with-arrow"
|
key="registration"
|
||||||
isOpen={this.state.loginOpen}
|
isOpen={this.state.registrationOpen}
|
||||||
onRequestClose={this.closeLogin}
|
onRequestClose={this.closeRegistration}
|
||||||
key="login-dropdown">
|
onRegistrationDone={this.completeRegistration} />,
|
||||||
<Login
|
<li className="link right login-item" key="login">
|
||||||
onLogIn={this.handleLogIn}
|
<a
|
||||||
error={this.state.loginError} />
|
href="#"
|
||||||
</Dropdown>
|
onClick={this.handleLoginClick}
|
||||||
</li>
|
className="ignore-react-onclickoutside"
|
||||||
]}
|
key="login-link">
|
||||||
|
<FormattedMessage id="general.signIn" />
|
||||||
|
</a>
|
||||||
|
<Dropdown
|
||||||
|
className="login-dropdown with-arrow"
|
||||||
|
isOpen={this.state.loginOpen}
|
||||||
|
onRequestClose={this.closeLogin}
|
||||||
|
key="login-dropdown">
|
||||||
|
<Login
|
||||||
|
onLogIn={this.handleLogIn}
|
||||||
|
error={this.state.loginError} />
|
||||||
|
</Dropdown>
|
||||||
|
</li>
|
||||||
|
]) : [
|
||||||
|
]}
|
||||||
</ul>
|
</ul>
|
||||||
<Modal isOpen={this.state.canceledDeletionOpen}
|
<Modal isOpen={this.state.canceledDeletionOpen}
|
||||||
onRequestClose={this.closeCanceledDeletion}
|
onRequestClose={this.closeCanceledDeletion}
|
||||||
|
|
|
@ -32,6 +32,7 @@ module.exports.setSessionError = function (error) {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.setSession = function (session) {
|
module.exports.setSession = function (session) {
|
||||||
|
session.loaded = true;
|
||||||
return {
|
return {
|
||||||
type: Types.SET_SESSION,
|
type: Types.SET_SESSION,
|
||||||
session: session
|
session: session
|
||||||
|
|
|
@ -206,7 +206,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
|
|
||||||
if (this.state.featuredGlobal.curator_top_projects &&
|
if (this.state.featuredGlobal.curator_top_projects &&
|
||||||
this.state.featuredGlobal.curator_top_projects.length > 4) {
|
this.state.featuredGlobal.curator_top_projects.length > 4) {
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<Box
|
<Box
|
||||||
key="curator_top_projects"
|
key="curator_top_projects"
|
||||||
|
@ -223,7 +223,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
|
|
||||||
if (this.state.featuredGlobal.scratch_design_studio &&
|
if (this.state.featuredGlobal.scratch_design_studio &&
|
||||||
this.state.featuredGlobal.scratch_design_studio.length > 4) {
|
this.state.featuredGlobal.scratch_design_studio.length > 4) {
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<Box
|
<Box
|
||||||
key="scratch_design_studio"
|
key="scratch_design_studio"
|
||||||
|
@ -243,7 +243,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
if (this.props.session.user &&
|
if (this.props.session.user &&
|
||||||
this.state.featuredGlobal.community_newest_projects &&
|
this.state.featuredGlobal.community_newest_projects &&
|
||||||
this.state.featuredGlobal.community_newest_projects.length > 0) {
|
this.state.featuredGlobal.community_newest_projects.length > 0) {
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<Box
|
<Box
|
||||||
title={
|
title={
|
||||||
|
@ -259,14 +259,14 @@ var Splash = injectIntl(React.createClass({
|
||||||
|
|
||||||
if (this.state.featuredCustom.custom_projects_by_following &&
|
if (this.state.featuredCustom.custom_projects_by_following &&
|
||||||
this.state.featuredCustom.custom_projects_by_following.length > 0) {
|
this.state.featuredCustom.custom_projects_by_following.length > 0) {
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<Box title={
|
<Box title={
|
||||||
formatMessage({
|
formatMessage({
|
||||||
id: 'splash.projectsByScratchersFollowing',
|
id: 'splash.projectsByScratchersFollowing',
|
||||||
defaultMessage: 'Projects by Scratchers I\'m Following'})}
|
defaultMessage: 'Projects by Scratchers I\'m Following'})}
|
||||||
key="custom_projects_by_following">
|
key="custom_projects_by_following">
|
||||||
|
|
||||||
<Carousel items={this.state.featuredCustom.custom_projects_by_following} />
|
<Carousel items={this.state.featuredCustom.custom_projects_by_following} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -280,7 +280,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
id: 'splash.projectsLovedByScratchersFollowing',
|
id: 'splash.projectsLovedByScratchersFollowing',
|
||||||
defaultMessage: 'Projects Loved by Scratchers I\'m Following'})}
|
defaultMessage: 'Projects Loved by Scratchers I\'m Following'})}
|
||||||
key="custom_projects_loved_by_following">
|
key="custom_projects_loved_by_following">
|
||||||
|
|
||||||
<Carousel items={this.state.featuredCustom.custom_projects_loved_by_following} />
|
<Carousel items={this.state.featuredCustom.custom_projects_loved_by_following} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -288,14 +288,14 @@ var Splash = injectIntl(React.createClass({
|
||||||
|
|
||||||
if (this.state.featuredCustom.custom_projects_in_studios_following &&
|
if (this.state.featuredCustom.custom_projects_in_studios_following &&
|
||||||
this.state.featuredCustom.custom_projects_in_studios_following.length > 0) {
|
this.state.featuredCustom.custom_projects_in_studios_following.length > 0) {
|
||||||
|
|
||||||
rows.push(
|
rows.push(
|
||||||
<Box title={
|
<Box title={
|
||||||
formatMessage({
|
formatMessage({
|
||||||
id:'splash.projectsInStudiosFollowing',
|
id:'splash.projectsInStudiosFollowing',
|
||||||
defaultMessage: 'Projects in Studios I\'m Following'})}
|
defaultMessage: 'Projects in Studios I\'m Following'})}
|
||||||
key="custom_projects_in_studios_following">
|
key="custom_projects_in_studios_following">
|
||||||
|
|
||||||
<Carousel items={this.state.featuredCustom.custom_projects_in_studios_following} />
|
<Carousel items={this.state.featuredCustom.custom_projects_in_studios_following} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -307,7 +307,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
id: 'splash.communityRemixing',
|
id: 'splash.communityRemixing',
|
||||||
defaultMessage: 'What the Community is Remixing' })}
|
defaultMessage: 'What the Community is Remixing' })}
|
||||||
key="community_most_remixed_projects">
|
key="community_most_remixed_projects">
|
||||||
|
|
||||||
<Carousel items={this.state.featuredGlobal.community_most_remixed_projects} showRemixes={true} />
|
<Carousel items={this.state.featuredGlobal.community_most_remixed_projects} showRemixes={true} />
|
||||||
</Box>,
|
</Box>,
|
||||||
<Box title={
|
<Box title={
|
||||||
|
@ -315,7 +315,7 @@ var Splash = injectIntl(React.createClass({
|
||||||
id: 'splash.communityLoving',
|
id: 'splash.communityLoving',
|
||||||
defaultMessage: 'What the Community is Loving' })}
|
defaultMessage: 'What the Community is Loving' })}
|
||||||
key="community_most_loved_projects">
|
key="community_most_loved_projects">
|
||||||
|
|
||||||
<Carousel items={this.state.featuredGlobal.community_most_loved_projects} showLoves={true} />
|
<Carousel items={this.state.featuredGlobal.community_most_loved_projects} showLoves={true} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -373,20 +373,22 @@ var Splash = injectIntl(React.createClass({
|
||||||
] : []}
|
] : []}
|
||||||
<CNBanner />
|
<CNBanner />
|
||||||
<div key="inner" className="inner">
|
<div key="inner" className="inner">
|
||||||
{this.props.session.user ? [
|
{this.props.session.user ? (
|
||||||
<div key="header" className="splash-header">
|
this.props.session.user ? [
|
||||||
{this.shouldShowWelcome() ? [
|
<div key="header" className="splash-header">
|
||||||
<Welcome key="welcome"
|
{this.shouldShowWelcome() ? [
|
||||||
onDismiss={this.handleDismiss.bind(this, 'welcome')}
|
<Welcome key="welcome"
|
||||||
messages={messages} />
|
onDismiss={this.handleDismiss.bind(this, 'welcome')}
|
||||||
] : [
|
messages={messages} />
|
||||||
<Activity key="activity" items={this.state.activity} />
|
] : [
|
||||||
]}
|
<Activity key="activity" items={this.state.activity} />
|
||||||
<News items={this.state.news} messages={messages} />
|
]}
|
||||||
</div>
|
<News items={this.state.news} messages={messages} />
|
||||||
] : [
|
</div>
|
||||||
<Intro projectCount={this.state.projectCount} messages={messages} key="intro"/>
|
] : [
|
||||||
]}
|
<Intro projectCount={this.state.projectCount} messages={messages} key="intro"/>
|
||||||
|
]) : ()
|
||||||
|
}
|
||||||
|
|
||||||
{featured}
|
{featured}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue