7
7
custom-class =" p-0"
8
8
>
9
9
<template #header >
10
- <h3 class =" text-lg font-semibold" >Unmerge identity</h3 >
10
+ <h3 class =" text-lg font-semibold" >
11
+ Unmerge identity
12
+ </h3 >
11
13
</template >
12
14
<template #headerActions >
13
15
<div class =" flex justify-end -my-1" >
14
16
<el-button class =" btn btn--bordered btn--md mr-4" @click =" emit('update:modelValue', null)" >
15
17
Cancel
16
18
</el-button >
17
19
<el-button
18
- class =" btn btn--primary btn--md"
19
- :disabled =" !selectedIdentity || !preview"
20
- @click = " unmerge() "
21
- :loading = " unmerging "
20
+ class =" btn btn--primary btn--md"
21
+ :disabled =" !selectedIdentity || !preview"
22
+ :loading = " unmerging "
23
+ @click = " unmerge() "
22
24
>
23
25
Unmerge identity
24
26
</el-button >
35
37
:compare-member =" preview"
36
38
:is-primary =" true"
37
39
>
38
- <template #header >
39
- <div class =" h-13 flex justify-between items-start" >
40
- <div
41
- class =" bg-brand-500 rounded-full py-0.5 px-2 text-white inline-block text-xs leading-5 font-medium"
42
- >
43
- Current contact
44
- </div >
45
- </div >
46
- </template >
40
+ <template #header >
41
+ <div class =" h-13 flex justify-between items-start" >
42
+ <div
43
+ class =" bg-brand-500 rounded-full py-0.5 px-2 text-white inline-block text-xs leading-5 font-medium"
44
+ >
45
+ Current contact
46
+ </div >
47
+ </div >
48
+ </template >
47
49
</app-member-suggestions-details >
48
50
<app-member-suggestions-details
49
51
v-else-if =" preview"
50
52
:member =" preview.primary"
51
53
:compare-member =" preview.secondary"
52
54
:is-primary =" true"
53
55
>
54
- <template #header >
55
- <div class =" h-13 flex justify-between items-start" >
56
- <div
57
- class =" bg-brand-500 rounded-full py-0.5 px-2 text-white inline-block text-xs leading-5 font-medium"
58
- >
59
- Updated contact
60
- </div >
61
- </div >
62
- </template >
56
+ <template #header >
57
+ <div class =" h-13 flex justify-between items-start" >
58
+ <div
59
+ class =" bg-brand-500 rounded-full py-0.5 px-2 text-white inline-block text-xs leading-5 font-medium"
60
+ >
61
+ Updated contact
62
+ </div >
63
+ </div >
64
+ </template >
63
65
</app-member-suggestions-details >
64
66
</div >
65
67
<div class =" w-1/2 px-3" >
66
68
<!-- Loading preview -->
67
- <div class =" flex items-center justify-center h-full w-full" v-if = " fetchingPreview " >
69
+ <div v-if = " fetchingPreview " class =" flex items-center justify-center h-full w-full" >
68
70
<cr-spinner />
69
71
</div >
70
72
<!-- Unmerge preview -->
71
73
<div v-else-if =" preview" >
72
74
<app-member-suggestions-details
73
- :member =" preview.secondary"
74
- :compare-member =" props.modelValue"
75
+ :member =" preview.secondary"
76
+ :compare-member =" props.modelValue"
75
77
>
76
78
<template #header >
77
79
<div class =" h-13" >
78
80
<div class =" flex justify-between items-start" >
79
81
<div
80
- class =" bg-gray-100 rounded-full py-0.5 px-2 text-gray-600 inline-block text-xs leading-5 font-medium"
82
+ class =" bg-gray-100 rounded-full py-0.5 px-2 text-gray-600 inline-block text-xs leading-5 font-medium"
81
83
>
82
84
<i class =" ri-link-unlink-m mr-1" />Unmerged contributor
83
85
</div >
84
86
<el-dropdown
85
- placement =" bottom-end"
86
- trigger =" click"
87
+ placement =" bottom-end"
88
+ trigger =" click"
87
89
>
88
90
<button
89
- class =" btn btn--link"
90
- type =" button"
91
- @click.stop
91
+ class =" btn btn--link"
92
+ type =" button"
93
+ @click.stop
92
94
>
93
95
Change identity
94
96
</button >
95
97
<template #dropdown >
96
- <template v-for =" i of identities "
97
- :key =" ` ${i .platform }:${i .username } ` " >
98
+ <template
99
+ v-for =" i of identities "
100
+ :key =" ` ${i .platform }:${i .username } ` "
101
+ >
98
102
<el-dropdown-item
99
- v-if =" `${i.platform}:${i.username}` !== selectedIdentity"
100
- :value =" `${i.platform}:${i.username}`"
101
- :label =" i.username"
102
- @click =" fetchPreview(`${i.platform}:${i.username}`)"
103
+ v-if =" `${i.platform}:${i.username}` !== selectedIdentity"
104
+ :value =" `${i.platform}:${i.username}`"
105
+ :label =" i.username"
106
+ @click =" fetchPreview(`${i.platform}:${i.username}`)"
103
107
>
104
- <img class =" h-5 w-5 mr-2"
105
- v-if =" platformDetails(i.platform)" :alt =" platformDetails(i.platform)?.name" :src =" platformDetails(i.platform)?.image" />
106
- <span >{{i.username}}</span >
108
+ <img
109
+ v-if =" platformDetails(i.platform)"
110
+ class =" h-5 w-5 mr-2"
111
+ :alt =" platformDetails(i.platform)?.name"
112
+ :src =" platformDetails(i.platform)?.image"
113
+ />
114
+ <span >{{ i.username }}</span >
107
115
</el-dropdown-item >
108
116
</template >
109
-
110
117
</template >
111
118
</el-dropdown >
112
119
</div >
113
120
</div >
114
-
115
121
</template >
116
122
</app-member-suggestions-details >
117
123
</div >
125
131
</p >
126
132
<div class =" pt-4" >
127
133
<el-select
128
- placeholder =" Select identity"
129
- class =" w-full"
130
- @update:modelValue =" fetchPreview($event)"
134
+ placeholder =" Select identity"
135
+ class =" w-full"
136
+ @update:model-value =" fetchPreview($event)"
131
137
>
132
138
<el-option
133
- v-for =" i of identities"
134
- :key =" `${i.platform}:${i.username}`"
135
- :value =" `${i.platform}:${i.username}`"
136
- :label =" i.username"
139
+ v-for =" i of identities"
140
+ :key =" `${i.platform}:${i.username}`"
141
+ :value =" `${i.platform}:${i.username}`"
142
+ :label =" i.username"
137
143
>
138
- <img class =" h-5 w-5 mr-2"
139
- v-if =" platformDetails(i.platform)" :alt =" platformDetails(i.platform)?.name" :src =" platformDetails(i.platform)?.image" />
140
- {{i.username}}
144
+ <img
145
+ v-if =" platformDetails(i.platform)"
146
+ class =" h-5 w-5 mr-2"
147
+ :alt =" platformDetails(i.platform)?.name"
148
+ :src =" platformDetails(i.platform)?.image"
149
+ />
150
+ {{ i.username }}
141
151
</el-option >
142
152
</el-select >
143
153
</div >
151
161
152
162
<script setup>
153
163
import { computed , ref } from ' vue' ;
154
- import { useRoute , useRouter } from ' vue-router' ;
155
164
156
165
import { MemberService } from ' @/modules/member/member-service' ;
157
166
import Message from ' @/shared/message/message' ;
158
- import { mapActions } from ' @/shared/vuex/vuex.helpers' ;
159
- import { useMemberStore } from ' @/modules/member/store/pinia' ;
160
- import AppMemberSelectionDropdown from ' ./member-selection-dropdown.vue' ;
161
- import AppMemberSuggestionsDetails from ' ./suggestions/member-merge-suggestions-details.vue' ;
162
167
import AppDialog from ' @/shared/dialog/dialog.vue' ;
163
168
import CrSpinner from ' @/ui-kit/spinner/Spinner.vue' ;
164
169
import { CrowdIntegrations } from ' @/integrations/integrations-config' ;
170
+ import AppMemberSuggestionsDetails from ' ./suggestions/member-merge-suggestions-details.vue' ;
165
171
166
172
const props = defineProps ({
167
173
modelValue: {
@@ -172,11 +178,10 @@ const props = defineProps({
172
178
173
179
const emit = defineEmits ([' update:modelValue' ]);
174
180
175
-
176
181
const unmerging = ref (false );
177
182
const fetchingPreview = ref (false );
178
183
const preview = ref (null );
179
- const selectedIdentity = ref (null )
184
+ const selectedIdentity = ref (null );
180
185
181
186
const isModalOpen = computed ({
182
187
get () {
@@ -191,34 +196,30 @@ const isModalOpen = computed({
191
196
});
192
197
193
198
const identities = computed (() => {
194
- if (! props .modelValue ? .username ){
199
+ if (! props .modelValue ? .username ) {
195
200
return [];
196
201
}
197
- return Object .entries (props .modelValue .username ).reduce ((arr , [platform , idents ]) => {
198
- return [... arr, ... idents .map ((i ) => ({username: i, platform}))];
199
- }, [])
200
- })
201
-
202
- const platformDetails = (platform ) => {
203
- return CrowdIntegrations .getConfig (platform);
204
- }
202
+ return Object .entries (props .modelValue .username )
203
+ .reduce ((arr , [platform , idents ]) => [... arr, ... idents .map ((i ) => ({ username: i, platform }))], []);
204
+ });
205
205
206
+ const platformDetails = (platform ) => CrowdIntegrations .getConfig (platform);
206
207
207
208
const fetchPreview = (identity ) => {
208
209
if (fetchingPreview .value ) {
209
210
return ;
210
211
}
211
212
212
- selectedIdentity .value = identity;
213
+ selectedIdentity .value = identity;
213
214
fetchingPreview .value = true ;
214
215
215
216
const [platform , username ] = identity .split (' :' );
216
- MemberService .unmergePreview ( props .modelValue ? .id , platform, username)
217
+ MemberService .unmergePreview (props .modelValue ? .id , platform, username)
217
218
.then ((res ) => {
218
- preview .value = res
219
+ preview .value = res;
219
220
})
220
221
.catch ((error ) => {
221
- Message .error (' There was an error fetching unmerge preview' );
222
+ Message .error (' There was an error fetching unmerge preview' );
222
223
})
223
224
.finally (() => {
224
225
fetchingPreview .value = false ;
@@ -233,21 +234,21 @@ const unmerge = () => {
233
234
unmerging .value = true ;
234
235
235
236
MemberService .unmerge (props .modelValue ? .id , preview .value )
236
- .then (() => {
237
- Message .info (
238
- " We’re syncing all activities of the unmerged contributor. We will let you know once the process is completed." ,
239
- {
240
- title: ' Contributors unmerging in progress' ,
241
- },
242
- );
243
- emit (' update:modelValue' , null );
244
- })
245
- .catch ((error ) => {
246
- Message .error (' There was an error unmerging contact' );
247
- })
248
- .finally (() => {
249
- unmerging .value = false ;
250
- });
237
+ .then (() => {
238
+ Message .info (
239
+ ' We’re syncing all activities of the unmerged contributor. We will let you know once the process is completed.' ,
240
+ {
241
+ title: ' Contributors unmerging in progress' ,
242
+ },
243
+ );
244
+ emit (' update:modelValue' , null );
245
+ })
246
+ .catch ((error ) => {
247
+ Message .error (' There was an error unmerging contact' );
248
+ })
249
+ .finally (() => {
250
+ unmerging .value = false ;
251
+ });
251
252
};
252
253
253
254
< / script>
0 commit comments