Commit 93f9eaf7 authored by apple502j's avatar apple502j

Fix editor title when not logged in

parent d8df3158
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({
......
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