Unverified Commit 52bbb2c1 authored by picklesrus's avatar picklesrus Committed by GitHub

Merge pull request #4200 from LLK/develop

Merge develop into release
parents 164e58e6 fb640fa8
This diff is collapsed.
...@@ -2,12 +2,15 @@ const FormattedMessage = require('react-intl').FormattedMessage; ...@@ -2,12 +2,15 @@ const FormattedMessage = require('react-intl').FormattedMessage;
const injectIntl = require('react-intl').injectIntl; const injectIntl = require('react-intl').injectIntl;
const intlShape = require('react-intl').intlShape; const intlShape = require('react-intl').intlShape;
const MediaQuery = require('react-responsive').default; const MediaQuery = require('react-responsive').default;
const connect = require('react-redux').connect;
const PropTypes = require('prop-types');
const React = require('react'); const React = require('react');
const FooterBox = require('../container/footer.jsx'); const FooterBox = require('../container/footer.jsx');
const LanguageChooser = require('../../languagechooser/languagechooser.jsx'); const LanguageChooser = require('../../languagechooser/languagechooser.jsx');
const frameless = require('../../../lib/frameless'); const frameless = require('../../../lib/frameless');
const getScratchWikiLink = require('../../../lib/scratch-wiki');
require('./footer.scss'); require('./footer.scss');
...@@ -108,7 +111,7 @@ const Footer = props => ( ...@@ -108,7 +111,7 @@ const Footer = props => (
</a> </a>
</dd> </dd>
<dd> <dd>
<a href="https://en.scratch-wiki.info/"> <a href={props.scratchWikiLink}>
<FormattedMessage id="general.wiki" /> <FormattedMessage id="general.wiki" />
</a> </a>
</dd> </dd>
...@@ -213,7 +216,13 @@ const Footer = props => ( ...@@ -213,7 +216,13 @@ const Footer = props => (
); );
Footer.propTypes = { Footer.propTypes = {
intl: intlShape.isRequired intl: intlShape.isRequired,
scratchWikiLink: PropTypes.string
}; };
module.exports = injectIntl(Footer); const mapStateToProps = (state, ownProps) => ({
scratchWikiLink: getScratchWikiLink(ownProps.intl.locale)
});
const ConnectedFooter = connect(mapStateToProps)(Footer);
module.exports = injectIntl(ConnectedFooter);
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
content: ""; content: "";
} }
img {
display: block;
max-width: 133px;
max-height: 100px;
}
&.blue { &.blue {
#{$color-bars} { #{$color-bars} {
background-color: $ui-blue; background-color: $ui-blue;
...@@ -43,6 +49,10 @@ ...@@ -43,6 +49,10 @@
a { a {
color: $ui-blue; color: $ui-blue;
} }
img {
margin-left: 4px;
}
} }
&.green { &.green {
......
// This list has to be updated when a new Scratch Wiki is made.
// Note that wikis under testwiki are not included.
const wwwLocaleToScratchWikiLocale = {
en: 'en',
ja: 'ja',
fr: 'fr',
de: 'de',
ru: 'ru',
hu: 'hu',
nl: 'nl',
id: 'id'
};
const getScratchWikiLink = locale => {
if (!wwwLocaleToScratchWikiLocale.hasOwnProperty(locale)) {
locale = locale.split('-')[0];
if (!wwwLocaleToScratchWikiLocale.hasOwnProperty(locale)) {
locale = 'en';
}
}
return `https://${wwwLocaleToScratchWikiLocale[locale]}.scratch-wiki.info/`;
};
module.exports = getScratchWikiLink;
const React = require('react'); const React = require('react');
const Helmet = require('react-helmet').default; const Helmet = require('react-helmet').default;
const PropTypes = require('prop-types');
const projectShape = require('./projectshape.jsx').projectShape; const projectShape = require('./projectshape.jsx').projectShape;
const Meta = props => { const Meta = props => {
const {id, title, instructions, author} = props.projectInfo; const {id, title, instructions, author} = props.projectInfo;
// Do not want to render any meta tags unless all the info is loaded if (!author) {
// Check only author (object) because it is ok to have empty string instructions // Project info is not ready. It's either fetching state, or logged-out users creating project.
if (!author) return null; if (!props.userPresent) {
return (
<Helmet>
<title>Scratch - Imagine, Program, Share</title>
</Helmet>
);
}
return null;
}
const truncatedInstructions = instructions.split(' ') const truncatedInstructions = instructions.split(' ')
.slice(0, 50) .slice(0, 50)
...@@ -38,7 +47,8 @@ const Meta = props => { ...@@ -38,7 +47,8 @@ const Meta = props => {
}; };
Meta.propTypes = { Meta.propTypes = {
projectInfo: projectShape projectInfo: projectShape,
userPresent: PropTypes.bool
}; };
module.exports = Meta; module.exports = Meta;
...@@ -444,6 +444,8 @@ $stage-width: 480px; ...@@ -444,6 +444,8 @@ $stage-width: 480px;
font-size: .875rem; font-size: .875rem;
flex-shrink: 1; flex-shrink: 1;
text-align: left; text-align: left;
overflow: auto;
overflow-wrap: break-word;
} }
.description-block { .description-block {
......
...@@ -700,7 +700,10 @@ class Preview extends React.Component { ...@@ -700,7 +700,10 @@ class Preview extends React.Component {
return ( return (
<React.Fragment> <React.Fragment>
<Meta projectInfo={this.props.projectInfo} /> <Meta
projectInfo={this.props.projectInfo}
userPresent={this.props.userPresent}
/>
{this.props.playerMode ? {this.props.playerMode ?
<Page <Page
className={classNames({ className={classNames({
......
static/images/welcome-learn.png

10.5 KB | W: | H:

static/images/welcome-learn.png

4.39 KB | W: | H:

static/images/welcome-learn.png
static/images/welcome-learn.png
static/images/welcome-learn.png
static/images/welcome-learn.png
  • 2-up
  • Swipe
  • Onion skin
const getScratchWikiLink = require('../../../src/lib/scratch-wiki');
describe('unit test lib/scratch-wiki.js', () => {
test('getScratchWikiLink exists', () => {
expect(typeof getScratchWikiLink).toBe('function');
});
test('it returns link to jawiki when ja is given', () => {
expect(getScratchWikiLink('ja')).toBe('https://ja.scratch-wiki.info/');
});
test('it returns link to jawiki when ja-Hira is given', () => {
expect(getScratchWikiLink('ja-Hira')).toBe('https://ja.scratch-wiki.info/');
});
test('it returns link to enwiki when invalid locale is given', () => {
expect(getScratchWikiLink('test')).toBe('https://en.scratch-wiki.info/');
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment