improve emoji reaction action button behavior and feedback

This commit is contained in:
Henry Jameson 2026-06-01 20:50:12 +03:00
commit a2a1346162
8 changed files with 28 additions and 4 deletions

View file

@ -129,6 +129,7 @@ const EmojiPicker = {
hideCustomEmojiInPicker: false, hideCustomEmojiInPicker: false,
// Lazy-load only after the first time `showing` becomes true. // Lazy-load only after the first time `showing` becomes true.
contentLoaded: false, contentLoaded: false,
popoverShown: false,
groupRefs: {}, groupRefs: {},
emojiRefs: {}, emojiRefs: {},
filteredEmojiGroups: [], filteredEmojiGroups: [],
@ -176,6 +177,13 @@ const EmojiPicker = {
const fullEmojiSize = emojiSizeReal + 2 * 0.2 * fontSizeMultiplier * 14 const fullEmojiSize = emojiSizeReal + 2 * 0.2 * fontSizeMultiplier * 14
this.emojiSize = fullEmojiSize this.emojiSize = fullEmojiSize
}, },
togglePicker() {
if (this.popoverShown) {
this.hidePicker()
} else {
this.showPicker()
}
},
showPicker() { showPicker() {
this.$refs.popover.showPopover() this.$refs.popover.showPopover()
this.$nextTick(() => { this.$nextTick(() => {
@ -194,10 +202,10 @@ const EmojiPicker = {
} }
}, },
onPopoverShown() { onPopoverShown() {
this.$emit('show') this.popoverShown = true
}, },
onPopoverClosed() { onPopoverClosed() {
this.$emit('close') this.popoverShown = false
}, },
onStickerUploaded(e) { onStickerUploaded(e) {
this.$emit('sticker-uploaded', e) this.$emit('sticker-uploaded', e)

View file

@ -131,6 +131,12 @@ export default {
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
} }
}, },
onShowEmojiPicker() {
this.$emit('emojiPickerShown', true)
},
onHideEmojiPicker() {
this.$emit('emojiPickerShown', false)
},
doActionWrap( doActionWrap(
button, button,
close = () => { close = () => {
@ -142,7 +148,7 @@ export default {
) )
return return
if (button.name === 'emoji') { if (button.name === 'emoji') {
this.$refs.picker.showPicker() this.$refs.picker.togglePicker()
} else { } else {
this.animationState = true this.animationState = true
this.getComponent(button) === 'button' && this.doAction(button) this.getComponent(button) === 'button' && this.doAction(button)

View file

@ -100,6 +100,8 @@
:hide-custom-emoji="hideCustomEmoji" :hide-custom-emoji="hideCustomEmoji"
class="emoji-picker-panel" class="emoji-picker-panel"
@emoji="addReaction" @emoji="addReaction"
@show="onShowEmojiPicker"
@close="onHideEmojiPicker"
/> />
</div> </div>
</template> </template>

View file

@ -20,6 +20,7 @@ export default {
UserTimedFilterModal, UserTimedFilterModal,
}, },
props: ['button', 'status'], props: ['button', 'status'],
emits: ['emojiPickerShown'],
mounted() { mounted() {
if (this.button.name === 'mute') { if (this.button.name === 'mute') {
this.$store.dispatch('fetchDomainMutes') this.$store.dispatch('fetchDomainMutes')

View file

@ -79,6 +79,7 @@
:button="button" :button="button"
:status="status" :status="status"
v-bind="$attrs" v-bind="$attrs"
@emojiPickerShown="e => $emit('emojiPickerShown', e)"
/> />
<teleport to="#modal"> <teleport to="#modal">
<MuteConfirm <MuteConfirm

View file

@ -98,7 +98,7 @@ export const BUTTONS = [
label: 'tool_tip.add_reaction', label: 'tool_tip.add_reaction',
icon: ['far', 'smile-beam'], icon: ['far', 'smile-beam'],
interactive: () => true, interactive: () => true,
active: () => false, active: ({ emojiPickerShown }) => emojiPickerShown,
toggleable: true, toggleable: true,
anonLink: true, anonLink: true,
}, },

View file

@ -28,6 +28,7 @@ const StatusActionButtons = {
/* no-op */ /* no-op */
}, },
randomSeed: genRandomSeed(), randomSeed: genRandomSeed(),
emojiPickerShown: false,
} }
}, },
components: { components: {
@ -56,6 +57,7 @@ const StatusActionButtons = {
return { return {
status: this.status, status: this.status,
replying: this.replying, replying: this.replying,
emojiPickerShown: this.emojiPickerShown,
emit: this.$emit, emit: this.$emit,
dispatch: this.$store.dispatch, dispatch: this.$store.dispatch,
state: this.$store.state, state: this.$store.state,
@ -107,6 +109,9 @@ const StatusActionButtons = {
onExtraClose() { onExtraClose() {
this.showPin = false this.showPin = false
}, },
onEmojiPickerShown(state) {
this.emojiPickerShown = state
},
isPinned(button) { isPinned(button) {
return this.pinnedItems.has(button.name) return this.pinnedItems.has(button.name)
}, },

View file

@ -20,6 +20,7 @@
:get-component="getComponent" :get-component="getComponent"
:close="() => { /* no-op */ }" :close="() => { /* no-op */ }"
:do-action="doAction" :do-action="doAction"
@emojiPickerShown="onEmojiPickerShown"
/> />
<button <button
v-if="showPin && currentUser" v-if="showPin && currentUser"