Skip to content

Commit cafaab9

Browse files
Updated UI to show attachments
1 parent a8c976b commit cafaab9

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

web/components/MessageThread.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,9 @@
9696
{{ thread.contact | phoneNumber }}
9797
</v-list-item-title>
9898
<v-list-item-subtitle class="text--secondary">
99-
<span v-if="thread.last_message_content">
99+
<span>
100100
{{ thread.last_message_content }}
101101
</span>
102-
<span v-else>
103-
<v-icon small>{{ mdiPaperclip }}</v-icon> Multimedia Message
104-
</span>
105102
</v-list-item-subtitle>
106103
</v-list-item-content>
107104
<v-list-item-action>

web/pages/threads/_id/index.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,46 @@
173173
>
174174
</v-card-text>
175175
</v-card>
176+
<v-card
177+
v-if="message.attachments"
178+
shaped
179+
>
180+
<v-card-title>Message Attachments</v-card-title>
181+
<v-card-text>
182+
<v-row>
183+
<v-col
184+
v-for="(attachment, index) in message.attachments"
185+
:key="index"
186+
cols="12"
187+
sm="6"
188+
md="4"
189+
>
190+
<v-img
191+
v-if="attachment.content_type?.startsWith('image/')"
192+
:src="attachment.url"
193+
:alt="`Attachment ${index + 1}`"
194+
aspect-ratio="1"
195+
class="bg-grey-lighten-2 rounded"
196+
cover
197+
>
198+
<template v-slot:placeholder>
199+
<v-row class="fill-height ma-0" align="center" justify="center">
200+
<v-progress-circular
201+
indeterminate
202+
color="grey-lighten-1"
203+
></v-progress-circular>
204+
</v-row>
205+
</template>
206+
</v-img>
207+
208+
<div v-else class="text-center pa-4 bg-grey-lighten-4 rounded">
209+
<v-icon icon="mdi-file-document-outline" size="large"></v-icon>
210+
<div class="text-caption mt-2">Unsupported file type</div>
211+
</div>
212+
</v-col>
213+
</v-row>
214+
</v-card-text>
215+
</v-card>
176216
<div class="d-flex">
177217
<p class="ml-2 text--secondary caption mr-2">
178218
{{ new Date(message.order_timestamp).toLocaleString() }}

0 commit comments

Comments
 (0)