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 { ...@@ -133,7 +133,7 @@ export default class AwardsHandler {
this.isCreatingEmojiMenu = true; this.isCreatingEmojiMenu = true;
// Render the first category // Render the first category
const categoryMap = Emoji.getEmojiByCategory(); const categoryMap = Emoji.getEmojiCategoryMap();
const categoryNameKey = Object.keys(categoryMap)[0]; const categoryNameKey = Object.keys(categoryMap)[0];
const emojisInCategory = categoryMap[categoryNameKey]; const emojisInCategory = categoryMap[categoryNameKey];
const firstCategory = renderCategory(categoryLabelMap[categoryNameKey], emojisInCategory); const firstCategory = renderCategory(categoryLabelMap[categoryNameKey], emojisInCategory);
...@@ -173,7 +173,7 @@ export default class AwardsHandler { ...@@ -173,7 +173,7 @@ export default class AwardsHandler {
} }
this.isAddingRemainingEmojiMenuCategories = true; this.isAddingRemainingEmojiMenuCategories = true;
const categoryMap = Emoji.getEmojiByCategory(); const categoryMap = Emoji.getEmojiCategoryMap();
// Avoid the jank and render the remaining categories separately // Avoid the jank and render the remaining categories separately
// This will take more time, but makes UI more responsive // This will take more time, but makes UI more responsive
......
...@@ -20,10 +20,10 @@ export function filterEmojiNamesByAlias(filter) { ...@@ -20,10 +20,10 @@ export function filterEmojiNamesByAlias(filter) {
return _.uniq(filterEmojiNames(filter).map(name => normalizeEmojiName(name))); return _.uniq(filterEmojiNames(filter).map(name => normalizeEmojiName(name)));
} }
let emojiByCategory; let emojiCategoryMap;
export function getEmojiByCategory(category = null) { export function getEmojiCategoryMap() {
if (!emojiByCategory) { if (!emojiCategoryMap) {
emojiByCategory = { emojiCategoryMap = {
activity: [], activity: [],
people: [], people: [],
nature: [], nature: [],
...@@ -35,12 +35,12 @@ export function getEmojiByCategory(category = null) { ...@@ -35,12 +35,12 @@ export function getEmojiByCategory(category = null) {
}; };
Object.keys(emojiMap).forEach((name) => { Object.keys(emojiMap).forEach((name) => {
const emoji = emojiMap[name]; const emoji = emojiMap[name];
if (emojiByCategory[emoji.category]) { if (emojiCategoryMap[emoji.category]) {
emojiByCategory[emoji.category].push(name); emojiCategoryMap[emoji.category].push(name);
} }
}); });
} }
return category ? emojiByCategory[category] : emojiByCategory; return emojiCategoryMap;
} }
export function getEmojiInfo(query) { 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