Files
vue-chat-layer/app/components/Chat/PinsPanel.vue
Jakub Zych 269c75b5dd feat: threads, pins, reactions, attachments, link embeds and the command picker
- threads: reply counts, ChatThreadPane with replies, live replies and thread mute
- channel pins in ChatPinsPanel; a refused pin hides the action for the session
- reactions, attachments with upload progress and bearer downloads, inline edits, the delete dialog (moderators also in channels)
- link cards with the registerEmbedRenderer registry; linkify for escaped text
- slash commands: the command picker over chatbots, dispatch with sender-only answers
- slots conversation-actions (DMs only) and sidebar-footer
- chat-tokens.css and chat-base.css, EN and PL copy, README
2026-10-31 14:04:54 +01:00

44 lines
1.7 KiB
Vue

<script setup lang="ts">
// The open channel's pinned messages (golem15.chatchannels pins), opened
// from the conversation header. Unpinning shows only while the host allows
// pins for the user.
const emit = defineEmits<{ close: [] }>()
const { t } = useI18n()
const chat = useChat()
const uid = useId()
const channel = computed(() => chat.activeChannel)
const list = computed(() => (channel.value ? chat.pinMessages[channel.value.id] : undefined))
const failed = computed(() => (channel.value ? !!chat.pinsError[channel.value.id] : false))
watch(
channel,
(c) => {
if (c) void chat.loadPins(c)
},
{ immediate: true },
)
</script>
<template>
<section v-if="channel" class="chat-pins" :aria-labelledby="`chat-pins-h-${uid}`" @keydown.esc="emit('close')">
<div class="chat-pins-head">
<h3 :id="`chat-pins-h-${uid}`" class="chat-section-title"><ChatIcon name="pin" />{{ t('chat.pins.title') }}</h3>
<button class="chat-icon-btn" type="button" :aria-label="t('chat.close')" @click="emit('close')"><ChatIcon name="close" /></button>
</div>
<p v-if="failed" class="chat-error" role="alert">
{{ t('chat.pins.failed') }}
<button class="chat-link-btn" type="button" @click="chat.loadPins(channel)">{{ t('chat.retry') }}</button>
</p>
<div v-else-if="!list" class="chat-skeletons" aria-busy="true" :aria-label="t('chat.loading')">
<div class="chat-skeleton"></div>
</div>
<p v-else-if="!list.length" class="chat-muted">{{ t('chat.pins.empty') }}</p>
<ul v-else class="chat-pins-list">
<li v-for="m in list" :key="m.id">
<ChatMessage :message="m" :author="chat.members.get(m.sender_id)" :me-id="chat.userId" in-thread />
</li>
</ul>
</section>
</template>