Commit a2a276a8 authored by Mike Greiling's avatar Mike Greiling

rename getEmojiCategoryMap and remove unnecessary parameter

parent 9d6bbc92
......@@ -133,7 +133,7 @@ export default class AwardsHandler {
this.isCreatingEmojiMenu = true;
// Render the first category
const categoryMap = Emoji.getEmojiByCategory();
const categoryMap = Emoji.getEmojiCategoryMap();
const categoryNameKey = Object.keys(categoryMap)[0];
const emojisInCategory = categoryMap[categoryNameKey];
const firstCategory = renderCategory(categoryLabelMap[categoryNameKey], emojisInCategory);
......@@ -173,7 +173,7 @@ export default class AwardsHandler {
}
this.isAddingRemainingEmojiMenuCategories = true;
const categoryMap = Emoji.getEmojiByCategory();
const categoryMap = Emoji.getEmojiCategoryMap();
// Avoid the jank and render the remaining categories separately
// This will take more time, but makes UI more responsive
......
......@@ -20,10 +20,10 @@ export function filterEmojiNamesByAlias(filter) {
return _.uniq(filterEmojiNames(filter).map(name => normalizeEmojiName(name)));
}
let emojiByCategory;
export function getEmojiByCategory(category = null) {
if (!emojiByCategory) {
emojiByCategory = {
let emojiCategoryMap;
export function getEmojiCategoryMap() {
if (!emojiCategoryMap) {
emojiCategoryMap = {
activity: [],
people: [],
nature: [],
......@@ -35,12 +35,12 @@ export function getEmojiByCategory(category = null) {
};
Object.keys(emojiMap).forEach((name) => {
const emoji = emojiMap[name];
if (emojiByCategory[emoji.category]) {
emojiByCategory[emoji.category].push(name);
if (emojiCategoryMap[emoji.category]) {
emojiCategoryMap[emoji.category].push(name);
}
});
}
return category ? emojiByCategory[category] : emojiByCategory;
return emojiCategoryMap;
}
export function getEmojiInfo(query) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment