Initial Commit
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s

This commit is contained in:
2026-08-28 23:30:01 +10:00
parent cc225414e0
commit 3ce70b3701
5 changed files with 227 additions and 158 deletions
+10 -158
View File
@@ -2,9 +2,8 @@
import { ref, onMounted, computed } from 'vue';
import { Link } from '@inertiajs/vue3';
import AppLayout from '@/layouts/AppLayout.vue';
import Avatar from '@/components/dredge/Avatar.vue';
import { proxyImage } from '@/lib/proxyImage';
import type { ThreadDetail, ThreadMessage } from '@/types/dredge.types';
import MessageBubble from '@/components/dredge/Messages/MessageBubble.vue';
import type { ThreadDetail } from '@/types/dredge.types';
defineOptions({
layout: AppLayout,
@@ -50,15 +49,6 @@ function avatarFor(username: string | null): string | null {
return thread.value.participants.find((p) => p.username === username)?.profile_pic_url ?? null;
}
function isSystemMessage(message: ThreadMessage): boolean {
return !message.text && !message.shared_url;
}
function systemLabel(message: ThreadMessage): string {
if (message.item_type?.includes('REACTION')) return 'Reacted to a message';
return 'Sent an attachment';
}
onMounted(fetchThread);
</script>
@@ -75,64 +65,13 @@ onMounted(fetchThread);
<p v-else-if="error" class="thread__status" role="alert">{{ error }}</p>
<div v-else class="thread__messages">
<div
<MessageBubble
v-for="message in thread!.messages"
:key="message.id"
class="bubble-row"
:class="{ 'bubble-row--me': message.username === ME }"
>
<Avatar
v-if="message.username !== ME"
size="sm"
:src="avatarFor(message.username)"
:alt="`${message.username}'s profile picture`"
/>
<div class="bubble">
<p v-if="message.replied_to_text" class="bubble__reply">
{{ message.replied_to_text }}
</p>
<p v-if="message.text" class="bubble__text">{{ message.text }}</p>
<a
v-if="message.shared_url"
:href="message.shared_url"
target="_blank"
rel="noopener noreferrer"
class="bubble__share"
>
<img
v-if="message.shared_preview_image"
:src="proxyImage(message.shared_preview_image)"
alt=""
class="bubble__share-image"
/>
<span class="bubble__share-body">
<span v-if="message.shared_title" class="bubble__share-title">
{{ message.shared_title }}
</span>
<span v-if="message.shared_caption" class="bubble__share-caption">
{{ message.shared_caption }}
</span>
</span>
</a>
<p v-if="isSystemMessage(message)" class="bubble__system">
{{ systemLabel(message) }}
</p>
<div v-if="message.reactions?.length" class="bubble__reactions">
<span
v-for="(reaction, i) in message.reactions"
:key="i"
class="bubble__reaction"
>
{{ reaction.emoji }}
</span>
</div>
</div>
</div>
:message="message"
:is-own="message.username === ME"
:avatar-src="avatarFor(message.username)"
/>
</div>
</section>
</template>
@@ -173,95 +112,8 @@ onMounted(fetchThread);
.thread__messages {
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.bubble-row {
display: flex;
align-items: flex-end;
gap: 0.5rem;
}
.bubble-row--me {
flex-direction: row-reverse;
}
.bubble {
max-width: 70%;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 14px;
padding: 0.55rem 0.8rem;
font-size: 0.88rem;
line-height: 1.4;
}
.bubble-row--me .bubble {
background: var(--bioluminum);
color: #04141a;
border-color: transparent;
}
.bubble__reply {
font-size: 0.75rem;
color: var(--sediment-dim);
border-left: 2px solid var(--haze);
padding-left: 0.5rem;
margin-bottom: 0.3rem;
}
.bubble-row--me .bubble__reply {
color: rgba(4, 20, 26, 0.7);
border-left-color: rgba(4, 20, 26, 0.4);
}
.bubble__text {
white-space: pre-wrap;
word-break: break-word;
}
.bubble__system {
font-style: italic;
color: var(--sediment-dim);
}
.bubble-row--me .bubble__system {
color: rgba(4, 20, 26, 0.7);
}
.bubble__share {
display: flex;
gap: 0.6rem;
text-decoration: none;
color: inherit;
background: rgba(0, 0, 0, 0.15);
border-radius: 8px;
padding: 0.4rem;
margin-top: 0.3rem;
}
.bubble__share-image {
width: 48px;
height: 48px;
object-fit: cover;
border-radius: 6px;
flex-shrink: 0;
}
.bubble__share-body {
display: flex;
flex-direction: column;
min-width: 0;
justify-content: center;
}
.bubble__share-title {
font-weight: 600;
font-size: 0.82rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bubble__share-caption {
font-size: 0.75rem;
opacity: 0.8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bubble__reactions {
margin-top: 0.3rem;
display: flex;
gap: 0.2rem;
}
.bubble__reaction {
font-size: 0.85rem;
/* Slightly taller than a plain bubble gap so a floating reaction pill
on one bubble doesn't collide with the row below it. */
gap: 0.9rem;
}
</style>