Skip to content

Commit 9ff25ab

Browse files
committed
Add tutorial filters and tags, and fix translated search in libraries
1 parent d1024cd commit 9ff25ab

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
@@ -71,7 +71,7 @@ export default {
7171
id="gui.howtos.intro-move-sayhello-hat.name"
7272
/>
7373
),
74-
74+
tags: ['help', 'stuck', 'how', 'can', 'say'],
7575
img: libraryIntro,
7676
steps: [{
7777
video: 'intro-move-sayhello'
@@ -111,6 +111,7 @@ export default {
111111
/>
112112
),
113113
img: libraryAnimate,
114+
tags: ['animation', 'art', 'spin', 'grow'],
114115
steps: [{
115116
video: 'animate-a-name'
116117
}, {
@@ -185,6 +186,7 @@ export default {
185186
/>
186187
),
187188
img: libraryMakeMusic,
189+
tags: ['music', 'sound', 'instrument', 'play', 'song', 'band'],
188190
steps: [{
189191
video: 'Make-Music'
190192
},
@@ -253,6 +255,7 @@ export default {
253255
/>
254256
),
255257
img: libraryMakeAGame,
258+
tags: ['games', 'click', 'clicked', 'score'],
256259
steps: [{
257260
video: 'Make-A-Game'
258261
},
@@ -339,6 +342,7 @@ export default {
339342
/>
340343
),
341344
img: libraryChaseGame,
345+
tags: ['games', 'arrow', 'keyboard', 'score'],
342346
steps: [{
343347
video: 'Chase-Game'
344348
},
@@ -441,6 +445,7 @@ export default {
441445
/>
442446
),
443447
img: libraryAddSprite,
448+
tags: ['art', 'games', 'stories', 'character'],
444449
steps: [
445450
{
446451
title: (
@@ -470,6 +475,7 @@ export default {
470475
/>
471476
),
472477
img: addBackdropThumb,
478+
tags: ['art', 'games', 'stories', 'background'],
473479
steps: [{
474480
video: 'add-a-backdrop'
475481
}, {
@@ -489,6 +495,7 @@ export default {
489495
/>
490496
),
491497
img: changeSizeThumb,
498+
scale: ['art', 'animation', 'scale'],
492499
steps: [{
493500
video: 'change-size'
494501
}, {
@@ -508,6 +515,7 @@ export default {
508515
/>
509516
),
510517
img: glideAroundThumb,
518+
tags: ['animation', 'stories', 'music', 'instrument', 'play', 'song', 'band'],
511519
steps: [{
512520
video: 'glide-around'
513521
}, {
@@ -527,6 +535,7 @@ export default {
527535
id="gui.howtos.record-a-sound.name"
528536
/>
529537
),
538+
tags: ['music', 'games', 'stories'],
530539
img: recordASound,
531540
steps: [{
532541
video: 'record-a-sound'
@@ -547,6 +556,7 @@ export default {
547556
/>
548557
),
549558
img: spinThumb,
559+
tags: ['animation', 'rotate', 'rotation'],
550560
steps: [{
551561
video: 'spin-video'
552562
}, {
@@ -566,6 +576,7 @@ export default {
566576
/>
567577
),
568578
img: hideAndShowThumb,
579+
tags: ['stories', 'appear', 'disappear'],
569580
steps: [{
570581
video: 'hide-and-show'
571582
}, {
@@ -586,6 +597,7 @@ export default {
586597
/>
587598
),
588599
img: switchCostumeThumb,
600+
tags: ['animation', 'art', 'games', 'stories', 'paint', 'edit', 'change', 'character', 'sprite'],
589601
steps: [{
590602
video: 'switch-costume'
591603
}, {
@@ -606,6 +618,7 @@ export default {
606618
/>
607619
),
608620
img: moveArrowKeysThumb,
621+
tags: ['games', 'keyboard'],
609622
steps: [{
610623
video: 'move-around-with-arrow-keys'
611624
}, {
@@ -624,6 +637,8 @@ export default {
624637
id="gui.howtos.add-effects.name"
625638
/>
626639
),
640+
tags: ['animation', 'art', 'games', 'stories', '8-bit', 'brightness', 'ghost', 'transparency', 'opacity',
641+
'fx', 'color', 'fisheye', 'whirl', 'twist', 'pixelate', 'mosaic', '8bit'],
627642
img: addEffectsThumb,
628643
steps: [{
629644
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)