Skip to content

Commit

Permalink
Merge pull request #45616 from code-dot-org/dtp_candidate_d4306f92
Browse files Browse the repository at this point in the history
DTP (Test > Production: d4306f9)
  • Loading branch information
bencodeorg committed Apr 1, 2022
2 parents 0dcedf6 + 3b4da96 commit 4c5b40f
Show file tree
Hide file tree
Showing 1,198 changed files with 60,012 additions and 22,129 deletions.
4 changes: 2 additions & 2 deletions apps/i18n/common/bg_bg.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/common/sk_sk.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/common/uk_ua.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/common/vi_vn.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/fish/bg_bg.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ar_sa.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/az_az.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/bg_bg.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/cs_cz.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/de_de.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/es_es.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/es_mx.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/fil_ph.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/fr_fr.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/hi_in.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/hu_hu.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/id_id.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/javalab/in_tl.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/it_it.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ja_jp.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/kn_in.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ko_kr.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/mr_in.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ms_my.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/nl_nl.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/javalab/pl_pl.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/pt_br.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/pt_pt.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ro_ro.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ru_ru.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/sk_sk.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ta_in.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/th_th.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/tr_tr.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/ur_pk.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/vi_vn.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/zh_cn.json
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/i18n/javalab/zh_tw.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/turtle/in_tl.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions apps/i18n/turtle/pl_pl.json
Git LFS file not shown
66 changes: 44 additions & 22 deletions apps/src/dance/DanceVisualizationColumn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import PropTypes from 'prop-types';
import Radium from 'radium';
import {connect} from 'react-redux';
import i18n from '@cdo/locale';
import AgeDialog, {signedOutOver13} from '../templates/AgeDialog';
import AgeDialog, {
ageDialogSelectedOver13,
songFilterOn
} from '../templates/AgeDialog';
import {getFilteredSongKeys} from '@cdo/apps/dance/songs';

const SongSelector = Radium(
class extends React.Component {
Expand All @@ -17,7 +21,7 @@ const SongSelector = Radium(
setSong: PropTypes.func.isRequired,
selectedSong: PropTypes.string,
songData: PropTypes.objectOf(PropTypes.object).isRequired,
filterOff: PropTypes.bool.isRequired
filterOn: PropTypes.bool.isRequired
};

changeSong = event => {
Expand All @@ -26,6 +30,15 @@ const SongSelector = Radium(
};

render() {
const {
selectedSong,
songData,
enableSongSelection,
filterOn
} = this.props;

const songKeys = getFilteredSongKeys(songData, filterOn);

return (
<div id="song-selector-wrapper">
<label>
Expand All @@ -35,17 +48,14 @@ const SongSelector = Radium(
id="song_selector"
style={styles.selectStyle}
onChange={this.changeSong}
value={this.props.selectedSong}
disabled={!this.props.enableSongSelection}
value={selectedSong}
disabled={!enableSongSelection}
>
{Object.keys(this.props.songData).map(
(option, i) =>
(this.props.filterOff || !this.props.songData[option].pg13) && (
<option key={i} value={option}>
{this.props.songData[option].title}
</option>
)
)}
{songKeys.map((option, i) => (
<option key={i} value={option}>
{songData[option].title}
</option>
))}
</select>
</div>
);
Expand All @@ -67,27 +77,39 @@ class DanceVisualizationColumn extends React.Component {
};

state = {
filterOff: this.setFilterStatus()
filterOn: this.getFilterStatus()
};

/*
Turn the song filter off
*/
turnFilterOff = () => {
this.setState({filterOff: true});
this.setState({filterOn: false});
};

/*
The filter defaults to on. If the user is over 13 (identified via account or anon dialog), filter turns off.
*/
setFilterStatus() {
getFilterStatus() {
const {userType, under13} = this.props;

// Check if song filter override is triggered and initialize song filter to true.
const songFilter = songFilterOn();
if (songFilter) {
return true;
}

// userType - 'teacher', 'student', 'unknown' - signed out users.
// under13 - boolean for signed in user representing age category. Teacher assumed > 13.
const signedInOver13 =
this.props.userType === 'teacher' ||
(this.props.userType === 'student' && !this.props.under13);
const signedOutAge = signedOutOver13();
return signedInOver13 || signedOutAge;
// If the user is signed out . . .
if (userType === 'unknown') {
// Query session key set from user selection in age dialog.
// Return false (no filter), if user is over 13.
return !ageDialogSelectedOver13();
}

// User is signed in (student or teacher) and the filter override is not turned on.
// Return true (filter should be turned on) if the user is under 13. Teachers assumed over13.
return under13;
}

render() {
Expand All @@ -112,7 +134,7 @@ class DanceVisualizationColumn extends React.Component {
setSong={this.props.setSong}
selectedSong={this.props.selectedSong}
songData={this.props.songData}
filterOff={this.state.filterOff}
filterOn={this.state.filterOn}
/>
)}
<ProtectedVisualizationDiv>
Expand Down
12 changes: 12 additions & 0 deletions apps/src/dance/songs.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,15 @@ export function parseSongOptions(songManifest) {
});
return songs;
}

// Given a songManifest, returns a list of keys that represent the songs to
// be displayed based on whether the song filter is on.
export function getFilteredSongKeys(fullSongManifest, filterOn) {
const allSongKeys = Object.keys(fullSongManifest);
if (filterOn) {
// Filter is on, only include songs that are not pg13.
return allSongKeys.filter(key => !fullSongManifest[key].pg13);
}
// Filter is off, all songs may be displayed.
return allSongKeys;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FontAwesome from '@cdo/apps/templates/FontAwesome';
import {
getGuideChildren,
organizeReferenceGuides
} from './referenceGuideHelpers';
} from '@cdo/apps/util/referenceGuideHelpers';
import Dialog, {
Title as DialogTitle,
Body as DialogBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ export default function ReferenceGuideEditor(props) {
<select
className="input"
value={referenceGuide.parent_reference_guide_key}
onChange={e =>
onChange={e => {
const value = e.target.value === 'null' ? null : e.target.value;
setReferenceGuide({
...referenceGuide,
parent_reference_guide_key: e.target.value
})
}
parent_reference_guide_key: value
});
}}
>
<option key={'null'} value="null">
No parent
</option>
{referenceGuides
.filter(guide => guide.key !== referenceGuide.key) // don't let a guide parent to itself
.sort((a, b) => a.key.localeCompare(b.key)) // sort alphabetically
Expand Down
6 changes: 5 additions & 1 deletion apps/src/sites/studio/pages/reference_guides/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import ReferenceGuideView from '@cdo/apps/templates/referenceGuides/ReferenceGui

$(() => {
const referenceGuide = getScriptData('referenceGuide');
const referenceGuides = getScriptData('referenceGuides');
ReactDOM.render(
<ReferenceGuideView referenceGuide={referenceGuide} />,
<ReferenceGuideView
referenceGuide={referenceGuide}
referenceGuides={referenceGuides}
/>,
document.getElementById('show-container')
);
});

0 comments on commit 4c5b40f

Please sign in to comment.