Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTL (Test > Levelbuilder): 6f29dc96 #25928

Merged
merged 16 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/src/block_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,10 @@ const STANDARD_INPUT_TYPES = {
},
[FIELD_INPUT]: {
addInput(blockly, block, inputConfig, currentInputRow) {
const changeHandler = 'Number' === inputConfig.type ? blockly.FieldTextInput.numberValidator : undefined;
const fieldTextInput = new blockly.FieldTextInput('', changeHandler);
currentInputRow.appendTitle(inputConfig.label)
.appendTitle(new blockly.FieldTextInput(''), inputConfig.name);
.appendTitle(fieldTextInput, inputConfig.name);
},
generateCode(block, inputConfig) {
let code = block.getTitleValue(inputConfig.name);
Expand Down
15 changes: 14 additions & 1 deletion apps/src/code-studio/components/ShareAllowedDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SendToPhone from './SendToPhone';
import color from "../../util/color";
import * as applabConstants from '../../applab/constants';
import * as gamelabConstants from '../../gamelab/constants';
import { SongTitlesToArtistTwitterHandle } from '../dancePartySongArtistTags';
import { hideShareDialog, unpublishProject } from './shareDialogRedux';
import { showPublishDialog } from '../../templates/projects/publishDialog/publishDialogRedux';
import PublishDialog from '../../templates/projects/publishDialog/PublishDialog';
Expand Down Expand Up @@ -142,6 +143,8 @@ class ShareAllowedDialog extends React.Component {
}).isRequired,
icon: PropTypes.string,
shareUrl: PropTypes.string.isRequired,
// Only applicable to Dance Party projects, used to Tweet at song artist.
selectedSong: PropTypes.string,
thumbnailUrl: PropTypes.string,
isAbusive: PropTypes.bool.isRequired,
isOpen: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -257,17 +260,27 @@ class ShareAllowedDialog extends React.Component {
modalClass += ' no-modal-icon';
}

const artistTwitterHandle = SongTitlesToArtistTwitterHandle[this.props.selectedSong];

const hasThumbnail = !!this.props.thumbnailUrl;
const thumbnailUrl = hasThumbnail ?
this.props.thumbnailUrl :
'/blockly/media/projects/project_default.png';

const facebookShareUrl = "https://www.facebook.com/sharer/sharer.php?u=" +
encodeURIComponent(this.props.shareUrl);
const twitterShareUrl = "https://twitter.com/intent/tweet?url=" +
const twitterShareUrlDefault = "https://twitter.com/intent/tweet?url=" +
encodeURIComponent(this.props.shareUrl) +
"&text=Check%20out%20what%20I%20made%20@codeorg" +
"&hashtags=HourOfCode&related=codeorg";
// Check out the dance I made featuring @artist on @codeorg! URL #HourOfCode
const twitterShareUrlDance = "https://twitter.com/intent/tweet?url=" +
"&text=Check%20out%20the%20dance%20I%20made%20featuring%20@" + artistTwitterHandle + "%20on%20@codeorg!%20" +
encodeURIComponent(this.props.shareUrl) +
"&hashtags=HourOfCode&related=codeorg";

const twitterShareUrl = artistTwitterHandle ?
twitterShareUrlDance : twitterShareUrlDefault;

const showShareWarning = (
!this.props.canShareSocial &&
Expand Down
5 changes: 4 additions & 1 deletion apps/src/code-studio/components/ShareDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import ShareDisallowedDialog from './ShareDisallowedDialog';
class ShareDialog extends Component {
static propTypes = {
signInState: PropTypes.oneOf(Object.values(SignInState)),
isProjectLevel: PropTypes.bool.isRequired
isProjectLevel: PropTypes.bool.isRequired,
// Only applicable to Dance Party projects, used to Tweet at song artist.
selectedSong: PropTypes.string,
};

render() {
const { signInState, isProjectLevel, ...otherProps } = this.props;
// If we're on a project level (i.e. /projects/appname), always show signed
// in version of the dialog

if (signInState === SignInState.SignedIn || isProjectLevel) {
return (
<ShareAllowedDialog {...otherProps}/>
Expand Down
39 changes: 39 additions & 0 deletions apps/src/code-studio/dancePartySongArtistTags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Dance Party song titles mapped to the artist's Twitter handle to use in the // ShareDialog share links. Not all songs are available in all environments,
// and the full list of Dance Party songs can be found at: https://s3.console.aws.amazon.com/s3/buckets/cdo-sound-library/hoc_song_meta/?region=us-east-1&tab=overview

export const SongTitlesToArtistTwitterHandle = {
"backtoyou_selenagomez" : "SelenaGomez",
"bornthisway_ladygaga" : "LadyGaga",
"callmemaybe_carlyraejepsen": "CarlyRaeJepsen",
"cantfeelmyface_theweeknd" : "TheWeeknd",
"cantholdus_macklemore" : "Macklemore",
"cheapthrills_sia" : "SiaMusic",
"countrygirl_lukebryan" : "LukeBryanOnline",
"dancinginthedark_brucespringsteen" : "Springsteen",
"danzakuduro_donomar" : "DONOMAR",
"heyya_outkast" : "Outkast",
"iliketomoveit_william" : "iamwill",
"getintothegroove_madonna" : "Madonna",
"levelup_ciara" : "Ciara",
"macarena_losdelrio" : "LosDelRioMusic",
"migente_jbalvin" : "JBalvin",
"needyounow_ladyantebellum" : "LadyAntebellum",
"nottearslefttocry_arianagrande" : "ArianGrande",
"shapeofyou_edsheeran" : "EdSheeran",
"somebodylikeyou_keithurban" : "KeithUrban",
"sorry_justinbieber" : "JustinBieber",
"summer_calvinharris" : "CalvinHarris",
"takeonme_aha" : "Aha_Com",
"isawthesign_aceofbase" : "AceofBase",
"thunder_imaginedragons" : "ImagineDragons",
"canttouchthis_mchammer" : "MCHammer",
"uptownfunk_brunomars" : "BrunoMars",
"vivalavida_coldplay" : "Coldplay",
"wakemeup_aviciialoeblacc" : "AloeBlacc",
"wecantstop_mileycyrus" : "MileyCyrus",
"wenospeakamericano_yolandabecool" : "YolandaBeCool",
"ymca_villagepeople" : "VillagePeople",
// These are the tracks available locally tweet @codeorg to avoid spamming anyone.
"jazzy_beats" : "codeorg",
"synthesize" : "codeorg"
};
2 changes: 2 additions & 0 deletions apps/src/code-studio/headerShare.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function shareProject(shareUrl) {
const pageConstants = getStore().getState().pageConstants;
const canShareSocial = !pageConstants.isSignedIn || pageConstants.is13Plus;
const appType = dashboard.project.getStandaloneApp();
const selectedSong = dashboard.project.getSelectedSong();

// Allow publishing for any project type that students can publish.
// Younger students can now get to the share dialog if their teacher allows
Expand All @@ -46,6 +47,7 @@ export function shareProject(shareUrl) {
isProjectLevel={!!dashboard.project.isProjectLevel()}
i18n={i18n}
shareUrl={shareUrl}
selectedSong={selectedSong}
thumbnailUrl={dashboard.project.getThumbnailUrl()}
isAbusive={dashboard.project.exceedsAbuseThreshold()}
canPrint={appType === "artist"}
Expand Down
4 changes: 4 additions & 0 deletions apps/src/code-studio/initApp/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,10 @@ var projects = module.exports = {
}));
},

getSelectedSong() {
return currentSources.selectedSong;
},

/**
* Save the project with the maker API state toggled, then reload the page
* so that the toolbox gets re-initialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
{
"name": "VAL",
"type": "Number",
"field": true
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@
],
[
"10"
],
[
"11"
],
[
"12"
],
[
"13"
],
[
"14"
],
[
"15"
],
[
"16"
],
[
"17"
],
[
"18"
],
[
"19"
],
[
"20"
]
]
},
Expand Down Expand Up @@ -95,6 +125,14 @@
{
"name": "LAYOUT",
"options": [
[
"border",
"\"border\""
],
[
"inside square",
"\"inner\""
],
[
"circle",
"\"circle\""
Expand All @@ -111,6 +149,14 @@
"column",
"\"column\""
],
[
"criss-cross",
"\"x\""
],
[
"plus",
"\"plus\""
],
[
"random",
"\"random\""
Expand Down
1 change: 1 addition & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_setProp.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
},
{
"name": "VAL",
"type": "Number",
"field": true
}
]
Expand Down
1 change: 1 addition & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_setPropEach.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
},
{
"name": "VAL",
"type": "Number",
"field": true
}
]
Expand Down
11 changes: 11 additions & 0 deletions dashboard/config/blocks/aalab/aalab_createNewSpriteAdvanced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function createNewSpriteAdvanced(name, costume, location) {
if(!spriteGroups.hasOwnProperty(name)) {
spriteGroups[name] = [];
}
if (!location) {
location = {x: 200, y: 200};
}
var newSprite = makeNewSprite(costume, location.x, location.y);
newSprite.maxSpeed = 0;
spriteGroups[name].push(newSprite);
}
28 changes: 28 additions & 0 deletions dashboard/config/blocks/aalab/aalab_createNewSpriteAdvanced.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"category": "Sprites",
"config": {
"func": "createNewSpriteAdvanced",
"inline": false,
"blockText": "make a new sprite \n called {NAME} \n with costume {COSTUME} \n at {LOCATION}",
"color": [
355,
".7",
".7"
],
"args": [
{
"name": "NAME",
"assignment": false,
"customInput": "spritePicker"
},
{
"name": "COSTUME",
"customInput": "costumePicker"
},
{
"name": "LOCATION",
"type": "Location"
}
]
}
}