Skip to content

Commit 01e4522

Browse files
committed
add new sounds & add sep icons for themes & loops
1 parent 679efc9 commit 01e4522

File tree

6 files changed

+670
-2
lines changed

6 files changed

+670
-2
lines changed
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 9 additions & 0 deletions
Loading

src/containers/sound-library.jsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import LibraryComponent from '../components/library/library.jsx';
99

1010
import soundIcon from '../components/library-item/lib-icon--sound.svg';
1111
import soundIconRtl from '../components/library-item/lib-icon--sound-rtl.svg';
12+
import loopIcon from '../components/library-item/lib-icon--loop.svg';
13+
import loopIconRtl from '../components/library-item/lib-icon--loop-rtl.svg';
14+
import themeIcon from '../components/library-item/lib-icon--theme.svg';
15+
import themeIconRtl from '../components/library-item/lib-icon--theme-rtl.svg';
1216

1317
import {getSoundLibrary} from '../lib/libraries/tw-async-libraries';
1418
import soundTags from '../lib/libraries/sound-tags';
@@ -26,14 +30,23 @@ const messages = defineMessages({
2630
const PM_LIBRARY_API = "https://library.penguinmod.com/";
2731

2832
// @todo need to use this hack to avoid library using md5 for image
29-
const getSoundLibraryThumbnailData = (soundLibraryContent, isRtl) => soundLibraryContent.map(sound => {
33+
const getSoundLibraryThumbnailData = (soundLibraryContent, isRtl) => soundLibraryContent
34+
.sort((a, b) => a.name.localeCompare(b.name))
35+
.map(sound => {
36+
const icons = {
37+
sound: isRtl ? soundIconRtl : soundIcon,
38+
loop: isRtl ? loopIconRtl : loopIcon,
39+
theme: isRtl ? themeIconRtl : themeIcon,
40+
};
41+
const isLoop = sound.tags ? sound.tags.includes('loops') : false;
42+
const isTheme = sound.tags ? sound.tags.includes('themes') : false;
3043
const {
3144
md5ext,
3245
...otherData
3346
} = sound;
3447
return {
3548
_md5: md5ext,
36-
rawURL: isRtl ? soundIconRtl : soundIcon,
49+
rawURL: isTheme ? icons.theme : (isLoop ? icons.loop : icons.sound),
3750
...otherData
3851
};
3952
});

0 commit comments

Comments
 (0)