mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Merge branch 'develop' into hide-backpack-logged-out
This commit is contained in:
commit
d36b71dcb3
13 changed files with 56 additions and 13 deletions
|
@ -43,6 +43,11 @@ env:
|
|||
- PROJECT_HOST_VAR=PROJECT_HOST_$TRAVIS_BRANCH
|
||||
- PROJECT_HOST=${!PROJECT_HOST_VAR}
|
||||
- PROJECT_HOST=${PROJECT_HOST:-$PROJECT_HOST_STAGING}
|
||||
- STATIC_HOST_master=https://cdn2.scratch.mit.edu
|
||||
- STATIC_HOST_STAGING=https://scratch.ly
|
||||
- STATIC_HOST_VAR=STATIC_HOST_$TRAVIS_BRANCH
|
||||
- STATIC_HOST=${!STATIC_HOST_VAR}
|
||||
- STATIC_HOST=${STATIC_HOST:-$STATIC_HOST_STAGING}
|
||||
- PATH=$PATH:$PWD/test/integration/node_modules/chromedriver/bin
|
||||
- AWS_ACCESS_KEY_ID=$EB_AWS_ACCESS_KEY_ID
|
||||
- AWS_SECRET_ACCESS_KEY=$EB_AWS_SECRET_ACCESS_KEY
|
||||
|
|
|
@ -80,7 +80,7 @@ const ConferenceFooter = () => (
|
|||
<a href="https://scratch.mit.edu">Scratch</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.scratchjr.org/">ScratchJr</a>
|
||||
<a href="https://www.scratchjr.org/">ScratchJr</a>
|
||||
</li>
|
||||
</FlexRow>
|
||||
<FlexRow
|
||||
|
|
|
@ -23,7 +23,7 @@ const ConferenceFooter = props => (
|
|||
<a href="https://scratch.mit.edu">Scratch</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.scratchjr.org/">ScratchJr</a>
|
||||
<a href="https://www.scratchjr.org/">ScratchJr</a>
|
||||
</li>
|
||||
</FlexRow>
|
||||
<FlexRow
|
||||
|
|
|
@ -99,7 +99,7 @@ const ConferenceFooter = props => (
|
|||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="http://www.scratchjr.org/"
|
||||
href="https://www.scratchjr.org/"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
|
|
|
@ -186,7 +186,7 @@ const Footer = props => (
|
|||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="http://www.scratchjr.org/">
|
||||
<a href="https://www.scratchjr.org/">
|
||||
<FormattedMessage id="general.scratchJr" />
|
||||
</a>
|
||||
</dd>
|
||||
|
|
18
src/lib/user-thumbnail.js
Normal file
18
src/lib/user-thumbnail.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @user-thumbnail
|
||||
* Utility functions to return thumnail-related strings
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate a thumbnail url for a particular userid, with width and height.
|
||||
* @param {string} userId userId for the user whose thumbnail we want
|
||||
* @param {number} width desired thumbnail width; defaults to 32
|
||||
* @param {number} height desired thumbnail height; defaults to width.
|
||||
* @returns {string} thumbnail url string
|
||||
*/
|
||||
const thumbnailUrl = (userId, width, height) => (
|
||||
`${process.env.STATIC_HOST}/get_image/user/${userId}_` +
|
||||
`${width ? width : 32}x${height ? height : (width ? width : 32)}.png`
|
||||
);
|
||||
|
||||
module.exports = thumbnailUrl;
|
|
@ -26,6 +26,8 @@ const Jobs = () => (
|
|||
<div className="bottom">
|
||||
<div className="inner">
|
||||
<h3><FormattedMessage id="jobs.openings" /></h3>
|
||||
<FormattedMessage id="jobs.nojobs" />
|
||||
{/*
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://www.media.mit.edu/about/job-opportunities/full-stack-engineer-lifelong-kindergarten/">
|
||||
|
@ -36,6 +38,7 @@ const Jobs = () => (
|
|||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
*/}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"jobs.joinScratchTeam": "Join the Scratch Team!",
|
||||
"jobs.openings": "Current Job Openings",
|
||||
"jobs.titleQuestion": "Want to work on an innovative project that is transforming the ways young people create, share, and learn?",
|
||||
"jobs.workEnvironment":"We’re seeking curious and motivated people to join our Scratch Team at the MIT Media Lab. We're a diverse group of educators, designers, and engineers, who work together in a playful, creative environment full of LEGO bricks, craft materials, and maker tools. We strongly value diversity, collaboration, and respect in the workplace."
|
||||
"jobs.workEnvironment":"We’re seeking curious and motivated people to join our Scratch Team at the MIT Media Lab. We're a diverse group of educators, designers, and engineers, who work together in a playful, creative environment full of LEGO bricks, craft materials, and maker tools. We strongly value diversity, collaboration, and respect in the workplace.",
|
||||
"jobs.nojobs":"We don't have any open positions at this time. Please check back soon for opportunities!"
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class MicroBit extends ExtensionLanding {
|
|||
<a
|
||||
download
|
||||
className="download"
|
||||
href="https://downloads.scratch.mit.edu/microbit/scratch-microbit-1.0.hex.zip"
|
||||
href="https://downloads.scratch.mit.edu/microbit/scratch-microbit-1.1.0.hex.zip"
|
||||
>
|
||||
<FormattedMessage id="microbit.downloadHex" />
|
||||
</a>
|
||||
|
|
|
@ -13,6 +13,7 @@ const storage = require('../../lib/storage.js').default;
|
|||
const log = require('../../lib/log');
|
||||
const EXTENSION_INFO = require('../../lib/extensions.js').default;
|
||||
const jar = require('../../lib/jar.js');
|
||||
const thumbnailUrl = require('../../lib/user-thumbnail');
|
||||
|
||||
const PreviewPresentation = require('./presentation.jsx');
|
||||
const projectShape = require('./projectshape.jsx').projectShape;
|
||||
|
@ -454,11 +455,15 @@ class Preview extends React.Component {
|
|||
<IntlGUI
|
||||
hideIntro
|
||||
assetHost={this.props.assetHost}
|
||||
authorId={this.props.authorId}
|
||||
authorThumbnailUrl={this.props.authorThumbnailUrl}
|
||||
authorUsername={this.props.authorUsername}
|
||||
backpackHost={this.props.backpackHost}
|
||||
backpackVisible={this.props.canUseBackpack}
|
||||
basePath="/"
|
||||
canCreateCopy={this.props.canCreateCopy}
|
||||
canCreateNew={this.props.canCreateNew}
|
||||
canEditTitle={this.props.isEditable}
|
||||
canRemix={this.props.canRemix}
|
||||
canSave={this.props.canSave}
|
||||
canShare={this.props.canShare}
|
||||
|
@ -488,6 +493,11 @@ class Preview extends React.Component {
|
|||
|
||||
Preview.propTypes = {
|
||||
assetHost: PropTypes.string.isRequired,
|
||||
// If there's no author, this will be false`
|
||||
authorId: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
||||
authorThumbnailUrl: PropTypes.string,
|
||||
// If there's no author, this will be false`
|
||||
authorUsername: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
||||
backpackHost: PropTypes.string,
|
||||
canAddToStudio: PropTypes.bool,
|
||||
canCreateCopy: PropTypes.bool,
|
||||
|
@ -578,12 +588,17 @@ const mapStateToProps = state => {
|
|||
const isLoggedIn = state.session.status === sessionActions.Status.FETCHED &&
|
||||
userPresent;
|
||||
const isAdmin = isLoggedIn && state.session.session.permissions.admin;
|
||||
const authorPresent = projectInfoPresent && state.preview.projectInfo.author &&
|
||||
Object.keys(state.preview.projectInfo.author).length > 0;
|
||||
const author = projectInfoPresent && state.preview.projectInfo.author;
|
||||
const authorPresent = author && Object.keys(state.preview.projectInfo.author).length > 0;
|
||||
const authorId = authorPresent && author.id && author.id.toString();
|
||||
const authorUsername = authorPresent && author.username;
|
||||
const userOwnsProject = isLoggedIn && authorPresent &&
|
||||
state.session.session.user.id === state.preview.projectInfo.author.id;
|
||||
state.session.session.user.id.toString() === authorId;
|
||||
|
||||
return {
|
||||
authorId: authorId,
|
||||
authorThumbnailUrl: thumbnailUrl(authorId),
|
||||
authorUsername: authorUsername,
|
||||
canAddToStudio: userOwnsProject,
|
||||
canCreateCopy: userOwnsProject && projectInfoPresent,
|
||||
canCreateNew: isLoggedIn,
|
||||
|
@ -599,7 +614,7 @@ const mapStateToProps = state => {
|
|||
// project is editable iff logged in user is the author of the project, or
|
||||
// logged in user is an admin.
|
||||
isEditable: isLoggedIn &&
|
||||
((authorPresent && state.preview.projectInfo.author.username === state.session.session.user.username) ||
|
||||
(authorUsername === state.session.session.user.username ||
|
||||
state.permissions.admin === true),
|
||||
isLoggedIn: isLoggedIn,
|
||||
isAdmin: isAdmin,
|
||||
|
|
|
@ -262,7 +262,7 @@ describe('test Scratch Family links in footer', function () {
|
|||
.click();
|
||||
cy
|
||||
.url()
|
||||
.should('match', /^http:\/\/www\.scratchjr\.org\/?$/);
|
||||
.should('match', /^https:\/\/www\.scratchjr\.org\/?$/);
|
||||
});
|
||||
|
||||
it.skip('click Scratch Day', function (){
|
||||
|
|
|
@ -269,7 +269,7 @@ tap.test('clickScratchEdLink', options, t => {
|
|||
// SCRATCH JR (SCRATCHJR)
|
||||
tap.test('clickScratchJrLink', options, t => {
|
||||
const linkText = 'ScratchJr';
|
||||
const expectedUrl = 'http://www.scratchjr.org/';
|
||||
const expectedUrl = 'https://www.scratchjr.org/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
|
|
|
@ -33,7 +33,7 @@ VersionPlugin.prototype.apply = function (compiler) {
|
|||
callback();
|
||||
};
|
||||
const options = this.options;
|
||||
|
||||
|
||||
compiler.plugin('emit', function (compilation, callback) {
|
||||
const sha = process.env.WWW_VERSION;
|
||||
if (!sha) { // eslint-disable-line no-negated-condition
|
||||
|
@ -169,6 +169,7 @@ module.exports = {
|
|||
'process.env.BACKPACK_HOST': '"' + (process.env.BACKPACK_HOST || 'https://backpack.scratch.mit.edu') + '"',
|
||||
'process.env.CLOUDDATA_HOST': '"' + (process.env.CLOUDDATA_HOST || 'clouddata.scratch.mit.edu') + '"',
|
||||
'process.env.PROJECT_HOST': '"' + (process.env.PROJECT_HOST || 'https://projects.scratch.mit.edu') + '"',
|
||||
'process.env.STATIC_HOST': '"' + (process.env.STATIC_HOST || 'https://cdn2.scratch.mit.edu') + '"',
|
||||
'process.env.SCRATCH_ENV': '"' + (process.env.SCRATCH_ENV || 'development') + '"'
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
|
Loading…
Reference in a new issue