Skip to content

Commit

Permalink
Merge pull request #43735 from code-dot-org/dtl_candidate_91251e73
Browse files Browse the repository at this point in the history
  • Loading branch information
deploy-code-org committed Nov 19, 2021
2 parents d429d0c + c836a72 commit b9c204d
Show file tree
Hide file tree
Showing 386 changed files with 176,877 additions and 120,730 deletions.
1 change: 1 addition & 0 deletions apps/i18n/javalab/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"invalidJavaFilename": "Invalid file name. Java file names cannot have spaces.",
"generatingResults": "Generating results...",
"javaExtensionMissing": "Invalid file name. File names must end in '.java'.",
"javabuilderInvalidClassError": "{causeMessage} is not supported by Java Lab.",
"javabuilderJavaFilenameError": "Java file: {causeMessage} has an invalid file name. Java file names cannot contain spaces or special characters.",
"javabuilderMissingFilenameError": "One or more of your project files are missing file names.",
"markComplete": "Mark Complete",
Expand Down
9 changes: 9 additions & 0 deletions apps/src/assetManagement/animationLibraryApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export function updateDefaultList(listData) {
});
}

// Returns the metadata of the list of default sprites in SpriteLab in English
export function getDefaultListMetadata() {
return fetch('/api/v1/animation-library/default-spritelab-metadata')
.then(response => response.json())
.catch(err => {
return Promise.reject(err);
});
}

export function createDefaultSpriteMetadata(listData) {
let orderedKeys = [];
let propsByKey = {};
Expand Down
15 changes: 14 additions & 1 deletion apps/src/code-studio/components/header/ProjectUpdatedAt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ import RetryProjectSaveDialog from './RetryProjectSaveDialog';
class ProjectUpdatedAt extends React.Component {
static propTypes = {
status: PropTypes.oneOf(Object.values(statuses)),
updatedAt: PropTypes.string
updatedAt: PropTypes.string,
onContentUpdated: PropTypes.func
};

componentDidMount() {
if (this.props.onContentUpdated) {
this.props.onContentUpdated();
}
}

componentDidUpdate() {
if (this.props.onContentUpdated) {
this.props.onContentUpdated();
}
}

renderText() {
if (this.props.status === statuses.error) {
return (
Expand Down
8 changes: 7 additions & 1 deletion apps/src/code-studio/components/header/ScriptName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class ScriptName extends React.Component {
);
}

onProjectUpdatedAtContentUpdated = () => {
this.setDesiredWidth();
};

renderScriptLink() {
let className = 'header_text';
if (this.props.smallText) {
Expand Down Expand Up @@ -101,7 +105,9 @@ class ScriptName extends React.Component {
<div style={styles.outerContainer}>
<div style={styles.containerWithUpdatedAt}>
{this.renderScriptLink()}
<ProjectUpdatedAt />
<ProjectUpdatedAt
onContentUpdated={this.onProjectUpdatedAtContentUpdated}
/>
</div>
</div>
</div>
Expand Down
114 changes: 56 additions & 58 deletions apps/src/code-studio/components/progress/MiniView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,68 @@ import {hasGroups} from '@cdo/apps/code-studio/progressRedux';
/**
* The course progress dropdown you get when you click the arrow in the header.
*/
class MiniView extends React.Component {
static propTypes = {
linesOfCodeText: PropTypes.string,
minimal: PropTypes.bool,
function MiniView(props) {
const {
linesOfCodeText,
isSummaryView,
hasGroups,
scriptName,
hasFullProgress,
selectedSectionId,
minimal
} = props;

// redux backed
isSummaryView: PropTypes.bool.isRequired,
hasGroups: PropTypes.bool.isRequired,
scriptName: PropTypes.string.isRequired,
hasFullProgress: PropTypes.bool.isRequired,
selectedSectionId: PropTypes.string
};

render() {
const {
linesOfCodeText,
isSummaryView,
hasGroups,
scriptName,
hasFullProgress,
selectedSectionId,
minimal
} = this.props;

let body;
if (!hasFullProgress) {
// Ideally we would specify inline CSS instead of using a classname here,
// but the image used here gets digested by rails, and we don't know the
// digested path
body = <div className="loading" style={{height: minimal ? 100 : 400}} />;
} else {
body = (
<div
className="mini-view"
style={{
...(!hasGroups && !isSummaryView && styles.detailView),
...(hasGroups && styles.groupView)
}}
>
<UnitOverview
onOverviewPage={false}
excludeCsfColumnInLegend={false}
teacherResources={[]}
minimal={minimal}
/>
</div>
);
}

return (
<div>
{!minimal && (
<MiniViewTopRow
scriptName={scriptName}
linesOfCodeText={linesOfCodeText}
selectedSectionId={selectedSectionId}
/>
)}
{body}
let body;
if (!hasFullProgress) {
// Ideally we would specify inline CSS instead of using a classname here,
// but the image used here gets digested by rails, and we don't know the
// digested path
body = <div className="loading" style={{height: minimal ? 100 : 400}} />;
} else {
body = (
<div
className="mini-view"
style={{
...(!hasGroups && !isSummaryView && styles.detailView),
...(hasGroups && styles.groupView)
}}
>
<UnitOverview
onOverviewPage={false}
excludeCsfColumnInLegend={false}
teacherResources={[]}
minimal={minimal}
/>
</div>
);
}

return (
<div>
{!minimal && (
<MiniViewTopRow
scriptName={scriptName}
linesOfCodeText={linesOfCodeText}
selectedSectionId={selectedSectionId}
/>
)}
{body}
</div>
);
}

MiniView.propTypes = {
linesOfCodeText: PropTypes.string,
minimal: PropTypes.bool,

// redux backed
isSummaryView: PropTypes.bool.isRequired,
hasGroups: PropTypes.bool.isRequired,
scriptName: PropTypes.string.isRequired,
hasFullProgress: PropTypes.bool.isRequired,
selectedSectionId: PropTypes.string
};

const styles = {
// For the detail view (without groups) we want some margins
detailView: {
Expand Down
25 changes: 13 additions & 12 deletions apps/src/code-studio/progressRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const CLEAR_RESULTS = 'progress/CLEAR_RESULTS';
const MERGE_RESULTS = 'progress/MERGE_RESULTS';
const MERGE_PEER_REVIEW_PROGRESS = 'progress/MERGE_PEER_REVIEW_PROGRESS';
const UPDATE_FOCUS_AREAS = 'progress/UPDATE_FOCUS_AREAS';
const SHOW_TEACHER_INFO = 'progress/SHOW_TEACHER_INFO';
const DISABLE_POST_MILESTONE = 'progress/DISABLE_POST_MILESTONE';
const SET_IS_HOC_UNIT = 'progress/SET_IS_HOC_UNIT';
const SET_IS_AGE_13_REQUIRED = 'progress/SET_IS_AGE_13_REQUIRED';
const SET_IS_SUMMARY_VIEW = 'progress/SET_IS_SUMMARY_VIEW';
const SET_IS_MINI_VIEW = 'progress/SET_IS_MINI_VIEW';
const SET_STUDENT_DEFAULTS_SUMMARY_VIEW =
'progress/SET_STUDENT_DEFAULTS_SUMMARY_VIEW';
const SET_CURRENT_LESSON_ID = 'progress/SET_CURRENT_LESSON_ID';
Expand Down Expand Up @@ -64,13 +64,13 @@ const initialState = {
focusAreaLessonIds: [],
peerReviewLessonInfo: null,
peerReviewsPerformed: [],
showTeacherInfo: false,
postMilestoneDisabled: false,
isHocScript: null,
isAge13Required: false,
// Do students see summary view by default?
studentDefaultsSummaryView: true,
isSummaryView: true,
isMiniView: false,
hasFullProgress: false,
lessonExtrasEnabled: false,
// Note: usingDbProgress === "user is logged in". However, it is
Expand Down Expand Up @@ -183,13 +183,6 @@ export default function reducer(state = initialState, action) {
};
}

if (action.type === SHOW_TEACHER_INFO) {
return {
...state,
showTeacherInfo: true
};
}

if (action.type === DISABLE_POST_MILESTONE) {
return {
...state,
Expand Down Expand Up @@ -218,6 +211,13 @@ export default function reducer(state = initialState, action) {
};
}

if (action.type === SET_IS_MINI_VIEW) {
return {
...state,
isMiniView: action.isMiniView
};
}

if (action.type === SET_STUDENT_DEFAULTS_SUMMARY_VIEW) {
return {
...state,
Expand Down Expand Up @@ -358,7 +358,6 @@ const userProgressFromServer = (state, dispatch, userId = null) => {
) {
// Default to summary view if teacher is viewing their student, otherwise default to detail view.
dispatch(setIsSummaryView(data.teacherViewingStudent));
dispatch(showTeacherInfo());
}

if (data.focusAreaLessonIds) {
Expand Down Expand Up @@ -475,8 +474,6 @@ export const updateFocusArea = (changeFocusAreaPath, focusAreaLessonIds) => ({
focusAreaLessonIds
});

export const showTeacherInfo = () => ({type: SHOW_TEACHER_INFO});

export const disablePostMilestone = () => ({type: DISABLE_POST_MILESTONE});
export const setIsHocScript = isHocScript => ({
type: SET_IS_HOC_UNIT,
Expand All @@ -490,6 +487,10 @@ export const setIsSummaryView = isSummaryView => ({
type: SET_IS_SUMMARY_VIEW,
isSummaryView
});
export const setIsMiniView = isMiniView => ({
type: SET_IS_MINI_VIEW,
isMiniView
});
export const setStudentDefaultsSummaryView = studentDefaultsSummaryView => ({
type: SET_STUDENT_DEFAULTS_SUMMARY_VIEW,
studentDefaultsSummaryView
Expand Down
1 change: 1 addition & 0 deletions apps/src/javalab/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const JavabuilderExceptionType = {
INTERNAL_COMPILER_EXCEPTION: 'INTERNAL_COMPILER_EXCEPTION',
INTERNAL_EXCEPTION: 'INTERNAL_EXCEPTION',
INTERNAL_RUNTIME_EXCEPTION: 'INTERNAL_RUNTIME_EXCEPTION',
INVALID_CLASS: 'INVALID_CLASS',
INVALID_JAVA_FILE_NAME: 'INVALID_JAVA_FILE_NAME',
JAVA_EXTENSION_MISSING: 'JAVA_EXTENSION_MISSING',
MISSING_PROJECT_FILE_NAME: 'MISSING_PROJECT_FILE_NAME',
Expand Down
3 changes: 3 additions & 0 deletions apps/src/javalab/javabuilderExceptionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export function handleException(exceptionDetails, callback) {
case JavabuilderExceptionType.MISSING_PROJECT_FILE_NAME:
error = msg.javabuilderMissingFilenameError();
break;
case JavabuilderExceptionType.INVALID_CLASS:
error = msg.javabuilderInvalidClassError({causeMessage});
break;

// Internal exceptions
case JavabuilderExceptionType.INTERNAL_RUNTIME_EXCEPTION:
Expand Down

0 comments on commit b9c204d

Please sign in to comment.