Commit a19fb29f authored by Ray Schamp's avatar Ray Schamp

WIP: enable backpack in preview

parent fccbed07
...@@ -81,14 +81,15 @@ To stop the process that is making the site available to your web browser (creat ...@@ -81,14 +81,15 @@ To stop the process that is making the site available to your web browser (creat
`npm start` can be configured with the following environment variables `npm start` can be configured with the following environment variables
| Variable | Default | Description | | Variable | Default | Description |
| ------------- | ----------------------------- | ---------------------------------------------- | | --------------- | ---------------------------------- | ---------------------------------------------- |
| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests | | `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests |
| `SENTRY_DSN` | `''` | DSN for Sentry | | `BACKPACK_HOST` | `https://backpack.scratch.mit.edu` | Hostname for backpack requests |
| `FALLBACK` | `''` | Pass-through location for old site | | `SENTRY_DSN` | `''` | DSN for Sentry |
| `GA_TRACKER` | `''` | Where to log Google Analytics data | | `FALLBACK` | `''` | Pass-through location for old site |
| `NODE_ENV` | `null` | If not `production`, app acts like development | | `GA_TRACKER` | `''` | Where to log Google Analytics data |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | | `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
**NOTE:** Because by default `API_HOST=https://api.scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website. **NOTE:** Because by default `API_HOST=https://api.scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website.
......
...@@ -28,6 +28,7 @@ const projectShape = require('./projectshape.jsx').projectShape; ...@@ -28,6 +28,7 @@ const projectShape = require('./projectshape.jsx').projectShape;
require('./preview.scss'); require('./preview.scss');
const PreviewPresentation = ({ const PreviewPresentation = ({
backpackOptions,
comments, comments,
editable, editable,
extensions, extensions,
...@@ -124,6 +125,7 @@ const PreviewPresentation = ({ ...@@ -124,6 +125,7 @@ const PreviewPresentation = ({
<div className="guiPlayer"> <div className="guiPlayer">
<IntlGUI <IntlGUI
isPlayerOnly isPlayerOnly
backpackOptions={backpackOptions}
basePath="/" basePath="/"
className="guiPlayer" className="guiPlayer"
isFullScreen={isFullScreen} isFullScreen={isFullScreen}
...@@ -349,6 +351,10 @@ const PreviewPresentation = ({ ...@@ -349,6 +351,10 @@ const PreviewPresentation = ({
PreviewPresentation.propTypes = { PreviewPresentation.propTypes = {
addToStudioOpen: PropTypes.bool, addToStudioOpen: PropTypes.bool,
backpackOptions: PropTypes.shape({
host: PropTypes.string,
visible: PropTypes.bool
}),
comments: PropTypes.arrayOf(PropTypes.object), comments: PropTypes.arrayOf(PropTypes.object),
editable: PropTypes.bool, editable: PropTypes.bool,
extensions: PropTypes.arrayOf(PropTypes.object), extensions: PropTypes.arrayOf(PropTypes.object),
......
...@@ -288,11 +288,16 @@ class Preview extends React.Component { ...@@ -288,11 +288,16 @@ class Preview extends React.Component {
); );
} }
render () { render () {
const backpackOptions = {
host: process.env.BACKPACK_HOST,
visible: true
};
return ( return (
this.props.playerMode ? this.props.playerMode ?
<Page> <Page>
<PreviewPresentation <PreviewPresentation
addToStudioOpen={this.state.addToStudioOpen} addToStudioOpen={this.state.addToStudioOpen}
backpackOptions={backpackOptions}
comments={this.props.comments} comments={this.props.comments}
editable={this.state.editable} editable={this.state.editable}
extensions={this.state.extensions} extensions={this.state.extensions}
...@@ -330,6 +335,7 @@ class Preview extends React.Component { ...@@ -330,6 +335,7 @@ class Preview extends React.Component {
<IntlGUI <IntlGUI
enableCommunity enableCommunity
hideIntro hideIntro
backpackOptions={backpackOptions}
basePath="/" basePath="/"
className="gui" className="gui"
projectId={this.state.projectId} projectId={this.state.projectId}
......
...@@ -165,6 +165,7 @@ module.exports = { ...@@ -165,6 +165,7 @@ module.exports = {
'process.env.NODE_ENV': '"' + (process.env.NODE_ENV || 'development') + '"', 'process.env.NODE_ENV': '"' + (process.env.NODE_ENV || 'development') + '"',
'process.env.SENTRY_DSN': '"' + (process.env.SENTRY_DSN || '') + '"', 'process.env.SENTRY_DSN': '"' + (process.env.SENTRY_DSN || '') + '"',
'process.env.API_HOST': '"' + (process.env.API_HOST || 'https://api.scratch.mit.edu') + '"', 'process.env.API_HOST': '"' + (process.env.API_HOST || 'https://api.scratch.mit.edu') + '"',
'process.env.BACKPACK_HOST': '"' + (process.env.BACKPACK_HOST || 'https://backpack.scratch.mit.edu') + '"',
'process.env.SCRATCH_ENV': '"' + (process.env.SCRATCH_ENV || 'development') + '"' 'process.env.SCRATCH_ENV': '"' + (process.env.SCRATCH_ENV || 'development') + '"'
}), }),
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
......
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