mirror of https://github.com/mastodon/mastodon
parent
bebaa6eced
commit
9815be2a44
|
@ -8,15 +8,41 @@ import { useEmoji } from '../../../actions/emojis';
|
||||||
const perLine = 8;
|
const perLine = 8;
|
||||||
const lines = 2;
|
const lines = 2;
|
||||||
|
|
||||||
|
const DEFAULTS = [
|
||||||
|
'+1',
|
||||||
|
'grinning',
|
||||||
|
'kissing_heart',
|
||||||
|
'heart_eyes',
|
||||||
|
'laughing',
|
||||||
|
'stuck_out_tongue_winking_eye',
|
||||||
|
'sweat_smile',
|
||||||
|
'joy',
|
||||||
|
'yum',
|
||||||
|
'disappointed',
|
||||||
|
'thinking_face',
|
||||||
|
'weary',
|
||||||
|
'sob',
|
||||||
|
'sunglasses',
|
||||||
|
'heart',
|
||||||
|
'ok_hand',
|
||||||
|
];
|
||||||
|
|
||||||
const getFrequentlyUsedEmojis = createSelector([
|
const getFrequentlyUsedEmojis = createSelector([
|
||||||
state => state.getIn(['settings', 'frequentlyUsedEmojis'], ImmutableMap()),
|
state => state.getIn(['settings', 'frequentlyUsedEmojis'], ImmutableMap()),
|
||||||
], emojiCounters => emojiCounters
|
], emojiCounters => {
|
||||||
|
let emojis = emojiCounters
|
||||||
.keySeq()
|
.keySeq()
|
||||||
.sort((a, b) => emojiCounters.get(a) - emojiCounters.get(b))
|
.sort((a, b) => emojiCounters.get(a) - emojiCounters.get(b))
|
||||||
.reverse()
|
.reverse()
|
||||||
.slice(0, perLine * lines)
|
.slice(0, perLine * lines)
|
||||||
.toArray()
|
.toArray();
|
||||||
);
|
|
||||||
|
if (emojis.length < DEFAULTS.length) {
|
||||||
|
emojis = emojis.concat(DEFAULTS.slice(0, DEFAULTS.length - emojis.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
return emojis;
|
||||||
|
});
|
||||||
|
|
||||||
const getCustomEmojis = createSelector([
|
const getCustomEmojis = createSelector([
|
||||||
state => state.get('custom_emojis'),
|
state => state.get('custom_emojis'),
|
||||||
|
|
Loading…
Reference in New Issue