Merge pull request #2334 from chrisgarrity/feature/rename-preview

Rename /preview to /projects
This commit is contained in:
Paul Kaplan 2018-11-20 15:34:03 -05:00 committed by GitHub
commit ac6a870a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -198,11 +198,11 @@
"title": "Microworlds" "title": "Microworlds"
}, },
{ {
"name": "preview", "name": "projects",
"pattern": "^/preview(/editor|(/\\d+(/editor|/fullscreen)?)?)?/?(\\?.*)?$", "pattern": "^/projects(/editor|(/\\d+(/editor|/fullscreen)?)?)?/?(\\?.*)?$",
"routeAlias": "/preview/?$", "routeAlias": "/projects/?$",
"view": "preview/preview", "view": "preview/preview",
"title": "Scratch 3.0 Preview" "title": "Scratch Project"
}, },
{ {
"name": "3faq", "name": "3faq",

View file

@ -66,7 +66,7 @@ class Preview extends React.Component {
]); ]);
const pathname = window.location.pathname.toLowerCase(); const pathname = window.location.pathname.toLowerCase();
const parts = pathname.split('/').filter(Boolean); const parts = pathname.split('/').filter(Boolean);
// parts[0]: 'preview' // parts[0]: 'projects'
// parts[1]: either :id or 'editor' // parts[1]: either :id or 'editor'
// parts[2]: undefined if no :id, otherwise either 'editor' or 'fullscreen' // parts[2]: undefined if no :id, otherwise either 'editor' or 'fullscreen'
@ -267,7 +267,7 @@ class Preview extends React.Component {
if (!this.props.playerMode) modePath = 'editor/'; if (!this.props.playerMode) modePath = 'editor/';
// fullscreen overrides editor // fullscreen overrides editor
if (this.props.fullScreen) modePath = 'fullscreen/'; if (this.props.fullScreen) modePath = 'fullscreen/';
const newPath = `/preview/${idPath}${modePath}`; const newPath = `/projects/${idPath}${modePath}`;
if (push) { if (push) {
history.pushState( history.pushState(
{}, {},
@ -782,7 +782,7 @@ GUI.setAppElement(document.getElementById('app'));
const initGuiState = guiInitialState => { const initGuiState = guiInitialState => {
const pathname = window.location.pathname.toLowerCase(); const pathname = window.location.pathname.toLowerCase();
const parts = pathname.split('/').filter(Boolean); const parts = pathname.split('/').filter(Boolean);
// parts[0]: 'preview' // parts[0]: 'projects'
// parts[1]: either :id or 'editor' // parts[1]: either :id or 'editor'
// parts[2]: undefined if no :id, otherwise either 'editor' or 'fullscreen' // parts[2]: undefined if no :id, otherwise either 'editor' or 'fullscreen'
if (parts.indexOf('editor') === -1) { if (parts.indexOf('editor') === -1) {

View file

@ -25,7 +25,7 @@ const RemixCredit = props => {
), ),
projectLink: ( projectLink: (
<a <a
href={`/preview/${projectInfo.id}`} href={`/projects/${projectInfo.id}`}
title={projectInfo.title} title={projectInfo.title}
> >
{projectInfo.title} {projectInfo.title}