44-->
55<template >
66 <div class =" identifySigner" >
7- <SignerSelect :signer =" signer"
7+ <SignerSelect v-if =" isNewSigner"
8+ :signer =" signer"
89 :placeholder =" placeholder"
910 :method =" method"
1011 @update:signer =" updateSigner" />
12+ <NcNoteCard v-else type =" info" >
13+ <template #icon >
14+ <NcIconSvgWrapper :size =" 20" :svg =" getMethodIcon()" />
15+ </template >
16+ <strong >{{ identifyMethodLabel }}:</strong > {{ signer.id }}
17+ </NcNoteCard >
1118
12- <label v-if =" signerSelected" for =" name-input" >{{ t('libresign', 'Signer name') }}</label >
1319 <NcTextField v-if =" signerSelected"
1420 v-model =" displayName"
1521 aria-describedby =" name-input"
3541 </div >
3642</template >
3743<script >
44+ import svgAccount from ' @mdi/svg/svg/account.svg?raw'
45+ import svgEmail from ' @mdi/svg/svg/email.svg?raw'
46+ import svgSms from ' @mdi/svg/svg/message-processing.svg?raw'
47+ import svgWhatsapp from ' @mdi/svg/svg/whatsapp.svg?raw'
48+ import svgXmpp from ' @mdi/svg/svg/xmpp.svg?raw'
49+
3850import NcButton from ' @nextcloud/vue/components/NcButton'
51+ import NcIconSvgWrapper from ' @nextcloud/vue/components/NcIconSvgWrapper'
52+ import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
3953import NcTextField from ' @nextcloud/vue/components/NcTextField'
4054
4155import SignerSelect from ' ./SignerSelect.vue'
4256
57+ import svgSignal from ' ../../../img/logo-signal-app.svg?raw'
58+ import svgTelegram from ' ../../../img/logo-telegram-app.svg?raw'
4359import { useFilesStore } from ' ../../store/files.js'
4460
61+ const iconMap = {
62+ svgAccount,
63+ svgEmail,
64+ svgSignal,
65+ svgSms,
66+ svgTelegram,
67+ svgWhatsapp,
68+ svgXmpp,
69+ }
70+
4571export default {
4672 name: ' IdentifySigner' ,
4773 components: {
4874 NcButton,
75+ NcIconSvgWrapper,
76+ NcNoteCard,
4977 NcTextField,
5078 SignerSelect,
5179 },
@@ -66,6 +94,10 @@ export default {
6694 type: String ,
6795 default: t (' libresign' , ' Name' ),
6896 },
97+ methods: {
98+ type: Array ,
99+ default : () => [],
100+ },
69101 },
70102 setup () {
71103 const filesStore = useFilesStore ()
@@ -86,14 +118,24 @@ export default {
86118 return !! this .signer ? .id
87119 },
88120 isNewSigner () {
89- return this .id === null || this .id === undefined
121+ return ! this .signerToEdit || Object . keys ( this .signerToEdit ). length === 0
90122 },
91123 saveButtonText () {
92124 if (this .isNewSigner ) {
93125 return t (' libresign' , ' Save' )
94126 }
95127 return t (' libresign' , ' Update' )
96128 },
129+ identifyMethodLabel () {
130+ if (! this .signer ? .method ) {
131+ return ' '
132+ }
133+ const methodConfig = this .methods .find (m => m .name === this .signer .method )
134+ if (! methodConfig? .friendly_name ) {
135+ return ' '
136+ }
137+ return methodConfig .friendly_name
138+ },
97139 },
98140 beforeMount () {
99141 this .displayName = this .signerToEdit .displayName ?? ' '
@@ -108,6 +150,13 @@ export default {
108150 }
109151 },
110152 methods: {
153+ getMethodIcon () {
154+ const method = this .signer ? .method
155+ if (! method) {
156+ return iconMap .svgAccount
157+ }
158+ return iconMap[` svg${ method .charAt (0 ).toUpperCase () + method .slice (1 )} ` ] || iconMap .svgAccount
159+ },
111160 updateSigner (signer ) {
112161 this .signer = signer ?? {}
113162 this .displayName = signer? .displayName ?? ' '
@@ -165,6 +214,17 @@ export default {
165214 width: 100 % ;
166215 }
167216
217+ : deep (.notecard ) {
218+ width: 100 % ;
219+ margin- bottom: 16px ;
220+
221+ div {
222+ display: flex;
223+ align- items: center;
224+ gap: 0 .5em ;
225+ }
226+ }
227+
168228 & __footer {
169229 width: 100 % ;
170230 display: flex;
0 commit comments