Remove frequentlyUsedEmoji defaults

This commit is contained in:
Alex Gleason 2024-11-18 11:11:00 -06:00
parent 181ffc75cc
commit 8ad449cb13
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 1 additions and 27 deletions

View File

@ -55,41 +55,15 @@ export interface IEmojiPickerDropdown {
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',
];
export const getFrequentlyUsedEmojis = createSelector([ export const getFrequentlyUsedEmojis = createSelector([
(state: RootState) => state.settings.get('frequentlyUsedEmojis', ImmutableMap()), (state: RootState) => state.settings.get('frequentlyUsedEmojis', ImmutableMap()),
], (emojiCounters: ImmutableMap<string, number>) => { ], (emojiCounters: ImmutableMap<string, number>) => {
let emojis = emojiCounters return 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) {
const uniqueDefaults = DEFAULTS.filter(emoji => !emojis.includes(emoji));
emojis = emojis.concat(uniqueDefaults.slice(0, DEFAULTS.length - emojis.length));
}
return emojis;
}); });
/** Filter custom emojis to only ones visible in the picker, and sort them alphabetically. */ /** Filter custom emojis to only ones visible in the picker, and sort them alphabetically. */