Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

style: fix display of avatar

Acho Arnold Ewine6f8381d8617
diff --git a/web/app/components/MessageThread.vue b/web/app/components/MessageThread.vue
index f0efdbae..9373201a 100644
--- a/web/app/components/MessageThread.vue
+++ b/web/app/components/MessageThread.vue
@@ -8,8 +8,7 @@ import {
mdiAlert,
mdiAccount,
} from '@mdi/js'
-import { formatPhoneNumber } from '~/utils/filters'
-import { isValidPhoneNumber } from 'libphonenumber-js'
+import { formatPhoneNumber, startsWithLetter } from '~/utils/filters'
const { mdAndDown } = useDisplay()
const threadsStore = useThreadsStore()
@@ -109,7 +108,7 @@ function onInstallApp() {
>
<template #prepend>
<v-avatar :color="thread.color" size="40">
- <v-icon v-if="isValidPhoneNumber(thread.contact)" color="white">{{
+ <v-icon v-if="!startsWithLetter(thread.contact)" color="white">{{
mdiAccount
}}</v-icon>
<span v-else class="text-white text-headline-small">{{
diff --git a/web/app/pages/threads/[id]/index.vue b/web/app/pages/threads/[id]/index.vue
index ad814717..9ed25675 100644
--- a/web/app/pages/threads/[id]/index.vue
+++ b/web/app/pages/threads/[id]/index.vue
@@ -19,6 +19,7 @@ import Pusher from 'pusher-js'
import type { Channel } from 'pusher-js'
import { isValidPhoneNumber } from 'libphonenumber-js'
import type { EntitiesMessage } from '~~/shared/types/api'
+import { startsWithLetter } from '~/utils/filters'
definePageMeta({
middleware: ['auth'],
@@ -337,7 +338,7 @@ onBeforeUnmount(() => {
size="40"
>
<v-icon
- v-if="isValidPhoneNumber(message.contact)"
+ v-if="!startsWithLetter(message.contact)"
color="white"
>{{ mdiAccount }}</v-icon
>
diff --git a/web/app/utils/filters.ts b/web/app/utils/filters.ts
index 2d1cf5a5..5ed17d17 100644
--- a/web/app/utils/filters.ts
+++ b/web/app/utils/filters.ts
@@ -99,3 +99,7 @@ export function humanizeTime(value: string): string {
})
return formatDuration(durations)
}
+
+export function startsWithLetter(value: string): boolean {
+ return /^[a-zA-Z]/.test(value)
+}