- createChatClient: bearer auth, one refresh-and-retry on 401, 422 field errors
- useChat over useState: host bootstrap, open a channel, send
- ChatPage, ChatChannelList, ChatMessageList, ChatComposer
- runtime config chat.apiBase, public.chat.{apiBase,channelsApiBase,botsApiBase,hostApiBase}
26 lines
755 B
Vue
26 lines
755 B
Vue
<script setup lang="ts">
|
|
// The seeded channels of the community. There is no create button: members
|
|
// join and leave the channels the host has.
|
|
const { t } = useI18n()
|
|
const chat = useChat()
|
|
</script>
|
|
|
|
<template>
|
|
<nav class="chat-sidebar" :aria-label="t('chat.channels')">
|
|
<h2 class="chat-sidebar-title">{{ t('chat.channels') }}</h2>
|
|
<ul class="chat-channels">
|
|
<li v-for="c in chat.channels.value" :key="c.id">
|
|
<button
|
|
class="chat-channel"
|
|
type="button"
|
|
:data-channel-slug="c.slug"
|
|
:aria-current="chat.activeId.value === c.conversation_id ? 'true' : undefined"
|
|
@click="chat.open(c)"
|
|
>
|
|
# {{ c.name }}
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</template>
|