Skip to content

Commit e2f1e37

Browse files
authored
Merge pull request #3478 from LLK/tutorial-tags
Add tutorial filters and tags, and fix translated search in libraries
2 parents 4fd0019 + 9ff25ab commit e2f1e37

File tree

5 files changed

+53
-4
lines changed

5 files changed

+53
-4
lines changed

src/components/library/library.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ class LibraryComponent extends React.Component {
9898
(dataItem.tags || [])
9999
// Second argument to map sets `this`
100100
.map(String.prototype.toLowerCase.call, String.prototype.toLowerCase)
101-
.concat(dataItem.name.toLowerCase())
101+
.concat((typeof dataItem.name === 'string' ?
102+
// Use the name if it is a string, else use formatMessage to get the translated name
103+
dataItem.name : this.props.intl.formatMessage(dataItem.name.props)
104+
).toLowerCase())
102105
.join('\n') // unlikely to partially match newlines
103106
.indexOf(this.state.filterQuery.toLowerCase()) !== -1
104107
));

src/containers/tips-library.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44
import {injectIntl, intlShape, defineMessages} from 'react-intl';
55

66
import decksLibraryContent from '../lib/libraries/decks/index.jsx';
7+
import tutorialTags from '../lib/libraries/tutorial-tags';
78

89
import analytics from '../lib/analytics';
910
import LibraryComponent from '../components/library/library.jsx';
@@ -46,15 +47,17 @@ class TipsLibrary extends React.PureComponent {
4647
rawURL: decksLibraryContent[id].img,
4748
id: id,
4849
name: decksLibraryContent[id].name,
49-
featured: true
50+
featured: true,
51+
tags: decksLibraryContent[id].tags
5052
}));
5153

5254
if (!this.props.visible) return null;
5355
return (
5456
<LibraryComponent
57+
filterable
5558
data={decksLibraryThumbnailData}
56-
filterable={false}
5759
id="tipsLibrary"
60+
tags={tutorialTags}
5861
title={this.props.intl.formatMessage(messages.tipsLibraryTitle)}
5962
visible={this.props.visible}
6063
onItemSelected={this.handleItemSelect}

src/lib/libraries/decks/index.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default {
9797
id="gui.howtos.intro-move-sayhello-hat.name"
9898
/>
9999
),
100-
100+
tags: ['help', 'stuck', 'how', 'can', 'say'],
101101
img: libraryIntro,
102102
steps: [{
103103
video: 'intro-move-sayhello'
@@ -359,6 +359,7 @@ export default {
359359
/>
360360
),
361361
img: libraryAnimate,
362+
tags: ['animation', 'art', 'spin', 'grow'],
362363
steps: [{
363364
video: 'animate-a-name'
364365
}, {
@@ -433,6 +434,7 @@ export default {
433434
/>
434435
),
435436
img: libraryMakeMusic,
437+
tags: ['music', 'sound', 'instrument', 'play', 'song', 'band'],
436438
steps: [{
437439
video: 'Make-Music'
438440
},
@@ -501,6 +503,7 @@ export default {
501503
/>
502504
),
503505
img: libraryMakeAGame,
506+
tags: ['games', 'click', 'clicked', 'score'],
504507
steps: [{
505508
video: 'Make-A-Game'
506509
},
@@ -587,6 +590,7 @@ export default {
587590
/>
588591
),
589592
img: libraryChaseGame,
593+
tags: ['games', 'arrow', 'keyboard', 'score'],
590594
steps: [{
591595
video: 'Chase-Game'
592596
},
@@ -689,6 +693,7 @@ export default {
689693
/>
690694
),
691695
img: libraryAddSprite,
696+
tags: ['art', 'games', 'stories', 'character'],
692697
steps: [
693698
{
694699
title: (
@@ -718,6 +723,7 @@ export default {
718723
/>
719724
),
720725
img: addBackdropThumb,
726+
tags: ['art', 'games', 'stories', 'background'],
721727
steps: [{
722728
video: 'add-a-backdrop'
723729
}, {
@@ -737,6 +743,7 @@ export default {
737743
/>
738744
),
739745
img: changeSizeThumb,
746+
scale: ['art', 'animation', 'scale'],
740747
steps: [{
741748
video: 'change-size'
742749
}, {
@@ -756,6 +763,7 @@ export default {
756763
/>
757764
),
758765
img: glideAroundThumb,
766+
tags: ['animation', 'stories', 'music', 'instrument', 'play', 'song', 'band'],
759767
steps: [{
760768
video: 'glide-around'
761769
}, {
@@ -775,6 +783,7 @@ export default {
775783
id="gui.howtos.record-a-sound.name"
776784
/>
777785
),
786+
tags: ['music', 'games', 'stories'],
778787
img: recordASound,
779788
steps: [{
780789
video: 'record-a-sound'
@@ -795,6 +804,7 @@ export default {
795804
/>
796805
),
797806
img: spinThumb,
807+
tags: ['animation', 'rotate', 'rotation'],
798808
steps: [{
799809
video: 'spin-video'
800810
}, {
@@ -814,6 +824,7 @@ export default {
814824
/>
815825
),
816826
img: hideAndShowThumb,
827+
tags: ['stories', 'appear', 'disappear'],
817828
steps: [{
818829
video: 'hide-and-show'
819830
}, {
@@ -834,6 +845,7 @@ export default {
834845
/>
835846
),
836847
img: switchCostumeThumb,
848+
tags: ['animation', 'art', 'games', 'stories', 'paint', 'edit', 'change', 'character', 'sprite'],
837849
steps: [{
838850
video: 'switch-costume'
839851
}, {
@@ -854,6 +866,7 @@ export default {
854866
/>
855867
),
856868
img: moveArrowKeysThumb,
869+
tags: ['games', 'keyboard'],
857870
steps: [{
858871
video: 'move-around-with-arrow-keys'
859872
}, {
@@ -872,6 +885,8 @@ export default {
872885
id="gui.howtos.add-effects.name"
873886
/>
874887
),
888+
tags: ['animation', 'art', 'games', 'stories', '8-bit', 'brightness', 'ghost', 'transparency', 'opacity',
889+
'fx', 'color', 'fisheye', 'whirl', 'twist', 'pixelate', 'mosaic', '8bit'],
875890
img: addEffectsThumb,
876891
steps: [{
877892
video: 'add-effects'

src/lib/libraries/tag-messages.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,25 @@ export default defineMessages({
100100
defaultMessage: 'Wacky',
101101
description: 'Tag for filtering a library for wacky',
102102
id: 'gui.libraryTags.wacky'
103+
},
104+
animation: {
105+
defaultMessage: 'Animation',
106+
description: 'Tag for filtering a library for animation',
107+
id: 'gui.libraryTags.animation'
108+
},
109+
art: {
110+
defaultMessage: 'Art',
111+
description: 'Tag for filtering a library for art',
112+
id: 'gui.libraryTags.art'
113+
},
114+
games: {
115+
defaultMessage: 'Games',
116+
description: 'Tag for filtering a library for games',
117+
id: 'gui.libraryTags.games'
118+
},
119+
stories: {
120+
defaultMessage: 'Stories',
121+
description: 'Tag for filtering a library for stories',
122+
id: 'gui.libraryTags.stories'
103123
}
104124
});

src/lib/libraries/tutorial-tags.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import messages from './tag-messages.js';
2+
export default [
3+
{tag: 'animation', intlLabel: messages.animation},
4+
{tag: 'art', intlLabel: messages.art},
5+
{tag: 'music', intlLabel: messages.music},
6+
{tag: 'games', intlLabel: messages.games},
7+
{tag: 'stories', intlLabel: messages.stories}
8+
];

0 commit comments

Comments
 (0)