Skip to content

Commit 7b734ed

Browse files
AchoArnoldCopilot
andcommitted
fix(web): update reactive page composables
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4a93bfbb-739a-414c-8eb4-48b15a69fb9d
1 parent cb49c70 commit 7b734ed

9 files changed

Lines changed: 24 additions & 41 deletions

web/app/pages/blog/end-to-end-encryption-to-sms-messages.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
42
import { mdiLanguageGo, mdiLanguageJavascript } from '@mdi/js'
53
import { ref } from 'vue'
64
7-
const { mdAndUp } = useDisplay()
5+
const { mdAndUp } = useVDisplay()
86
97
const encryptTab = ref('javascript')
108
const sendTab = ref('javascript')

web/app/pages/blog/forward-incoming-sms-from-phone-to-webhook.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
4-
const { mdAndUp } = useDisplay()
2+
const { mdAndUp } = useVDisplay()
53
64
definePageMeta({ layout: 'website' })
75

web/app/pages/blog/grant-send-and-read-sms-permissions-on-android.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<script setup lang="ts">
22
import { mdiDotsVertical } from '@mdi/js'
3-
import { useDisplay } from 'vuetify'
43
5-
const { mdAndUp } = useDisplay()
4+
const { mdAndUp } = useVDisplay()
65
76
definePageMeta({ layout: 'website' })
87

web/app/pages/blog/how-to-send-sms-messages-from-excel.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
42
import { mdiCommentTextMultipleOutline } from '@mdi/js'
53
6-
const { mdAndUp } = useDisplay()
4+
const { mdAndUp } = useVDisplay()
75
86
definePageMeta({ layout: 'website' })
97

web/app/pages/blog/send-bulk-sms-from-csv-file-with-no-code.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
42
import { mdiCommentTextMultipleOutline } from '@mdi/js'
53
6-
const { mdAndUp } = useDisplay()
4+
const { mdAndUp } = useVDisplay()
75
86
definePageMeta({ layout: 'website' })
97

web/app/pages/blog/send-sms-from-android-phone-with-python.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
4-
const { mdAndUp } = useDisplay()
2+
const { mdAndUp } = useVDisplay()
53
64
definePageMeta({ layout: 'website' })
75

web/app/pages/blog/send-sms-when-new-row-is-added-to-google-sheets-using-zapier.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script setup lang="ts">
2-
import { useDisplay } from 'vuetify'
3-
4-
const { mdAndUp } = useDisplay()
2+
const { mdAndUp } = useVDisplay()
53
64
definePageMeta({ layout: 'website' })
75

web/app/pages/heartbeats/[id].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ useHead({
1717
})
1818
1919
const route = useRoute()
20-
const { mdAndDown, mdAndUp, lgAndUp } = useDisplay()
20+
const { mdAndDown, mdAndUp, lgAndUp } = useVDisplay()
2121
const authStore = useAuthStore()
2222
const phonesStore = usePhonesStore()
2323
const { formatPhoneNumber, formatTimestamp } = useFilters()

web/app/pages/threads/[id]/index.vue

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
import Pusher from 'pusher-js'
1919
import type { Channel } from 'pusher-js'
2020
import { isValidPhoneNumber } from 'libphonenumber-js'
21+
import { storeToRefs } from 'pinia'
2122
import type { EntitiesMessage } from '~~/shared/types/api'
2223
2324
definePageMeta({
@@ -31,13 +32,14 @@ useHead({
3132
const route = useRoute()
3233
const router = useRouter()
3334
const config = useRuntimeConfig()
34-
const { lgAndUp, mdAndDown, mdAndUp } = useDisplay()
35+
const { lgAndUp, mdAndDown, mdAndUp } = useVDisplay()
3536
const { formatPhoneNumber, startsWithLetter } = useFilters()
3637
const notificationsStore = useNotificationsStore()
3738
const authStore = useAuthStore()
3839
const phonesStore = usePhonesStore()
3940
const threadsStore = useThreadsStore()
4041
const messagesStore = useMessagesStore()
42+
const { currentThread } = storeToRefs(threadsStore)
4143
4244
const formMessage = ref('')
4345
const submitting = ref(false)
@@ -58,15 +60,15 @@ const formMessageRules = [
5860
let webhookChannel: Channel | null = null
5961
6062
const contactIsPhoneNumber = computed(() => {
61-
const thread = threadsStore.currentThread
63+
const thread = currentThread.value
6264
if (!thread) return false
6365
return isValidPhoneNumber(thread.contact) || !isNaN(Number(thread.contact))
6466
})
6567
6668
const messageVisibility = computed(() =>
6769
hideMessages.value ? 'hidden' : 'visible',
6870
)
69-
const contact = computed(() => threadsStore.currentThread?.contact ?? '')
71+
const contact = computed(() => currentThread.value?.contact ?? '')
7072
7173
function isMT(message: EntitiesMessage): boolean {
7274
return message.type === 'mobile-terminated'
@@ -104,7 +106,7 @@ function formatAttachmentName(url: string): string {
104106
}
105107
106108
function currentThreadContactTitle(): string {
107-
const thread = threadsStore.currentThread
109+
const thread = currentThread.value
108110
if (!thread) return ''
109111
return (
110112
thread.contact_details?.name?.trim() || formatPhoneNumber(thread.contact)
@@ -162,15 +164,15 @@ async function loadData() {
162164
163165
async function archiveThread() {
164166
await threadsStore.updateThread({
165-
threadId: threadsStore.currentThread!.id,
167+
threadId: currentThread.value!.id,
166168
isArchived: true,
167169
})
168170
await router.push('/threads')
169171
}
170172
171173
async function unArchiveThread() {
172174
await threadsStore.updateThread({
173-
threadId: threadsStore.currentThread!.id,
175+
threadId: currentThread.value!.id,
174176
isArchived: false,
175177
})
176178
await router.push('/threads')
@@ -225,7 +227,7 @@ async function sendMessage(event: KeyboardEvent | Event) {
225227
submitting.value = true
226228
await messagesStore.sendMessage({
227229
from: phonesStore.owner!,
228-
to: threadsStore.currentThread!.contact,
230+
to: currentThread.value!.contact,
229231
content: formMessage.value,
230232
sim: 'DEFAULT',
231233
})
@@ -274,7 +276,7 @@ onBeforeUnmount(() => {
274276
<VBtn v-if="mdAndDown" icon to="/threads">
275277
<VIcon :icon="mdiArrowLeft" />
276278
</VBtn>
277-
<VToolbarTitle v-if="threadsStore.currentThread">
279+
<VToolbarTitle v-if="currentThread">
278280
{{ currentThreadContactTitle() }}
279281
</VToolbarTitle>
280282
<VMenu>
@@ -289,10 +291,7 @@ onBeforeUnmount(() => {
289291
:density="mdAndDown ? 'compact' : 'default'"
290292
>
291293
<VListItem
292-
v-if="
293-
threadsStore.currentThread &&
294-
!threadsStore.currentThread.is_archived
295-
"
294+
v-if="currentThread && !currentThread.is_archived"
296295
@click.prevent="archiveThread"
297296
>
298297
<template #prepend>
@@ -301,10 +300,7 @@ onBeforeUnmount(() => {
301300
<VListItemTitle>Archive</VListItemTitle>
302301
</VListItem>
303302
<VListItem
304-
v-if="
305-
threadsStore.currentThread &&
306-
threadsStore.currentThread.is_archived
307-
"
303+
v-if="currentThread && currentThread.is_archived"
308304
@click.prevent="unArchiveThread"
309305
>
310306
<template #prepend>
@@ -313,8 +309,8 @@ onBeforeUnmount(() => {
313309
<VListItemTitle>Unarchive</VListItemTitle>
314310
</VListItem>
315311
<VListItem
316-
v-if="threadsStore.currentThread"
317-
@click.prevent="deleteThread(threadsStore.currentThread.id)"
312+
v-if="currentThread"
313+
@click.prevent="deleteThread(currentThread.id)"
318314
>
319315
<template #prepend>
320316
<VIcon :icon="mdiDelete" color="error" />
@@ -330,7 +326,7 @@ onBeforeUnmount(() => {
330326
color="primary"
331327
indeterminate
332328
/>
333-
<VContainer v-if="threadsStore.currentThread" class="pa-0">
329+
<VContainer v-if="currentThread" class="pa-0">
334330
<div
335331
ref="messageBody"
336332
class="messages-body no-scrollbar w-100 pl-2"
@@ -357,7 +353,7 @@ onBeforeUnmount(() => {
357353
'ml-2': !mdAndUp,
358354
'ml-4': mdAndUp,
359355
}"
360-
:color="threadsStore.currentThread!.color"
356+
:color="currentThread.color"
361357
size="40"
362358
>
363359
<v-icon

0 commit comments

Comments
 (0)