diff --git a/src/components/emoji_picker/emoji_picker.scss b/src/components/emoji_picker/emoji_picker.scss index ec711758..3d79afe7 100644 --- a/src/components/emoji_picker/emoji_picker.scss +++ b/src/components/emoji_picker/emoji_picker.scss @@ -1,9 +1,28 @@ @import '../../_variables.scss'; +.Notification { + .emoji-picker { + min-width: 160%; + width: 150%; + overflow: hidden; + left: -70%; + max-width: 100%; + @media (min-width: 800px) and (max-width: 1300px) { + left: -50%; + min-width: 50%; + max-width: 130%; + } + + @media (max-width: 800px) { + left: -10%; + min-width: 50%; + max-width: 130%; + } + } +} .emoji-picker { display: flex; flex-direction: column; - position: absolute; right: 0; left: 0; margin: 0 !important; diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js index bb11b840..549b9517 100644 --- a/src/components/emoji_reactions/emoji_reactions.js +++ b/src/components/emoji_reactions/emoji_reactions.js @@ -27,7 +27,11 @@ const EmojiReactions = { }, accountsForEmoji () { return this.status.emoji_reactions.reduce((acc, reaction) => { - acc[reaction.name] = reaction.accounts || [] + if (reaction.url) { + acc[reaction.url] = reaction.accounts || [] + } else { + acc[reaction.name] = reaction.accounts || [] + } return acc }, {}) }, @@ -42,6 +46,14 @@ const EmojiReactions = { reactedWith (emoji) { return this.status.emoji_reactions.find(r => r.name === emoji).me }, + isLocalReaction (emojiUrl) { + if (!emojiUrl) return true + const reacted = this.accountsForEmoji[emojiUrl] + if (reacted.length === 0) { + return true + } + return reacted[0].is_local + }, fetchEmojiReactionsByIfMissing () { const hasNoAccounts = this.status.emoji_reactions.find(r => !r.accounts) if (hasNoAccounts) { diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue index 51d50359..7117b1c9 100644 --- a/src/components/emoji_reactions/emoji_reactions.vue +++ b/src/components/emoji_reactions/emoji_reactions.vue @@ -2,17 +2,33 @@
- {{ notification.emoji }} + + + {{ notification.emoji }} + diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index 55588894..284a22ff 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -1,5 +1,5 @@ -import Checkbox from '../checkbox/checkbox.vue' import Popover from '../popover/popover.vue' +import EmojiPicker from '../emoji_picker/emoji_picker.vue' import { library } from '@fortawesome/fontawesome-svg-core' import { faSmileBeam } from '@fortawesome/free-regular-svg-icons' @@ -9,26 +9,23 @@ const ReactButton = { props: ['status'], data () { return { - filterWord: '', - keepReactOpen: false + filterWord: '' } }, components: { Popover, - Checkbox + EmojiPicker }, methods: { - addReaction (event, emoji, close, keepReactOpen) { + addReaction (event, close) { + const emoji = event.insertion const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji) if (existingReaction && existingReaction.me) { this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji }) } else { this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) } - this.keepReactOpen = keepReactOpen - if (!keepReactOpen) { - close() - } + if (!event.keepOpen) { close() } }, focusInput () { this.$nextTick(() => { @@ -38,47 +35,6 @@ const ReactButton = { } }, computed: { - commonEmojis () { - return [ - { displayText: 'lying', replacement: 'πŸ€₯' }, - { displayText: 'thinking', replacement: 'πŸ€”' }, - { displayText: 'zany', replacement: 'πŸ€ͺ' }, - { displayText: 'cartwheeling', replacement: 'πŸ€Έβ€β™‚οΈ' }, - { displayText: 'pills', replacement: 'πŸ’Š' }, - { displayText: 'writing', replacement: '✍️' }, - { displayText: 'pencil', replacement: '✏️' }, - { displayText: 'chart_up', replacement: 'πŸ“ˆ' }, - { displayText: 'chart_down', replacement: 'πŸ“‰' }, - { displayText: 'question', replacement: '❔' }, - { displayText: 'x', replacement: '❌' }, - { displayText: 'orangutan', replacement: '🦧' }, - { displayText: 'owl', replacement: 'πŸ¦‰' }, - { displayText: 'bottle', replacement: '🍼' }, - { displayText: 'crayon', replacement: 'πŸ–οΈ' }, - { displayText: 'blackula', replacement: 'πŸ§›πŸΏ' }, - { displayText: 'wrench', replacement: 'πŸ”§' }, - { displayText: 'axe', replacement: 'πŸͺ“' } - ] - }, - emojis () { - if (this.filterWord !== '') { - const filterWordLowercase = this.filterWord.toLowerCase() - let orderedEmojiList = [] - for (const emoji of this.$store.state.instance.emoji) { - if (emoji.replacement === this.filterWord) return [emoji] - - const indexOfFilterWord = emoji.displayText.toLowerCase().indexOf(filterWordLowercase) - if (indexOfFilterWord > -1) { - if (!Array.isArray(orderedEmojiList[indexOfFilterWord])) { - orderedEmojiList[indexOfFilterWord] = [] - } - orderedEmojiList[indexOfFilterWord].push(emoji) - } - } - return orderedEmojiList.flat() - } - return this.$store.state.instance.emoji || [] - }, mergedConfig () { return this.$store.getters.mergedConfig } diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue index c23a1ab5..5993d219 100644 --- a/src/components/react_button/react_button.vue +++ b/src/components/react_button/react_button.vue @@ -9,40 +9,10 @@ @show="focusInput" >