Skip to content

Commit fb6845f

Browse files
authored
fix phone's i18n and ui (#2284)
* should be Phone/Téléphone without "numéro de..." * remove copy/paste, use phone icon, and make the chip clickable * move callPhoneNumber() to utils and fix phone column * phone column add chip margin * contact info: fix chip positioning * use gap instead of margin * prettier fix
1 parent 4ad2f51 commit fb6845f

File tree

4 files changed

+31
-57
lines changed

4 files changed

+31
-57
lines changed

frontend/src/components/Mining/ContactInformationSidebar.vue

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,16 @@
120120
{{ $t('contact.telephone') }}
121121
</td>
122122
<td>
123-
<div v-if="!editingContact">
124-
<template
123+
<div v-if="!editingContact" class="flex flex-wrap gap-1">
124+
<Chip
125125
v-for="(phone, index) in contact.telephone"
126126
:key="index"
127-
>
128-
<div class="p-1">
129-
<Button
130-
rounded
131-
text
132-
icon="pi pi-copy"
133-
size="small"
134-
:aria-label="t('copy')"
135-
@click="copyPhoneNumber(phone ?? undefined)"
136-
/>
137-
<a :href="`tel:${phone}`">
138-
<Chip :key="index" :label="phone" />
139-
</a>
140-
</div>
141-
</template>
127+
:label="phone"
128+
:href="`tel:${phone}`"
129+
icon="pi pi-phone"
130+
class="cursor-pointer"
131+
@click="callPhoneNumber(phone)"
132+
/>
142133
</div>
143134
<Textarea
144135
v-else
@@ -468,16 +459,15 @@ function cancelContactInformations() {
468459
}
469460
470461
function copyContact(email: string, name?: string) {
471-
showNotification('success', $t('contact.contact_copied'), $t('contact.contact_email_copied'));
462+
showNotification(
463+
'success',
464+
$t('contact.contact_copied'),
465+
$t('contact.contact_email_copied'),
466+
);
472467
navigator.clipboard.writeText(
473468
name && name !== '' ? `${name} <${email}>` : `<${email}>`,
474469
);
475470
}
476-
477-
function copyPhoneNumber(phone: string) {
478-
showNotification('success', t('phone_copied'), t('contact_phone_copied'));
479-
navigator.clipboard.writeText(phone);
480-
}
481471
</script>
482472
<i18n lang="json">
483473
{

frontend/src/components/Mining/Table/MiningTable.vue

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -610,19 +610,17 @@
610610
<InputText v-model="filterModel.value" />
611611
</template>
612612
<template #body="{ data }">
613-
<template v-for="(phone, index) in data.telephone" :key="index">
614-
<Button
615-
rounded
616-
text
617-
icon="pi pi-copy"
618-
size="small"
619-
class="text-2xl flex-none -m-1"
620-
:aria-label="t('copy')"
621-
@click="copyPhoneNumber(phone ?? undefined)"
613+
<div class="flex flex-wrap gap-1">
614+
<Chip
615+
v-for="(phone, index) in data.telephone"
616+
:key="index"
617+
:label="phone"
618+
:href="`tel:${phone}`"
619+
icon="pi pi-phone"
620+
class="cursor-pointer"
621+
@click="callPhoneNumber(phone)"
622622
/>
623-
<a :href="`tel:${phone}`">{{ phone }}</a>
624-
<span v-if="index < data.telephone.length - 1">, </span>
625-
</template>
623+
</div>
626624
</template>
627625
</Column>
628626

@@ -1102,24 +1100,6 @@ onNuxtReady(async () => {
11021100
isLoading.value = false;
11031101
});
11041102
1105-
function showNotification(
1106-
severity: 'info' | 'warn' | 'error' | 'success' | 'secondary' | 'contrast',
1107-
summary: string,
1108-
detail: string,
1109-
) {
1110-
$toast.add({
1111-
severity,
1112-
summary,
1113-
detail,
1114-
life: 3000,
1115-
});
1116-
}
1117-
1118-
function copyPhoneNumber(phone: string) {
1119-
showNotification('success', $t('contact.phone_copied'), $t('contact.contact_phone_copied'));
1120-
navigator.clipboard.writeText(phone);
1121-
}
1122-
11231103
onUnmounted(() => {
11241104
$screenStore.destroy();
11251105
$contactsStore.$reset();

frontend/src/i18n/messages.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"family_name": "Family Name",
8686
"alternate_name": "Alternate Names",
8787
"alternate_email": "Alternate emails",
88-
"telephone": "Phone number",
88+
"telephone": "Phone",
8989
"location": "Location",
9090
"works_for": "Works for",
9191
"job_title": "Job Title",
@@ -212,7 +212,7 @@
212212
"family_name": "Nom de famille",
213213
"alternate_name": "Autres noms",
214214
"alternate_email": "Adresses e-mail alternatives",
215-
"telephone": "Numéro de téléphone",
215+
"telephone": "Téléphone",
216216
"location": "Localisation",
217217
"works_for": "Travaille pour",
218218
"job_title": "Titre du poste",
@@ -245,8 +245,8 @@
245245
"chat": "Chat",
246246
"role": "Role"
247247
},
248-
"phone_copied": "Numéro de téléphone copié",
249-
"contact_phone_copied": "Numéro de téléphone a été copié dans votre presse-papiers"
248+
"phone_copied": "Numéro de téléphone copié",
249+
"contact_phone_copied": "Numéro de téléphone a été copié dans votre presse-papiers"
250250
},
251251
"mining": {
252252
"toast_canceled_title": "Extraction annulée",

frontend/src/utils/contacts.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,7 @@ export async function removeContactsFromDatabase(
196196
});
197197
if (error) throw error;
198198
}
199+
200+
export function callPhoneNumber(phone: string) {
201+
window.location.href = `tel:${phone}`;
202+
}

0 commit comments

Comments
 (0)