2024-11-29 00:05:43 +02:00
|
|
|
<template>
|
2024-12-06 21:20:27 +02:00
|
|
|
<LayoutWithTabs>
|
2024-12-07 01:33:10 +02:00
|
|
|
<template #default="{ scrollToBottom }">
|
|
|
|
|
<MetaHead>
|
|
|
|
|
<title>Чат {{ chatDoc?.name ? `«${chatDoc.name}»` : '' }} — НаСвязи</title>
|
|
|
|
|
<meta
|
|
|
|
|
name="description"
|
|
|
|
|
content="Ваш QR-код успешно создан! Узнайте, как его использовать и настройте все доступные функции для удобного взаимодействия с окружающими."
|
|
|
|
|
/>
|
|
|
|
|
</MetaHead>
|
2024-12-02 09:21:31 +02:00
|
|
|
|
2024-12-07 01:33:10 +02:00
|
|
|
<ChatMessages
|
|
|
|
|
userRole="owner"
|
|
|
|
|
:qr_code_uri="qr_code_uri"
|
|
|
|
|
:chat="chat"
|
|
|
|
|
@scrollToBottom="scrollToBottom()"
|
|
|
|
|
>
|
|
|
|
|
<template #endOfMessages="{ count, lastMessage }">
|
|
|
|
|
<div
|
|
|
|
|
v-if="!count"
|
2024-12-08 22:54:55 +02:00
|
|
|
class="flex flex-col items-center justify-center flex-grow text-center text-gray-500 dark:text-gray-400"
|
2024-12-07 01:33:10 +02:00
|
|
|
>
|
2024-12-08 22:54:55 +02:00
|
|
|
<h1 class="text-2xl font-bold mb-4 text-gray-900 dark:text-gray-100">
|
|
|
|
|
Пока нет сообщений
|
|
|
|
|
</h1>
|
|
|
|
|
<p class="text-gray-600 dark:text-gray-300">
|
|
|
|
|
Вы можете начать общение, отправив первое сообщение.
|
|
|
|
|
</p>
|
2024-12-07 01:33:10 +02:00
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-else-if="lastMessage && lastMessage.from === 'owner'"
|
2024-12-08 22:54:55 +02:00
|
|
|
class="flex flex-col items-center justify-center text-center bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-md p-6 my-6"
|
2024-12-07 01:33:10 +02:00
|
|
|
>
|
2024-12-08 22:54:55 +02:00
|
|
|
<p class="text-gray-700 dark:text-gray-300 font-medium text-lg">
|
|
|
|
|
Ваше сообщение отправлено.
|
|
|
|
|
</p>
|
|
|
|
|
<p class="text-gray-600 dark:text-gray-400 mt-2">
|
2024-12-07 01:33:10 +02:00
|
|
|
Вы можете написать ещё одно сообщение или подождать ответа.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</ChatMessages>
|
|
|
|
|
</template>
|
2024-11-29 00:05:43 +02:00
|
|
|
|
2024-12-07 01:33:10 +02:00
|
|
|
<template #footer>
|
|
|
|
|
<ChatForm :qr_code_uri :chat userRole="owner" />
|
|
|
|
|
</template>
|
2024-12-06 21:20:27 +02:00
|
|
|
</LayoutWithTabs>
|
2024-11-29 00:05:43 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { MessageDocument } from '@hereconnect/types'
|
2024-12-02 09:21:31 +02:00
|
|
|
import { getQrCodeDocument } from '@/api/qrCode'
|
|
|
|
|
import { useQuery } from '@tanstack/vue-query'
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
qr_code_uri: MessageDocument['qr_code_uri']
|
|
|
|
|
chat: MessageDocument['chat']
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const { data: chatDoc } = useQuery({
|
|
|
|
|
queryKey: ['qrCode', computed(() => props.qr_code_uri)],
|
|
|
|
|
queryFn: () => getQrCodeDocument(props.qr_code_uri),
|
|
|
|
|
})
|
2024-11-29 00:05:43 +02:00
|
|
|
</script>
|