11<template >
2- <div class =" flex flex-col min-[1129px]:flex-row gap-2" >
3- <div
4- v-if =" sourceOptions.length"
5- class =" w-full min-[1129px]:w-1/2 flex flex-col gap-3"
6- >
7- <p >{{ t('pick_existing_email') }}</p >
8- <div class =" flex flex-col min-[1129px]:flex-row gap-2" >
9- <Select
10- v-model =" sourceModel"
11- :options =" sourceOptions"
12- class =" flex-grow min-w-0"
13- option-label =" email"
14- :placeholder =" t('email_address')"
15- :pt =" {
16- trigger: {
17- class: 'text-indigo-500 ',
18- },
19- input: {
20- class: 'text-indigo-500 ',
21- },
22- root: {
23- class: 'border-[#bcbdf9] ',
24- },
25- }"
2+ <div class =" flex flex-col items-center space-y-6 p-6" >
3+ <span class =" text-xl" >{{ t('title') }}</span >
4+
5+ <template v-if =" ! showOtherSources " >
6+ <Select
7+ v-model =" sourceModel"
8+ :options =" sourceOptions"
9+ class =" w-full max-w-lg"
10+ option-label =" email"
11+ :placeholder =" t('email_address')"
12+ :pt =" {
13+ trigger: { class: 'text-indigo-500' },
14+ input: { class: 'text-indigo-500' },
15+ root: { class: 'border-[#bcbdf9]' },
16+ }"
17+ >
18+ <template #value =" { value } " >
19+ <div class =" flex items-center space-x-2" >
20+ <i :class =" getIcon(value?.type)" class =" text-secondary text-sm" ></i >
21+ <span >{{ value?.email }}</span >
22+ </div >
23+ </template >
24+
25+ <template #option =" { option } " >
26+ <div class =" flex items-center space-x-2" >
27+ <i :class =" getIcon(option.type)" class =" text-secondary text-sm" ></i >
28+ <span >{{ option.email }}</span >
29+ </div >
30+ </template >
31+ </Select >
32+
33+ <div class =" flex flex-col min-[1129px]:flex-row gap-2 w-full max-w-lg" >
34+ <Button
35+ id =" mine-source"
36+ class =" w-full"
37+ severity =" secondary"
38+ :disabled =" !sourceModel"
39+ :label =" t('mine_new_source')"
40+ outlined
41+ @click =" showOtherSources = true"
2642 />
2743 <Button
2844 id =" extract-source"
29- :disabled = " !sourceModel "
45+ class = " w-full "
3046 severity =" contrast"
31- class = " font-semibold flex-shrink-0 "
47+ :disabled = " !sourceModel "
3248 :label =" t('extract_contacts')"
33- @click =" extractContacts() "
49+ @click =" extractContacts"
3450 />
3551 </div >
36- </div >
37- <template v-if =" sourceOptions .length " >
38- <Separator
39- layout =" vertical"
40- :content =" $t('common.or')"
41- class =" hidden min-[1129px]:flex"
42- />
43- <Separator
44- layout =" horizontal"
45- :content =" $t('common.or')"
46- class =" flex min-[1129px]:hidden"
47- />
4852 </template >
49- <div class =" shrink flex flex-col gap-3" >
50- <span >{{ t('mine_from') }}</span >
51- <div class =" flex flex-col min-[1129px]:flex-row gap-2 flex-wrap" >
53+
54+ <template v-else >
55+ <div
56+ class =" flex flex-col min-[1129px]:flex-row flex-wrap gap-2 w-full max-w-4xl justify-center"
57+ >
5258 <oauth-source icon =" pi pi-google" label =" Google" source =" google" />
5359 <oauth-source
5460 icon =" pi pi-microsoft"
6167 />
6268 <Button
6369 id =" import-file"
64- outlined
6570 icon =" pi pi-upload"
6671 :label =" t('import_csv_excel')"
72+ outlined
6773 @click =" importFileDialogRef.openModal()"
6874 />
6975 <importFileDialog ref =" importFileDialogRef" />
7076 </div >
71- </div >
77+ </template >
7278 </div >
7379</template >
7480
@@ -90,7 +96,7 @@ const $leadminerStore = useLeadminerStore();
9096const $imapDialogStore = useImapDialog ();
9197const sourceModel = ref <MiningSource | undefined >();
9298const sourceOptions = computed (() => useLeadminerStore ().miningSources );
93-
99+ const showOtherSources = ref ( false );
94100const { source } = useRoute ().query ;
95101
96102function onSourceChange(miningSource : MiningSource ) {
@@ -105,6 +111,17 @@ function extractContacts() {
105111 }
106112}
107113
114+ function getIcon(type : string ) {
115+ switch (type ) {
116+ case ' google' :
117+ return ' pi pi-google' ;
118+ case ' azure' :
119+ return ' pi pi-microsoft' ;
120+ default :
121+ return ' pi pi-inbox' ;
122+ }
123+ }
124+
108125onMounted (async () => {
109126 try {
110127 await $leadminerStore .fetchMiningSources ();
@@ -146,17 +163,19 @@ defineExpose({
146163<i18n lang="json">
147164{
148165 "en" : {
149- "pick_existing_email" : " Pick an existing email address to mine" ,
150- "mine_from" : " Mine your contacts from" ,
166+ "title" : " Mine contacts from" ,
167+ "mine_existing_source" : " Mine from existing source" ,
168+ "mine_new_source" : " Mine from another source" ,
151169 "fetch_sources_failed" : " Failed to fetch mining sources" ,
152170 "email_address" : " email address" ,
153171 "extract_contacts" : " Extract contacts" ,
154172 "microsoft_or_outlook" : " Microsoft or Outlook" ,
155173 "import_csv_excel" : " Import CSV or Excel"
156174 },
157175 "fr" : {
158- "pick_existing_email" : " Choisissez une adresse e-mail existante pour l’extraction" ,
159- "mine_from" : " Extraire vos contacts depuis" ,
176+ "title" : " Extraire des contacts depuis" ,
177+ "mine_existing_source" : " Extraire depuis une source existante" ,
178+ "mine_new_source" : " Extraire depuis une autre source" ,
160179 "fetch_sources_failed" : " Échec de la récupération des sources de minage" ,
161180 "email_address" : " adresse e-mail" ,
162181 "extract_contacts" : " Extraire les contacts" ,
0 commit comments