Skip to content

Commit

Permalink
Merge pull request #40671 from code-dot-org/dtl_candidate_15be1d8e
Browse files Browse the repository at this point in the history
  • Loading branch information
deploy-code-org committed May 18, 2021
2 parents c435b2a + 15be1d8 commit 3bc342c
Show file tree
Hide file tree
Showing 236 changed files with 2,632 additions and 1,706 deletions.
4 changes: 2 additions & 2 deletions apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"@code-dot-org/johnny-five": "0.11.1-cdo.2",
"@code-dot-org/js-interpreter-tyrant": "0.2.2",
"@code-dot-org/js-numbers": "0.1.0-cdo.0",
"@code-dot-org/maze": "2.0.0",
"@code-dot-org/maze": "2.1.0",
"@code-dot-org/ml-activities": "0.0.26",
"@code-dot-org/ml-playground": "0.0.28",
"@code-dot-org/ml-playground": "0.0.29",
"@code-dot-org/p5.play": "^1.3.17-cdo",
"@code-dot-org/piskel": "0.13.0-cdo.6",
"@code-dot-org/redactable-markdown": "0.4.0",
Expand Down
24 changes: 6 additions & 18 deletions apps/src/StudioApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3398,27 +3398,15 @@ StudioApp.prototype.isResponsiveFromConfig = function(config) {
/**
* Checks if the level a teacher is viewing of a students has
* not been started.
* For contained levels don't show the banner ever.
* Otherwise if its a channel backed level check for the channel. Lastly
* if its not a channel backed level and its not free play we know it has
* not been started if no progress has been made.
* For contained levels and project levels don't show the banner ever.
* Otherwise check if the teacher is viewing (readonlyWorkspace) and if
* the level has been started.
*/
StudioApp.prototype.isNotStartedLevel = function(config) {
const progress = getStore().getState().progress;

StudioApp.prototype.displayNotStartedBanner = function(config) {
if (config.hasContainedLevels || config.level.isProjectLevel) {
return false;
} else if (
['Gamelab', 'Applab', 'Weblab', 'Spritelab', 'Dance'].includes(
config.levelGameName
)
) {
return config.readonlyWorkspace && !config.channel;
} else {
return (
config.readonlyWorkspace &&
progress.levelResults[progress.currentLevelId] === undefined
);
return config.readonlyWorkspace && !config.level.isStarted;
}
};

Expand Down Expand Up @@ -3447,7 +3435,7 @@ StudioApp.prototype.setPageConstants = function(config, appSpecificConstants) {
isChallengeLevel: !!config.isChallengeLevel,
isEmbedView: !!config.embed,
isResponsive: this.isResponsiveFromConfig(config),
isNotStartedLevel: this.isNotStartedLevel(config),
displayNotStartedBanner: this.displayNotStartedBanner(config),
isShareView: !!config.share,
pinWorkspaceToBottom: !!config.pinWorkspaceToBottom,
noInstructionsWhenCollapsed: !!config.noInstructionsWhenCollapsed,
Expand Down
19 changes: 14 additions & 5 deletions apps/src/ailab/Ailab.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import $ from 'jquery';

import {
setDynamicInstructionsDefaults,
setDynamicInstructionsKey
setDynamicInstructionsKey,
setDynamicInstructionsOverlayDismissCallback
} from '../redux/instructions';

/**
Expand All @@ -29,7 +30,6 @@ function getInstructionsDefaults() {
dataDisplayLabel: 'Choose one column to predict.',
dataDisplayFeatures:
'Choose one or more columns as inputs to help make the prediction.',
selectTrainer: 'Set up the training.',
trainModel: 'Your model is being trained.',
results: 'Review the results.',
saveModel: 'Save the trained model for use in App Lab.',
Expand Down Expand Up @@ -149,8 +149,8 @@ Ailab.prototype.onContinue = function() {
});
};

Ailab.prototype.setInstructionsKey = function(instructionsKey) {
getStore().dispatch(setDynamicInstructionsKey(instructionsKey));
Ailab.prototype.setInstructionsKey = function(instructionsKey, options) {
getStore().dispatch(setDynamicInstructionsKey(instructionsKey, options));
};

Ailab.prototype.initMLActivities = function() {
Expand Down Expand Up @@ -179,7 +179,10 @@ Ailab.prototype.initMLActivities = function() {

setAssetPath('/blockly/media/skins/ailab/');

const {initAll} = require('@code-dot-org/ml-playground');
const {
initAll,
instructionsDismissed
} = require('@code-dot-org/ml-playground');

// Set initial state for UI elements.
initAll({
Expand All @@ -189,6 +192,12 @@ Ailab.prototype.initMLActivities = function() {
i18n: ailabMsg,
saveTrainedModel
});

if (instructionsDismissed) {
getStore().dispatch(
setDynamicInstructionsOverlayDismissCallback(instructionsDismissed)
);
}
};

export default Ailab;
2 changes: 2 additions & 0 deletions apps/src/ailab/AilabView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {connect} from 'react-redux';
import StudioAppWrapper from '../templates/StudioAppWrapper';
import InstructionsWithWorkspace from '../templates/instructions/InstructionsWithWorkspace';
import CodeWorkspaceContainer from '../templates/CodeWorkspaceContainer';
import Overlay from '../templates/Overlay';

/**
* Top-level React wrapper for Ailab
Expand All @@ -29,6 +30,7 @@ class AilabView extends React.Component {
render() {
return (
<StudioAppWrapper>
<Overlay />
<InstructionsWithWorkspace>
<CodeWorkspaceContainer>
<div style={styles.container}>
Expand Down
2 changes: 1 addition & 1 deletion apps/src/blocklyAddons/cdoBlockSvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class BlockSvg extends GoogleBlockly.BlockSvg {
}

isUserVisible() {
return false; // TODO
return false; // TODO - used for EXTRA_TOP_BLOCKS_FAIL feedback
}

onMouseDown_(e) {
Expand Down
39 changes: 39 additions & 0 deletions apps/src/blocklyAddons/cdoConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export default function initializeCdoConstants(blocklyWrapper) {
blocklyWrapper.Procedures.DEFINITION_BLOCK_TYPES = [
'procedures_defnoreturn',
'procedures_defreturn',
'functional_definition'
];

blocklyWrapper.BlockValueType = {
NONE: 'None', // Typically as a connection/input check means "accepts any type"
STRING: 'String',
NUMBER: 'Number',
IMAGE: 'Image',
BOOLEAN: 'Boolean',
FUNCTION: 'Function',
COLOUR: 'Colour',
ARRAY: 'Array',

// p5.play Sprite
SPRITE: 'Sprite',

/**
* {Object} Behavior
* {function} Behavior.func
* {Array} Behavior.extraArgs
*/
BEHAVIOR: 'Behavior',

/**
* {Object} Location
* {number} Location.x
* {number} Location.y
*/
LOCATION: 'Location'
};

// Google Blockly defaults to 28, but Cdo Blockly defaults to 15. Some labs set the snap radius
// by multiplying a scale factor, so it's important that the default value matches what it was on our fork
blocklyWrapper.SNAP_RADIUS = 15;
}
2 changes: 1 addition & 1 deletion apps/src/blocklyAddons/cdoTouch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function initializeBlocklyXml(blocklyWrapper) {
export default function initializeTouch(blocklyWrapper) {
// Aliasing Google's setClientFromTouch() so that we can override it, but still be able
// to call Google's setClientFromTouch() in the override function.
blocklyWrapper.Touch.originalSetClientFromTouch =
Expand Down
9 changes: 9 additions & 0 deletions apps/src/blocklyAddons/cdoVariables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function initializeVariables(blocklyWrapper) {
// TODO - required for sprite variable blocks
blocklyWrapper.Variables.registerGetter = function(category, blockName) {};

// TODO - required for all variable blocks
blocklyWrapper.Variables.getVars = function(opt_category) {
return {};
};
}
8 changes: 6 additions & 2 deletions apps/src/blocklyAddons/cdoWorkspaceSvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export default class WorkspaceSvg extends GoogleBlockly.WorkspaceSvg {
}

isReadOnly() {
return false; // TODO
return false; // TODO - used for feedback
}
setEnableToolbox() {} // TODO
setEnableToolbox() {} // TODO - called by StudioApp, not sure whether it's still needed.
showTrashcan() {
/**
* NodeList.forEach() is not supported on IE. Use Array.prototype.forEach.call() as a workaround.
Expand Down Expand Up @@ -107,3 +107,7 @@ WorkspaceSvg.prototype.blockSpaceEditor = {
},
svgResize: () => {} // TODO
};

WorkspaceSvg.prototype.events = {
dispatchEvent: () => {} // TODO
};
29 changes: 29 additions & 0 deletions apps/src/blocklyAddons/functionEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This class is not yet implemented. It is used for the modal function editor,
// which is used by Sprite Lab and Artist.
export default class FunctionEditor {
// TODO
constructor(
opt_msgOverrides,
opt_definitionBlockType,
opt_parameterBlockTypes,
opt_disableParamEditing,
opt_paramTypes
) {}

// TODO
isOpen() {
return false;
}

// TODO
renameParameter(oldName, newName) {}

// TODO
refreshParamsEverywhere() {}

// TODO
openEditorForFunction(procedureBlock, functionName) {}

// TODO
openWithNewFunction() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default storybook => {
id: '23222',
display_name: 'courseB_maze_seq_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
perfect: false,
type: 'Maze',
maze_summary: {
Expand All @@ -62,7 +62,7 @@ export default storybook => {
id: '23223',
display_name: 'courseB_maze_seq_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
perfect: false,
type: 'Maze',
maze_summary: {
Expand Down Expand Up @@ -91,7 +91,7 @@ export default storybook => {
id: '23224',
display_name: 'courseC_artist_prog_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
type: 'Artist',
thumbnail_url:
'https://d3p74s6bwmy6t9.cloudfront.net/80cc9bbdbd9a05c1a0cf03500b4eb38c=development/2091.png',
Expand All @@ -101,7 +101,7 @@ export default storybook => {
id: '23225',
display_name: 'courseC_PlayLab_events_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
type: 'Studio',
thumbnail_url:
'https://d3p74s6bwmy6t9.cloudfront.net/0b5d06628b7510904ee392a94065352a=development/2069.png',
Expand All @@ -116,7 +116,7 @@ export default storybook => {
id: '23226',
display_name: 'courseC_artist_prog_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
type: 'Artist',
thumbnail_url:
'https://d3p74s6bwmy6t9.cloudfront.net/80cc9bbdbd9a05c1a0cf03500b4eb38c=development/2091.png',
Expand All @@ -126,7 +126,7 @@ export default storybook => {
id: '23227',
display_name: 'courseB_maze_seq_challenge2',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
type: 'Maze',
perfect: false,
maze_summary: {
Expand All @@ -150,7 +150,7 @@ export default storybook => {
id: '23228',
display_name: 'courseC_PlayLab_events_challenge1',
url:
'http://studio.code.org:3000/s/coursef-2019/stage/1/extras?level_name=courseC_artist_prog_challenge1',
'http://studio.code.org:3000/s/coursef-2019/lessons/1/extras?level_name=courseC_artist_prog_challenge1',
type: 'Studio',
thumbnail_url:
'https://d3p74s6bwmy6t9.cloudfront.net/0b5d06628b7510904ee392a94065352a=development/2069.png',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const activityPuzzle = {
kind: 'puzzle',
icon: '',
title: 1,
url: 'http://studio.code.org/s/course1/stage/3/puzzle/2',
url: 'http://studio.code.org/s/course1/lessons/3/levels/2',
freePlay: false,
is_concept_level: false
};
Expand All @@ -29,7 +29,7 @@ const conceptPuzzle = {
kind: 'puzzle',
icon: 'fa-file-text',
title: 2,
url: 'http://studio.code.org/s/csp1-2019/stage/2/puzzle/1',
url: 'http://studio.code.org/s/csp1-2019/lessons/2/levels/1',
freePlay: false,
progression: 'Lesson Vocabulary & Resources',
is_concept_level: true
Expand All @@ -42,7 +42,7 @@ const assessment1 = {
kind: 'assessment',
icon: 'fa-check-square-o',
title: 3,
url: 'http://studio.code.org/s/csp1-2019/stage/2/puzzle/3',
url: 'http://studio.code.org/s/csp1-2019/lessons/2/levels/3',
freePlay: false,
progression: 'Check Your Understanding'
};
Expand All @@ -54,7 +54,7 @@ const assessment2 = {
kind: 'assessment',
icon: 'fa-check-square-o',
title: 4,
url: 'http://studio.code.org/s/csp1-2019/stage/2/puzzle/4',
url: 'http://studio.code.org/s/csp1-2019/lessons/2/levels/4',
freePlay: false,
progression: 'Check Your Understanding'
};
Expand All @@ -66,7 +66,7 @@ const assessment3 = {
kind: 'assessment',
icon: 'fa-check-square-o',
title: 5,
url: 'http://studio.code.org/s/csp1-2019/stage/2/puzzle/5',
url: 'http://studio.code.org/s/csp1-2019/lessons/2/levels/5',
freePlay: false,
progression: 'Check Your Understanding'
};
Expand All @@ -78,7 +78,7 @@ const unplugged = {
kind: 'unplugged',
position: 1,
title: 1,
url: 'http://studio.code.org/s/course1/stage/1/puzzle/1'
url: 'http://studio.code.org/s/course1/lessons/1/levels/1'
};

const bonus = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Button from '@cdo/apps/templates/Button';
import UnitCalendar from './UnitCalendar';
import {unitCalendarLesson} from '@cdo/apps/templates/progress/unitCalendarLessonShapes';

const WEEKLY_INSTRUCTIONAL_MINUTES_OPTIONS = [45, 90, 135, 180, 225];
const WEEKLY_INSTRUCTIONAL_MINUTES_OPTIONS = [45, 90, 135, 180, 225, 450];
export const WEEK_WIDTH = 585;

export default class UnitCalendarDialog extends Component {
Expand Down

0 comments on commit 3bc342c

Please sign in to comment.