Should defo be the fix please god
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m24s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m24s
This commit is contained in:
@@ -82,75 +82,66 @@ onUnmounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Header>Chat</Header>
|
<Header>Chat</Header>
|
||||||
<div class="flex-col flex">
|
<div ref="messagesContainer" class="flex flex-col overflow-y-auto p-2">
|
||||||
<div
|
<p v-for="message in messages" :key="message.id">
|
||||||
ref="messagesContainer"
|
<span class="text-tertiary">{{ message.authorId }}:</span>
|
||||||
class="flex flex-col overflow-y-auto p-2"
|
<template
|
||||||
>
|
v-for="(part, i) in parseMessageParts(message.text || '')"
|
||||||
<p v-for="message in messages" :key="message.id">
|
:key="i"
|
||||||
<span class="text-tertiary">{{ message.authorId }}:</span>
|
>
|
||||||
<template
|
<a
|
||||||
v-for="(part, i) in parseMessageParts(
|
v-if="part.type === 'link'"
|
||||||
message.text || '',
|
:href="part.value"
|
||||||
)"
|
target="_blank"
|
||||||
:key="i"
|
rel="noopener noreferrer"
|
||||||
|
class="text-primary underline"
|
||||||
|
>{{ part.value }}</a
|
||||||
>
|
>
|
||||||
<a
|
<span v-else>{{ part.value }}</span>
|
||||||
v-if="part.type === 'link'"
|
</template>
|
||||||
:href="part.value"
|
<template
|
||||||
target="_blank"
|
v-if="message.fileUrl && isSafeFileUrl(message.fileUrl)"
|
||||||
rel="noopener noreferrer"
|
>
|
||||||
class="text-primary underline"
|
<img
|
||||||
>{{ part.value }}</a
|
v-if="isImageUrl(message.fileUrl)"
|
||||||
>
|
:src="message.fileUrl"
|
||||||
<span v-else>{{ part.value }}</span>
|
class="max-w-xs max-h-48 rounded"
|
||||||
</template>
|
@load="scrollToBottom"
|
||||||
<template
|
/>
|
||||||
v-if="message.fileUrl && isSafeFileUrl(message.fileUrl)"
|
<video
|
||||||
|
v-else-if="isVideoUrl(message.fileUrl)"
|
||||||
|
:src="message.fileUrl"
|
||||||
|
controls
|
||||||
|
class="max-w-xs max-h-48 rounded"
|
||||||
|
@loadedmetadata="scrollToBottom"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
v-else
|
||||||
|
:href="message.fileUrl"
|
||||||
|
target="_blank"
|
||||||
|
class="underline"
|
||||||
|
>{{ message.fileUrl.split("/").pop() }}</a
|
||||||
>
|
>
|
||||||
<img
|
</template>
|
||||||
v-if="isImageUrl(message.fileUrl)"
|
</p>
|
||||||
:src="message.fileUrl"
|
</div>
|
||||||
class="max-w-xs max-h-48 rounded"
|
<div>
|
||||||
@load="scrollToBottom"
|
<input v-model="messageInput" @keyup.enter="sendMessage" />
|
||||||
/>
|
<input
|
||||||
<video
|
ref="fileInput"
|
||||||
v-else-if="isVideoUrl(message.fileUrl)"
|
type="file"
|
||||||
:src="message.fileUrl"
|
class="hidden"
|
||||||
controls
|
@change="onFileSelected"
|
||||||
class="max-w-xs max-h-48 rounded"
|
/>
|
||||||
@loadedmetadata="scrollToBottom"
|
<div class="flex gap-2">
|
||||||
/>
|
<Button class="flex-1" @click="sendMessage">Send</Button>
|
||||||
<a
|
<Button
|
||||||
v-else
|
v-if="authStore.user.admin"
|
||||||
:href="message.fileUrl"
|
class="flex-1"
|
||||||
target="_blank"
|
@click="fileInput.click()"
|
||||||
class="underline"
|
>Attach</Button
|
||||||
>{{ message.fileUrl.split("/").pop() }}</a
|
>
|
||||||
>
|
<Button class="flex-1" @click="scrollToBottom">Bottom</Button>
|
||||||
</template>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input v-model="messageInput" @keyup.enter="sendMessage" />
|
|
||||||
<input
|
|
||||||
ref="fileInput"
|
|
||||||
type="file"
|
|
||||||
class="hidden"
|
|
||||||
@change="onFileSelected"
|
|
||||||
/>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<Button class="flex-1" @click="sendMessage">Send</Button>
|
|
||||||
<Button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="flex-1"
|
|
||||||
@click="fileInput.click()"
|
|
||||||
>Attach</Button
|
|
||||||
>
|
|
||||||
<Button class="flex-1" @click="scrollToBottom"
|
|
||||||
>Bottom</Button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user