Skip to content

Commit e6f8381

Browse files
committed
style: fix display of avatar
1 parent 0531425 commit e6f8381

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

web/app/components/MessageThread.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import {
88
mdiAlert,
99
mdiAccount,
1010
} from '@mdi/js'
11-
import { formatPhoneNumber } from '~/utils/filters'
12-
import { isValidPhoneNumber } from 'libphonenumber-js'
11+
import { formatPhoneNumber, startsWithLetter } from '~/utils/filters'
1312
1413
const { mdAndDown } = useDisplay()
1514
const threadsStore = useThreadsStore()
@@ -109,7 +108,7 @@ function onInstallApp() {
109108
>
110109
<template #prepend>
111110
<v-avatar :color="thread.color" size="40">
112-
<v-icon v-if="isValidPhoneNumber(thread.contact)" color="white">{{
111+
<v-icon v-if="!startsWithLetter(thread.contact)" color="white">{{
113112
mdiAccount
114113
}}</v-icon>
115114
<span v-else class="text-white text-headline-small">{{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Pusher from 'pusher-js'
1919
import type { Channel } from 'pusher-js'
2020
import { isValidPhoneNumber } from 'libphonenumber-js'
2121
import type { EntitiesMessage } from '~~/shared/types/api'
22+
import { startsWithLetter } from '~/utils/filters'
2223
2324
definePageMeta({
2425
middleware: ['auth'],
@@ -337,7 +338,7 @@ onBeforeUnmount(() => {
337338
size="40"
338339
>
339340
<v-icon
340-
v-if="isValidPhoneNumber(message.contact)"
341+
v-if="!startsWithLetter(message.contact)"
341342
color="white"
342343
>{{ mdiAccount }}</v-icon
343344
>

web/app/utils/filters.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,7 @@ export function humanizeTime(value: string): string {
9999
})
100100
return formatDuration(durations)
101101
}
102+
103+
export function startsWithLetter(value: string): boolean {
104+
return /^[a-zA-Z]/.test(value)
105+
}

0 commit comments

Comments
 (0)