diff --git a/cmd/contacts.go b/cmd/contacts.go index 536fdb85..3f9e452b 100644 --- a/cmd/contacts.go +++ b/cmd/contacts.go @@ -103,9 +103,9 @@ func handleUpdateContact(r *fastglue.Request) error { if v, ok := form.Value["phone_number"]; ok && len(v) > 0 { phoneNumber = string(v[0]) } - phoneNumberCallingCode := "" - if v, ok := form.Value["phone_number_calling_code"]; ok && len(v) > 0 { - phoneNumberCallingCode = string(v[0]) + phoneNumberCountryCode := "" + if v, ok := form.Value["phone_number_country_code"]; ok && len(v) > 0 { + phoneNumberCountryCode = string(v[0]) } avatarURL := "" if v, ok := form.Value["avatar_url"]; ok && len(v) > 0 { @@ -116,8 +116,8 @@ func handleUpdateContact(r *fastglue.Request) error { if avatarURL == "null" { avatarURL = "" } - if phoneNumberCallingCode == "null" { - phoneNumberCallingCode = "" + if phoneNumberCountryCode == "null" { + phoneNumberCountryCode = "" } if phoneNumber == "null" { phoneNumber = "" @@ -146,7 +146,7 @@ func handleUpdateContact(r *fastglue.Request) error { Email: null.StringFrom(email), AvatarURL: null.NewString(avatarURL, avatarURL != ""), PhoneNumber: null.NewString(phoneNumber, phoneNumber != ""), - PhoneNumberCallingCode: null.NewString(phoneNumberCallingCode, phoneNumberCallingCode != ""), + PhoneNumberCountryCode: null.NewString(phoneNumberCountryCode, phoneNumberCountryCode != ""), } if err := app.user.UpdateContact(id, contactToUpdate); err != nil { diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 8e9ec503..b72e67e8 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -35,6 +35,7 @@ var migList = []migFunc{ {"v0.5.0", migrations.V0_5_0}, {"v0.6.0", migrations.V0_6_0}, {"v0.7.0", migrations.V0_7_0}, + {"v0.7.4", migrations.V0_7_4}, } // upgrade upgrades the database to the current version by running SQL migration files diff --git a/frontend/src/assets/styles/main.scss b/frontend/src/assets/styles/main.scss index 2324c734..8220a84d 100644 --- a/frontend/src/assets/styles/main.scss +++ b/frontend/src/assets/styles/main.scss @@ -184,6 +184,10 @@ @apply border shadow rounded; } +.loading-fade { + @apply opacity-50 transition-opacity duration-300 +} + // Scrollbar start ::-webkit-scrollbar { width: 8px; /* Adjust width */ diff --git a/frontend/src/components/ui/combobox/ComboBox.vue b/frontend/src/components/ui/combobox/ComboBox.vue index 9355cae8..a52bcd59 100644 --- a/frontend/src/components/ui/combobox/ComboBox.vue +++ b/frontend/src/components/ui/combobox/ComboBox.vue @@ -8,7 +8,7 @@ :class="['w-full justify-between', buttonClass]" > {{ selectedLabel }} - + diff --git a/frontend/src/features/contact/ContactForm.vue b/frontend/src/features/contact/ContactForm.vue index 42645e2a..0a336746 100644 --- a/frontend/src/features/contact/ContactForm.vue +++ b/frontend/src/features/contact/ContactForm.vue @@ -41,8 +41,8 @@
- - + + {{ t('globals.terms.phoneNumber') }} @@ -58,13 +58,18 @@
{{ item.emoji }}
- {{ item.label }} ({{ item.value }}) + {{ item.label }} ({{ item.calling_code }})
@@ -116,7 +121,8 @@ const userStore = useUserStore() const allCountries = countries.map((country) => ({ label: country.name, - value: country.calling_code, - emoji: country.emoji + value: country.iso_2, + emoji: country.emoji, + calling_code: country.calling_code })) diff --git a/frontend/src/features/contact/formSchema.js b/frontend/src/features/contact/formSchema.js index 95fe9b87..6e87540e 100644 --- a/frontend/src/features/contact/formSchema.js +++ b/frontend/src/features/contact/formSchema.js @@ -29,7 +29,7 @@ export const createFormSchema = (t) => z.object({ }) }) .nullable(), - phone_number_calling_code: z.string().optional().nullable(), + phone_number_country_code: z.string().optional().nullable(), avatar_url: z.string().optional().nullable(), email: z .string({ diff --git a/frontend/src/features/conversation/sidebar/ConversationSideBarContact.vue b/frontend/src/features/conversation/sidebar/ConversationSideBarContact.vue index f0fbd45c..22dcc0be 100644 --- a/frontend/src/features/conversation/sidebar/ConversationSideBarContact.vue +++ b/frontend/src/features/conversation/sidebar/ConversationSideBarContact.vue @@ -58,6 +58,7 @@ import { ViewVerticalIcon } from '@radix-icons/vue' import { Button } from '@/components/ui/button' import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { Mail, Phone, ExternalLink } from 'lucide-vue-next' +import countries from '@/constants/countries.js' import { useEmitter } from '@/composables/useEmitter' import { EMITTER_EVENTS } from '@/constants/emitterEvents.js' import { useConversationStore } from '@/stores/conversation' @@ -72,8 +73,13 @@ const { t } = useI18n() const userStore = useUserStore() const phoneNumber = computed(() => { - const callingCode = conversation.value?.contact?.phone_number_calling_code || '' + const countryCodeValue = conversation.value?.contact?.phone_number_country_code || '' const number = conversation.value?.contact?.phone_number || t('conversation.sidebar.notAvailable') - return callingCode ? `${callingCode} ${number}` : number + if (!countryCodeValue) return number + + // Lookup calling code + const country = countries.find((c) => c.iso_2 === countryCodeValue) + const callingCode = country ? country.calling_code : countryCodeValue + return `${callingCode} ${number}` }) diff --git a/frontend/src/views/contact/ContactDetailView.vue b/frontend/src/views/contact/ContactDetailView.vue index 3c1d557b..7747b3da 100644 --- a/frontend/src/views/contact/ContactDetailView.vue +++ b/frontend/src/views/contact/ContactDetailView.vue @@ -5,7 +5,11 @@
-
+