mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 07:00:25 -04:00
Fix editor title when not logged in
This commit is contained in:
parent
d8df31587e
commit
93f9eaf718
2 changed files with 18 additions and 5 deletions
|
@ -1,14 +1,23 @@
|
|||
const React = require('react');
|
||||
const Helmet = require('react-helmet').default;
|
||||
const PropTypes = require('prop-types');
|
||||
|
||||
const projectShape = require('./projectshape.jsx').projectShape;
|
||||
|
||||
const Meta = props => {
|
||||
const {id, title, instructions, author} = props.projectInfo;
|
||||
|
||||
// Do not want to render any meta tags unless all the info is loaded
|
||||
// Check only author (object) because it is ok to have empty string instructions
|
||||
if (!author) return null;
|
||||
if (!author) {
|
||||
// Project info is not ready. It's either fetching state, or logged-out users creating project.
|
||||
if (!props.userPresent) {
|
||||
return (
|
||||
<Helmet>
|
||||
<title>Scratch - Imagine, Program, Share</title>
|
||||
</Helmet>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const truncatedInstructions = instructions.split(' ')
|
||||
.slice(0, 50)
|
||||
|
@ -38,7 +47,8 @@ const Meta = props => {
|
|||
};
|
||||
|
||||
Meta.propTypes = {
|
||||
projectInfo: projectShape
|
||||
projectInfo: projectShape,
|
||||
userPresent: PropTypes.bool
|
||||
};
|
||||
|
||||
module.exports = Meta;
|
||||
|
|
|
@ -700,7 +700,10 @@ class Preview extends React.Component {
|
|||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Meta projectInfo={this.props.projectInfo} />
|
||||
<Meta
|
||||
projectInfo={this.props.projectInfo}
|
||||
userPresent={this.props.userPresent}
|
||||
/>
|
||||
{this.props.playerMode ?
|
||||
<Page
|
||||
className={classNames({
|
||||
|
|
Loading…
Reference in a new issue