Skip to content

Commit

Permalink
Merge pull request #22090 from code-dot-org/dtp_candidate_33c5d684
Browse files Browse the repository at this point in the history
DTP (Test > Production: 33c5d68)
  • Loading branch information
wjordan committed Apr 26, 2018
2 parents d6c6495 + c2a70ec commit e50cb80
Show file tree
Hide file tree
Showing 121 changed files with 2,076 additions and 474 deletions.
4 changes: 4 additions & 0 deletions apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"anotherHoCButton": "Continue learning",
"anotherHoCDesc": "Keep it up! Try your next Hour of Code activity.",
"anotherHoCTitle": "Try another Hour of Code",
"answerOptionA": "A",
"answerOptionB": "B",
"answersVisible": "Answers visible (read-only)",
"archiveSection": "Archive Section",
"applabMarketingButton": "Learn more",
Expand Down Expand Up @@ -646,6 +648,7 @@
"missingRequiredBlocksErrorMsg": "Not quite. You have to use a block you aren’t using yet.",
"more": "More",
"moreInfo": "More info.",
"moveStudents": "Move students",
"myCourses": "My Courses",
"myProjects": "My Projects",
"name": "Name",
Expand All @@ -667,6 +670,7 @@
"noMenuItemsAvailable": "No menu items available.",
"none": "None",
"note": "*Note:",
"notAnswered": "Not Answered",
"notStarted": "Not started",
"nPoints": "{numPoints, plural, one {1 point} other {# points}}",
"numBlocksNeeded": "Congratulations! You completed Puzzle {puzzleNumber}. (However, you could have used only {numBlocks, plural, one {1 block} other {# blocks}}.)",
Expand Down
6 changes: 4 additions & 2 deletions apps/src/applab/redux/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ export function importIntoProject(projectId, screens, assets) {
importFuncs.importScreensAndAssets(projectId, screens, assets).then(
() => {
dispatch({type: IMPORT.SCREENS.FINISHED_IMPORTING});
const lastScreen = screens[screens.length - 1];
dispatch(changeScreen(lastScreen.id));
if (screens.length > 0) {
const lastScreen = screens[screens.length - 1];
dispatch(changeScreen(lastScreen.id));
}
},
() => dispatch({type: IMPORT.SCREENS.FAILED_IMPORTING})
);
Expand Down
2 changes: 1 addition & 1 deletion apps/src/bounce/bounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var tiles = require('./tiles');
import CustomMarshalingInterpreter from '../lib/tools/jsinterpreter/CustomMarshalingInterpreter';
var api = require('./api');
var Provider = require('react-redux').Provider;
var AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
var BounceVisualizationColumn = require('./BounceVisualizationColumn');
var dom = require('../dom');
var Hammer = require("../third-party/hammer");
Expand Down
2 changes: 1 addition & 1 deletion apps/src/calc/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var jsnums = require('@code-dot-org/js-numbers');
var commonMsg = require('@cdo/locale');
var calcMsg = require('./locale');
var Provider = require('react-redux').Provider;
var AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
var CalcVisualizationColumn = require('./CalcVisualizationColumn');
var dom = require('../dom');
var blockUtils = require('../block_utils');
Expand Down
1 change: 1 addition & 0 deletions apps/src/code-studio/assets/assetListStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
},

add: function (asset) {
assets = this.remove(asset.filename);
assets.push(asset);
return assets.slice();
},
Expand Down
1 change: 1 addition & 0 deletions apps/src/code-studio/components/AssetManager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default class AssetManager extends React.Component {
<AssetRow
key={asset.filename}
name={asset.filename}
timestamp={asset.timestamp}
type={asset.category}
size={asset.size}
useFilesApi={this.props.useFilesApi}
Expand Down
2 changes: 2 additions & 0 deletions apps/src/code-studio/components/AssetRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import AssetThumbnail from './AssetThumbnail';
export default class AssetRow extends React.Component {
static propTypes = {
name: PropTypes.string.isRequired,
timestamp: PropTypes.string,
type: PropTypes.oneOf(['image', 'audio', 'video', 'pdf', 'doc']).isRequired,
size: PropTypes.number,
useFilesApi: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -111,6 +112,7 @@ export default class AssetRow extends React.Component {
<AssetThumbnail
type={this.props.type}
name={this.props.name}
timestamp={this.props.timestamp}
useFilesApi={this.props.useFilesApi}
/>
</td>
Expand Down
30 changes: 23 additions & 7 deletions apps/src/code-studio/components/AssetThumbnail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const styles = {
class AssetThumbnail extends React.Component {
static propTypes = {
name: PropTypes.string.isRequired,
timestamp: PropTypes.string,
type: PropTypes.oneOf(['image', 'audio', 'video', 'pdf', 'doc']).isRequired,
style: PropTypes.object,
iconStyle: PropTypes.object,
Expand All @@ -49,19 +50,34 @@ class AssetThumbnail extends React.Component {
};

render() {
const {type, name} = this.props;
let api = this.props.useFilesApi ? filesApi : assetsApi;
if (this.props.projectId) {
api = api.withProjectId(this.props.projectId);
const {
timestamp,
type,
name,
useFilesApi,
projectId,
iconStyle,
style
} = this.props;
let api = useFilesApi ? filesApi : assetsApi;
if (projectId) {
api = api.withProjectId(projectId);
}
const basePath = api.basePath(name);
let cacheBustSuffix = '';
if (timestamp) {
const date = new Date(timestamp);
cacheBustSuffix = `?t=${date.valueOf()}`;
}
const srcPath = `${basePath}${cacheBustSuffix}`;

return (
<div className="assetThumbnail" style={[styles.wrapper, this.props.style]}>
<div className="assetThumbnail" style={[styles.wrapper, style]}>
{type === 'image' ?
<img src={api.basePath(name)} style={assetThumbnailStyle} /> :
<img src={srcPath} style={assetThumbnailStyle} /> :
<i
className={defaultIcons[type] || defaultIcons.unknown}
style={[assetIconStyle, this.props.iconStyle]}
style={[assetIconStyle, iconStyle]}
/>
}
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/src/code-studio/components/ShareAllowedDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ class ShareAllowedDialog extends React.Component {
// check if twitter and facebook are actually available
// and not blocked by network firewall
checkImageReachability(
'https://graph.facebook.com/Code.org/picture',
'https://facebook.com/favicon.ico',
isFacebookAvailable => this.setState({isFacebookAvailable})
);
checkImageReachability(
'https://twitter.com/codeorg/profile_image?size=mini',
'https://twitter.com/favicon.ico',
isTwitterAvailable => this.setState({isTwitterAvailable})
);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/src/code-studio/headerShare.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function shareProject(shareUrl) {
const appType = dashboard.project.getStandaloneApp();

// Allow publishing for any project type that older students can publish.
// Younger students should never be able to get to the share dialog in the
// first place, so there's no need to check age against project types here.
// Younger students can now get to the share dialog if their teacher allows
// it, and should be able to publish in that case.
const canPublish = !!appOptions.isSignedIn &&
PublishableProjectTypesOver13.includes(appType);

Expand Down
14 changes: 0 additions & 14 deletions apps/src/code-studio/progressRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,6 @@ export const levelsByLesson = ({stages, levelProgress, currentLevelId}) => (
))
);

/**
* Get level data for one lesson/stage
*/

/**
* TODO: (ErinB) levelByLesson is a varient of levelsByLesson that I modified
* for the prototype of the detail view of the progress table. If we end up
* using levelByLesson, I need to write a test for it.
*/

export const levelByLesson = ({stage, levelProgress, currentLevelId}) => (
stage.levels.map(level => levelWithStatus({levelProgress, currentLevelId}, level))
);

/**
* Get data for a particular lesson/stage
*/
Expand Down
8 changes: 7 additions & 1 deletion apps/src/code-studio/url_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Tests whether the browser can access an image URL.
// Useful as a workaround for CORS security to test access to an origin.
function testImageAccess(url, successCallback, failureCallback, timeoutMs = 5000, videoElement = false) {
function testImageAccess(
url,
successCallback = () => {},
failureCallback = () => {},
timeoutMs = 5000,
videoElement = false
) {
var element;
if (videoElement) {
element = document.createElement('video');
Expand Down
2 changes: 1 addition & 1 deletion apps/src/craft/simple/craft.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var houseLevels = require('./houseLevels');
var levelbuilderOverrides = require('./levelbuilderOverrides');
var MusicController = require('../../MusicController');
var Provider = require('react-redux').Provider;
var AppView = require('../../templates/AppView');
import AppView from '../../templates/AppView';
var CraftVisualizationColumn = require('./CraftVisualizationColumn');
import {getStore} from '../../redux';
import Sounds from '../../Sounds';
Expand Down
2 changes: 1 addition & 1 deletion apps/src/eval/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var evalMsg = require('./locale');
import CustomMarshalingInterpreter from '../lib/tools/jsinterpreter/CustomMarshalingInterpreter';
var api = require('./api');
var Provider = require('react-redux').Provider;
var AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
var EvalVisualizationColumn = require('./EvalVisualizationColumn');
var dom = require('../dom');
var blockUtils = require('../block_utils');
Expand Down
17 changes: 17 additions & 0 deletions apps/src/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
PUBLISH_FAILURE,
} from './templates/publishDialog/publishDialogRedux';
import {createHiddenPrintWindow} from './utils';
import testImageAccess from './code-studio/url_test';

// Types of blocks that do not count toward displayed block count. Used
// by FeedbackUtils.blockShouldBeCounted_
Expand Down Expand Up @@ -891,6 +892,22 @@ FeedbackUtils.prototype.createSharingDiv = function (options) {
});
}

var sharingFacebook = sharingDiv.querySelector('#sharing-facebook');
if (sharingFacebook) {
testImageAccess(
'https://facebook.com/favicon.ico' + "?" + Math.random(),
() => $(sharingFacebook).show()
);
}

var sharingTwitter = sharingDiv.querySelector('#sharing-twitter');
if (sharingTwitter) {
testImageAccess(
'https://twitter.com/favicon.ico' + "?" + Math.random(),
() => $(sharingTwitter).show()
);
}

// SMS-to-phone feature
var sharingPhone = sharingDiv.querySelector('#sharing-phone');
if (sharingPhone && options.sendToPhone) {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/flappy/flappy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var flappyMsg = require('./locale');
import CustomMarshalingInterpreter from '../lib/tools/jsinterpreter/CustomMarshalingInterpreter';
var api = require('./api');
var Provider = require('react-redux').Provider;
var AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
var FlappyVisualizationColumn = require('./FlappyVisualizationColumn');
var dom = require('../dom');
var constants = require('./constants');
Expand Down
16 changes: 8 additions & 8 deletions apps/src/gamelab/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,63 +181,63 @@ export default {
createJsWrapperBlock({
color: EVENT_COLOR,
func: 'whenUpArrow',
blockText: 'when up arrow presssed',
blockText: 'when up arrow pressed',
args: [],
eventBlock: true,
});

createJsWrapperBlock({
color: EVENT_COLOR,
func: 'whenDownArrow',
blockText: 'when down arrow presssed',
blockText: 'when down arrow pressed',
args: [],
eventBlock: true,
});

createJsWrapperBlock({
color: EVENT_COLOR,
func: 'whenLeftArrow',
blockText: 'when left arrow presssed',
blockText: 'when left arrow pressed',
args: [],
eventBlock: true,
});

createJsWrapperBlock({
color: EVENT_COLOR,
func: 'whenRightArrow',
blockText: 'when right arrow presssed',
blockText: 'when right arrow pressed',
args: [],
eventBlock: true,
});

createJsWrapperBlock({
color: EVENT_LOOP_COLOR,
func: 'whileUpArrow',
blockText: 'while up arrow presssed',
blockText: 'while up arrow pressed',
args: [],
eventLoopBlock: true,
});

createJsWrapperBlock({
color: EVENT_LOOP_COLOR,
func: 'whileDownArrow',
blockText: 'while down arrow presssed',
blockText: 'while down arrow pressed',
args: [],
eventLoopBlock: true,
});

createJsWrapperBlock({
color: EVENT_LOOP_COLOR,
func: 'whileLeftArrow',
blockText: 'while left arrow presssed',
blockText: 'while left arrow pressed',
args: [],
eventLoopBlock: true,
});

createJsWrapperBlock({
color: EVENT_LOOP_COLOR,
func: 'whileRightArrow',
blockText: 'while right arrow presssed',
blockText: 'while right arrow pressed',
args: [],
eventLoopBlock: true,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/src/jigsaw/jigsaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var React = require('react');
var ReactDOM = require('react-dom');
var studioApp = require('../StudioApp').singleton;
var Provider = require('react-redux').Provider;
var AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
var JigsawVisualizationColumn = require('./JigsawVisualizationColumn');
var dom = require('../dom');
import {getStore} from '../redux';
Expand Down
2 changes: 1 addition & 1 deletion apps/src/maze/maze.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ReactDOM = require('react-dom');
const Provider = require('react-redux').Provider;

const timeoutList = require('../lib/util/timeoutList');
const AppView = require('../templates/AppView');
import AppView from '../templates/AppView';
const CustomMarshalingInterpreter = require('../lib/tools/jsinterpreter/CustomMarshalingInterpreter');
const codegen = require('../lib/tools/jsinterpreter/codegen');
const dom = require('../dom');
Expand Down

0 comments on commit e50cb80

Please sign in to comment.