Files
BRETT/app/components/CommentReactionPicker.vue
T
FliesentischKingandDevin de39c20dea Allow stickers as reactions on comments, uploads and messages
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-25 00:34:09 +02:00

46 lines
1.2 KiB
Vue

<script setup lang="ts">
import { toast } from 'vue-sonner'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
const props = defineProps<{ commentId: number }>()
const { toggle } = useCommentReactions()
const { t } = useI18n()
const open = ref(false)
const busy = ref(false)
async function pick(emoji: string, sticker = false) {
if (busy.value) return
busy.value = true
open.value = false
try {
await toggle(props.commentId, emoji, sticker)
}
catch (err) {
const e = err as { data?: { statusMessage?: string } }
toast.error(e.data?.statusMessage ?? t('comments.reactionFailed'))
}
finally {
busy.value = false
}
}
</script>
<template>
<Popover v-model:open="open">
<PopoverTrigger as-child>
<button
type="button"
class="cursor-pointer self-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
:aria-label="$t('comments.addReaction')"
>
<Icon name="ph:smiley-fill" class="size-5" />
</button>
</PopoverTrigger>
<PopoverContent v-if="open" align="end" class="w-auto overflow-hidden p-0">
<EmojiStickerPicker @select="pick" />
</PopoverContent>
</Popover>
</template>