Commit dc2f702a authored by Phil Hughes's avatar Phil Hughes

Added emoji description title to award emoji buttons

Closes #29971
parent 90f73438
...@@ -29,11 +29,18 @@ const categoryLabelMap = { ...@@ -29,11 +29,18 @@ const categoryLabelMap = {
flags: 'Flags', flags: 'Flags',
}; };
function createEmojiObject(alias) {
return {
alias,
description: emojiMap[alias].description,
};
};
function buildCategoryMap() { function buildCategoryMap() {
return Object.keys(emojiMap).reduce((currentCategoryMap, emojiNameKey) => { return Object.keys(emojiMap).reduce((currentCategoryMap, emojiNameKey) => {
const emojiInfo = emojiMap[emojiNameKey]; const emojiInfo = emojiMap[emojiNameKey];
if (currentCategoryMap[emojiInfo.category]) { if (currentCategoryMap[emojiInfo.category]) {
currentCategoryMap[emojiInfo.category].push(emojiNameKey); currentCategoryMap[emojiInfo.category].push(createEmojiObject(emojiNameKey));
} }
return currentCategoryMap; return currentCategoryMap;
...@@ -55,10 +62,10 @@ function renderCategory(name, emojiList, opts = {}) { ...@@ -55,10 +62,10 @@ function renderCategory(name, emojiList, opts = {}) {
${name} ${name}
</h5> </h5>
<ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}"> <ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}">
${emojiList.map(emojiName => ` ${emojiList.map(emoji => `
<li class="emoji-menu-list-item"> <li class="emoji-menu-list-item">
<button class="emoji-menu-btn text-center js-emoji-btn" type="button"> <button class="emoji-menu-btn text-center js-emoji-btn" type="button" title="${emoji.description}">
${glEmojiTag(emojiName, { ${glEmojiTag(emoji.alias, {
sprite: true, sprite: true,
})} })}
</button> </button>
...@@ -498,7 +505,7 @@ AwardsHandler.prototype.getFrequentlyUsedEmojis = function getFrequentlyUsedEmoj ...@@ -498,7 +505,7 @@ AwardsHandler.prototype.getFrequentlyUsedEmojis = function getFrequentlyUsedEmoj
const frequentlyUsedEmojis = _.uniq((Cookies.get('frequently_used_emojis') || '').split(',')); const frequentlyUsedEmojis = _.uniq((Cookies.get('frequently_used_emojis') || '').split(','));
this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter( this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter(
inputName => isEmojiNameValid(inputName), inputName => isEmojiNameValid(inputName),
); ).map(emojiNameKey => createEmojiObject(emojiNameKey));
return this.frequentlyUsedEmojis; return this.frequentlyUsedEmojis;
})(); })();
......
---
title: Added title to award emoji buttons
merge_request:
author:
This diff is collapsed.
namespace :gemojione do namespace :gemojione do
desc 'Generates Emoji SHA256 digests' desc 'Generates Emoji SHA256 digests'
task digests: ['yarn:check', 'environment'] do task digests: ['environment'] do
require 'digest/sha2' require 'digest/sha2'
require 'json' require 'json'
...@@ -19,6 +19,7 @@ namespace :gemojione do ...@@ -19,6 +19,7 @@ namespace :gemojione do
entry = { entry = {
category: emoji_hash['category'], category: emoji_hash['category'],
moji: emoji_hash['moji'], moji: emoji_hash['moji'],
description: emoji_hash['description'],
unicodeVersion: Gitlab::Emoji.emoji_unicode_version(name), unicodeVersion: Gitlab::Emoji.emoji_unicode_version(name),
digest: hash_digest, digest: hash_digest,
} }
......
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