@@ -9,6 +9,10 @@ import LibraryComponent from '../components/library/library.jsx';
9
9
10
10
import soundIcon from '../components/library-item/lib-icon--sound.svg' ;
11
11
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' ;
12
16
13
17
import { getSoundLibrary } from '../lib/libraries/tw-async-libraries' ;
14
18
import soundTags from '../lib/libraries/sound-tags' ;
@@ -26,14 +30,23 @@ const messages = defineMessages({
26
30
const PM_LIBRARY_API = "https://library.penguinmod.com/" ;
27
31
28
32
// @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 ;
30
43
const {
31
44
md5ext,
32
45
...otherData
33
46
} = sound ;
34
47
return {
35
48
_md5 : md5ext ,
36
- rawURL : isRtl ? soundIconRtl : soundIcon ,
49
+ rawURL : isTheme ? icons . theme : ( isLoop ? icons . loop : icons . sound ) ,
37
50
...otherData
38
51
} ;
39
52
} ) ;
0 commit comments