Skip to content

Commit

Permalink
Merge pull request #42940 from code-dot-org/dtp_candidate_c111c819
Browse files Browse the repository at this point in the history
DTP (Test > Production: c111c81)
  • Loading branch information
sureshc committed Oct 12, 2021
2 parents 8b933d7 + 0d58086 commit 454afc3
Show file tree
Hide file tree
Showing 22 changed files with 628 additions and 160 deletions.
2 changes: 2 additions & 0 deletions apps/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ describe('entry tests', () => {
'./src/sites/studio/pages/programming_expressions/new.js',
'programming_expressions/edit':
'./src/sites/studio/pages/programming_expressions/edit.js',
'programming_expressions/show':
'./src/sites/studio/pages/programming_expressions/show.js',
'scripts/edit': './src/sites/studio/pages/scripts/edit.js',
'scripts/new': './src/sites/studio/pages/scripts/new.js',
'shared/_check_admin': './src/sites/studio/pages/shared/_check_admin.js',
Expand Down
6 changes: 6 additions & 0 deletions apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"activityHeaderTime": " ({activityDuration} minutes)",
"actions": "Actions",
"add": "Add",
"additionalInformationHeader": "Additional Information",
"additionalInformationText": "For more information, see [{externalDocumentationUrl}]({externalDocumentationUrl})",
"addNewSection": "Add New Section",
"addParentEmailModal_confirmedParentEmail_label": "Confirm parent/guardian email address",
"addParentEmailModal_confirmedParentEmail_mustMatch": "Email addresses must match.",
Expand Down Expand Up @@ -202,6 +204,7 @@
"cannotDeleteUsedImage": "You cannot delete images that are currently used in your project",
"catActions": "Actions",
"catColour": "Color",
"category": "Category",
"catLists": "Lists",
"catLogic": "Logic",
"catLoops": "Loops",
Expand Down Expand Up @@ -1579,6 +1582,7 @@
"retryProjectSaveDialogBody": "We can't save your project right now. Please check your internet connection and then click 'Try again' to keep working.",
"retryProjectSaveDialogButton": "Try again",
"retryProjectSavePending": "saving...",
"returnsHeader": "Returns",
"review": "Review",
"reviewCode": "Review Code",
"reviewDocuments": "Review documents",
Expand Down Expand Up @@ -1886,6 +1890,7 @@
"syncGoogleClassroom": "Sync students from Google Classroom",
"syncingYourStudents": "Syncing Your Students",
"syncingYourStudentsDescription": "If your Code.org section is ever out of date with your list of students in {loginType}, click on the \"Sync students from {loginType}\" button on the [Manage Students]({url}) tab: ",
"syntaxHeader": "Syntax",
"syntaxErrorMsg": "Your program contains a typo. Please remove line {lineNumber} and try again.",
"teacher": "Teacher",
"teacherWithColon": "Teacher:",
Expand Down Expand Up @@ -1931,6 +1936,7 @@
"thumbnailWarning": "Note: You must finish running your app to create a thumbnail, before you can publish your app.",
"timeSpentMins": "Time Spent (mins)",
"timestamp": "Time stamp",
"tipsHeader": "Tips",
"today": "today",
"toggleBlocksErrorMsg": "You need to correct an error in your program before it can be shown as blocks.",
"tooFewBody": "Please select two answers before submitting.",
Expand Down
6 changes: 5 additions & 1 deletion apps/src/p5lab/poetry/PoemSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function PoemSelector(props) {
}
};

const getPoemOptions = () => {
return Object.values(POEMS).sort((a, b) => (a.title > b.title ? 1 : -1));
};

return (
<div style={styles.container}>
<PoemEditor isOpen={isOpen} handleClose={handleClose} />
Expand All @@ -120,7 +124,7 @@ function PoemSelector(props) {
style={styles.selector}
onChange={onChange}
>
{Object.values(POEMS).map(poem => (
{getPoemOptions().map(poem => (
<option key={poem.title} value={poem.title}>
{poem.title}
</option>
Expand Down
66 changes: 40 additions & 26 deletions apps/src/p5lab/poetry/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ export const POEMS = {
'Of your own Being!'
]
},
carroll_1: {
author: 'Lewis Carroll',
title: 'Twinkle, Twinkle Little Star',
lines: [
'Twinkle, twinkle little star,',
'How I wonder what you are',
'Up above the world so high',
'Like a diamond in the sky '
]
},
carroll_2: {
author: 'Lewis Carroll',
title: 'Crocodile',
Expand Down Expand Up @@ -195,22 +185,6 @@ export const POEMS = {
'The grass was lizarding.'
]
},
lomeli: {
author: 'Caia Lomeli',
title: 'Return',
lines: [
'Anywhere the air settles its hand on your head ',
'like a gentle father',
'And the morning sings to you —',
'or',
'When you find your reflection ',
'in another breathing body',
'And carry a calm pebble in your chest ',
'',
'Here',
'you are home'
]
},
singer: {
author: 'Marilyn Singer\nfrom CENTRAL HEARTING (Knopf, 2005)',
title: 'Toasting Marshmallows',
Expand Down Expand Up @@ -290,5 +264,45 @@ export const POEMS = {
'When you realize there is nothing lacking,',
'The whole world belongs to you.'
]
},
taylor: {
author: 'Ann Taylor and Jane Taylor',
title: 'The Star',
lines: [
'Twinkle, twinkle, little star,',
'How I wonder what you are !',
'Up above the world so high,',
'Like a diamond in the sky.',
'',
'When the blazing sun is gone,',
'When he nothing shines upon,',
'Then you show your little light,',
'Twinkle, twinkle, all the night.'
]
},
lomeli_1: {
author: 'Caia Lomeli',
title: 'Afternoon Nap',
lines: [
'Imagine:',
'A sun-lit sky',
'Vibrant against your eyelids',
'A distant lawnmower stops',
'A breeze crisp on your skin',
'A warm snoring beside you',
'— I really miss my dog'
]
},
lomeli_2: {
author: 'Caia Lomeli',
title: 'Ode to Imagery',
lines: [
'When a swirling pool of confusion ',
'pulls a new gravity around you',
'Or you dream of a garden ',
'filled with wishes and rocks',
'You’ll learn',
'The world of words is limitless.'
]
}
};
28 changes: 28 additions & 0 deletions apps/src/sites/studio/pages/programming_expressions/show.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import ReactDOM from 'react-dom';
import getScriptData from '@cdo/apps/util/getScriptData';
import ProgrammingExpressionOverview from '@cdo/apps/templates/codeDocs/ProgrammingExpressionOverview';
import ExpandableImageDialog from '@cdo/apps/templates/lessonOverview/ExpandableImageDialog';
import instructionsDialog from '@cdo/apps/redux/instructionsDialog';
import {getStore, registerReducers} from '@cdo/apps/redux';
import {Provider} from 'react-redux';

$(document).ready(() => {
registerReducers({
instructionsDialog
});
const store = getStore();

const programmingExpression = getScriptData('programmingExpression');
ReactDOM.render(
<Provider store={store}>
<>
<ProgrammingExpressionOverview
programmingExpression={programmingExpression}
/>
<ExpandableImageDialog />
</>
</Provider>,
document.getElementById('show-container')
);
});
7 changes: 4 additions & 3 deletions apps/src/templates/SearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ const styles = {
},
icon: {
position: 'absolute',
top: 5,
top: 6,
left: 5,
fontSize: 16,
color: color.light_gray
},
clearIcon: {
position: 'absolute',
top: 5,
top: 6,
right: 5,
fontSize: 16,
color: color.light_gray
color: color.light_gray,
cursor: 'pointer'
},
searchArea: {
position: 'relative',
Expand Down
81 changes: 81 additions & 0 deletions apps/src/templates/codeDocs/ProgrammingExpressionOverview.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react';
import PropTypes from 'prop-types';
import EnhancedSafeMarkdown from '@cdo/apps/templates/EnhancedSafeMarkdown';
import i18n from '@cdo/locale';

export default function ProgrammingExpressionOverview({programmingExpression}) {
return (
<div>
<h1>{programmingExpression.name}</h1>
<div>
<strong>{`${i18n.category()}:`}</strong>
<span
style={{
backgroundColor: programmingExpression.color,
marginLeft: 10,
padding: '5px 10px'
}}
>
{programmingExpression.category}
</span>
</div>
{!!programmingExpression.content && (
<div style={{paddingTop: 20}}>
<EnhancedSafeMarkdown
markdown={programmingExpression.content.trim()}
expandableImages
/>
</div>
)}
{!!programmingExpression.syntax && (
<div>
<h2>{i18n.syntaxHeader()}</h2>
<EnhancedSafeMarkdown
markdown={`\`${programmingExpression.syntax}\``}
expandableImages
/>
</div>
)}
{!!programmingExpression.returnValue && (
<div>
<h2>{i18n.returnsHeader()}</h2>
<div>{programmingExpression.returnValue}</div>
</div>
)}
{!!programmingExpression.tips && (
<div>
<h2>{i18n.tipsHeader()}</h2>
<EnhancedSafeMarkdown
markdown={programmingExpression.tips.trim()}
expandableImages
/>
</div>
)}
{!!programmingExpression.externalDocumentation && (
<div>
<h2>{i18n.additionalInformationHeader()}</h2>
<EnhancedSafeMarkdown
markdown={i18n.additionalInformationText({
externalDocumentationUrl: programmingExpression.externalDocumentation.trim()
})}
/>
</div>
)}
</div>
);
}

const programmingExpressionShape = PropTypes.shape({
name: PropTypes.string.isRequired,
category: PropTypes.string.isRequired,
color: PropTypes.string,
externalDocumentation: PropTypes.string,
content: PropTypes.string,
syntax: PropTypes.string,
returnValue: PropTypes.string,
tips: PropTypes.string
});

ProgrammingExpressionOverview.propTypes = {
programmingExpression: programmingExpressionShape.isRequired
};
31 changes: 31 additions & 0 deletions apps/src/tutorialExplorer/search.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import PropTypes from 'prop-types';
import React from 'react';
import FilterGroupContainer from './filterGroupContainer';
import SearchBar from '../templates/SearchBar';
import debounce from 'lodash/debounce';

export default class Search extends React.Component {
static propTypes = {
onChange: PropTypes.func.isRequired,
showClearIcon: PropTypes.bool
};

debouncedOnChange = debounce(this.props.onChange, 300);

handleChange = e => {
const value = e ? e.target.value : '';
this.debouncedOnChange(value);
};

render() {
return (
<FilterGroupContainer text="Search">
<SearchBar
clearButton={this.props.showClearIcon}
onChange={this.handleChange}
placeholderText=""
/>
</FilterGroupContainer>
);
}
}

0 comments on commit 454afc3

Please sign in to comment.