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

Make gamelab and spritelab animation libraries use the same category previews again #38608

Merged
merged 5 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"animationCategory_characters": "Characters",
"animationCategory_environment": "Environment",
"animationCategory_food": "Food",
"animationCategory_game_blocks": "Game Blocks",
"animationCategory_game_blocks": "Video Games",
"animationCategory_game_text": "Game Text",
"animationCategory_games": "Games",
"animationCategory_gameplay": "Gameplay",
Expand Down
2 changes: 0 additions & 2 deletions apps/src/p5lab/AnimationPicker/AnimationPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class AnimationPicker extends React.Component {
defaultQuery: PropTypes.object,
hideBackgrounds: PropTypes.bool.isRequired,
canDraw: PropTypes.bool.isRequired,
categoryImagePathPrefix: PropTypes.string,

// Provided via Redux
visible: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -86,7 +85,6 @@ class AnimationPicker extends React.Component {
defaultQuery={this.props.defaultQuery}
hideBackgrounds={this.props.hideBackgrounds}
canDraw={this.props.canDraw}
categoryImagePathPrefix={this.props.categoryImagePathPrefix}
/>
);
}
Expand Down
4 changes: 1 addition & 3 deletions apps/src/p5lab/AnimationPicker/AnimationPickerBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export default class AnimationPickerBody extends React.Component {
navigable: PropTypes.bool.isRequired,
defaultQuery: PropTypes.object,
hideBackgrounds: PropTypes.bool.isRequired,
canDraw: PropTypes.bool.isRequired,
categoryImagePathPrefix: PropTypes.string
canDraw: PropTypes.bool.isRequired
};

state = {
Expand Down Expand Up @@ -176,7 +175,6 @@ export default class AnimationPickerBody extends React.Component {
}
category={category}
onClick={this.onCategoryChange}
categoryImagePathPrefix={this.props.categoryImagePathPrefix}
/>
));
}
Expand Down
7 changes: 4 additions & 3 deletions apps/src/p5lab/AnimationPicker/AnimationPickerListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class AnimationPickerListItem extends React.Component {
label: PropTypes.string,
onClick: PropTypes.func,
playAnimations: PropTypes.bool,
category: PropTypes.string,
categoryImagePathPrefix: PropTypes.string
category: PropTypes.string
};

state = {
Expand All @@ -91,7 +90,9 @@ class AnimationPickerListItem extends React.Component {
}
];
const iconImageSrc = this.props.category
? this.props.categoryImagePathPrefix + `${this.props.category}.png`
? `/blockly/media/p5lab/animation-previews/category_${
this.props.category
}.png`
: '';

return (
Expand Down
2 changes: 0 additions & 2 deletions apps/src/p5lab/AnimationTab/AnimationTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class AnimationTab extends React.Component {
hideUploadOption: PropTypes.bool.isRequired,
hideAnimationNames: PropTypes.bool.isRequired,
hideBackgrounds: PropTypes.bool.isRequired,
categoryImagePathPrefix: PropTypes.string,

// Provided by Redux
columnSizes: PropTypes.arrayOf(PropTypes.number).isRequired,
Expand Down Expand Up @@ -108,7 +107,6 @@ class AnimationTab extends React.Component {
navigable={true}
canDraw={true}
hideBackgrounds={this.props.hideBackgrounds}
categoryImagePathPrefix={this.props.categoryImagePathPrefix}
/>
)}
</div>
Expand Down
12 changes: 0 additions & 12 deletions apps/src/p5lab/P5LabView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ class P5LabView extends React.Component {
});
}

// TODO(JillianK): Remove this function and all uses of it once new sprites have been added to the Spritelab animaion library.
// Jira context: https://codedotorg.atlassian.net/browse/STAR-1319
generateCategoryImagePathPrefix() {
return this.props.spriteLab
? '/blockly/media/spritelab/animation-previews-spritelab/category_'
: '/blockly/media/gamelab/animation-previews-gamelab/category_';
}

renderCodeMode() {
const {
interfaceMode,
Expand Down Expand Up @@ -111,7 +103,6 @@ class P5LabView extends React.Component {
// we don't want students to be able to draw their own backgrounds in spritelab so if we're showing
// backgrounds alone, we must be in spritelab and we should get rid of the draw your own option
const canDraw = !this.props.isBackground;
const categoryImagePathPrefix = this.generateCategoryImagePathPrefix();
return (
<div style={codeModeStyle}>
<div
Expand All @@ -135,7 +126,6 @@ class P5LabView extends React.Component {
defaultQuery={this.props.isBackground ? defaultQuery : undefined}
hideBackgrounds={hideBackgrounds}
canDraw={canDraw}
categoryImagePathPrefix={categoryImagePathPrefix}
/>
)}
</div>
Expand All @@ -157,7 +147,6 @@ class P5LabView extends React.Component {

renderAnimationMode() {
const {allowAnimationMode, interfaceMode} = this.props;
const categoryImagePathPrefix = this.generateCategoryImagePathPrefix();
return allowAnimationMode &&
interfaceMode === P5LabInterfaceMode.ANIMATION ? (
<AnimationTab
Expand All @@ -166,7 +155,6 @@ class P5LabView extends React.Component {
hideUploadOption={this.props.spriteLab}
hideAnimationNames={this.props.spriteLab}
hideBackgrounds={this.props.spriteLab}
categoryImagePathPrefix={categoryImagePathPrefix}
/>
) : (
undefined
Expand Down
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.