Group emojis only by pack and remove pack: prefix

Ref: grouped-emoji-picker
This commit is contained in:
Tusooa Zhu 2021-10-08 15:30:55 -04:00
parent 55ecabf3a3
commit 2186bd83a6
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
1 changed files with 7 additions and 1 deletions

View File

@ -115,9 +115,15 @@ const instance = {
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
},
groupedCustomEmojis (state) {
const packsOf = emoji => {
return emoji.tags
.filter(k => k.startsWith('pack:'))
.map(k => k.slice(5)) // remove 'pack:' prefix
}
return state.customEmoji
.reduce((res, emoji) => {
emoji.tags.forEach(packName => {
packsOf(emoji).forEach(packName => {
const packId = `custom-${packName}`
if (!res[packId]) {
res[packId] = ({