55 <div class =" row full-height" >
66 <!-- Close button -->
77 <q-btn
8+ v-if =" !nfcSharing"
89 v-close-popup
910 flat
1011 round
1415 style =" font-size : 0.75em ; z-index : 1 ;" />
1516 <!-- Left side details -->
1617 <div class =" col-xs-12 col-md-5 bg-white q-pt-xl q-pb-md q-px-xl" >
17- <div class =" row justify-center items-start full-height" >
18+ <div
19+ class =" row justify-center full-height"
20+ :class =" nfcClass" >
1821 <q-card-section class =" q-pa-none text-body1 text-left" >
1922 <q-card
2023 class =" card q-mx-auto"
2427 :text-color =" cardStyles.textColor"
2528 :name-override =" credentialOverrides.title"
2629 :image-override =" credentialOverrides.image"
27- :description-override =" credentialOverrides.subtitle" />
30+ :description-override =" credentialOverrides.subtitle" >
31+ <template
32+ v-if =" hasNFCPayload ({credential })"
33+ #image >
34+ <div class =" row justify-between" >
35+ <dynamic-image
36+ class =" q-mr-auto"
37+ :src =" credentialOverrides.image"
38+ size =" md" />
39+ <span v-html =" conctactlessSvg" />
40+ </div >
41+ </template >
42+ </credential-switch >
2843 </q-card >
44+ <div
45+ v-if =" nfcSharing"
46+ class =" row justify-center items-center text-body2 disabled q-mt-md" >
47+ <q-spinner-ios
48+ size =" 1em"
49+ style =" height : 24px ; margin-right : 7px ;" />
50+ <div >
51+ Sharing
52+ </div >
53+ </div >
54+ <div
55+ v-if =" nfcSharing"
56+ class =" text-center q-pt-md" >
57+ <div class =" text-body1" >
58+ Hold your device near a reader to share your credential.
59+ </div >
60+ <div >
61+ <q-btn
62+ outline
63+ rounded
64+ no-caps
65+ class =" q-mt-sm"
66+ @click =" cancelWrite" >
67+ Cancel
68+ </q-btn >
69+ </div >
70+ </div >
2971 <q-card-section
72+
73+ v-if =" hasNFCPayload({credential})"
3074 class =" q-px-none q-pb-none flex full-width justify-center" >
31- <NfcShare :credential =" credential" />
75+ <NfcShare
76+ ref =" nfcShareComponent"
77+ :credential =" credential"
78+ @sharing =" nfcSharing = $event" />
3279 </q-card-section >
33- <div class =" text-grey q-mt-lg text-body2" >
34- Description
35- </div >
36- <div class =" text-body1" >
37- {{description}}
38- </div >
39- <div class =" text-grey q-mt-md text-body2" >
40- Issued for
41- </div >
42- <div class =" text-body1" >
43- {{credentialHolderName}}
80+ <div v-if =" !nfcSharing" >
81+ <div >
82+ <div class =" text-grey q-mt-lg text-body2" >
83+ Description
84+ </div >
85+ <div class =" text-body1" >
86+ {{description}}
87+ </div >
88+ <div class =" text-grey q-mt-md text-body2" >
89+ Issued for
90+ </div >
91+ <div class =" text-body1" >
92+ {{credentialHolderName}}
93+ </div >
94+ </div >
4495 </div >
4596 </q-card-section >
46- <q-card-section class =" flex full-width q-mt-auto" >
97+ <q-card-section
98+ v-if =" !nfcSharing"
99+ class =" flex full-width q-mt-auto" >
47100 <q-btn
48101 flat
49102 no-caps
57110 </div >
58111 <!-- Right side details -->
59112 <CredentialDetailsViews
113+ v-if =" !nfcSharing"
60114 :credential =" credential"
61115 :credential-overrides =" credentialOverrides"
62116 :credential-highlights =" credentialHighlights" />
69123 * Copyright (c) 2015-2024 Digital Bazaar, Inc. All rights reserved.
70124 */
71125import {computed , ref } from ' vue' ;
126+ import {CredentialSwitch , DynamicImage } from ' @bedrock/vue-vc' ;
127+ import {svg as conctactlessSvg } from ' ./contactless.js' ;
72128import CredentialDetailsViews from ' ./CredentialDetailsViews.vue' ;
73- import {CredentialSwitch } from ' @bedrock/vue-vc ' ;
129+ import {helpers } from ' @bedrock/web-wallet ' ;
74130import NfcShare from ' ./NfcShare.vue' ;
75131
132+ const {hasNFCPayload } = helpers;
133+
76134export default {
77135 name: ' CredentialDetails' ,
78136 components: {
79137 CredentialSwitch,
80138 CredentialDetailsViews,
81- NfcShare
139+ DynamicImage,
140+ NfcShare,
82141 },
83142 props: {
84143 toggleDeleteWindow: {
@@ -118,9 +177,18 @@ export default {
118177 setup (props ) {
119178 // Local state
120179 const showDelete = ref (false );
121-
180+ const nfcSharing = ref (false );
181+ const nfcShareComponent = ref (null );
122182 console .log (' Credential details' , props .credential );
123183
184+ const nfcClass = computed (() => {
185+ const isNfcSharing = nfcSharing .value ;
186+ if (! isNfcSharing) {
187+ return [' items-start' ];
188+ }
189+
190+ return [' items-center' , ' nfc-card-position' ];
191+ });
124192 // Credential description
125193 const description = computed (() => {
126194 if (props .credentialOverrides .description ) {
@@ -131,9 +199,19 @@ export default {
131199 }
132200 });
133201
202+ function cancelWrite () {
203+ nfcShareComponent .value .cancelWrite ();
204+ }
205+
134206 return {
207+ cancelWrite,
208+ conctactlessSvg,
135209 showDelete,
136- description
210+ description,
211+ hasNFCPayload,
212+ nfcSharing,
213+ nfcClass,
214+ nfcShareComponent
137215 };
138216 }
139217};
@@ -160,4 +238,8 @@ $breakpoint-sm: 767px;
160238 background- color: #FFFFFF ;
161239 border: 1px solid rgba (0 , 0 , 0 , 0.1 );
162240}
241+
242+ .nfc - card- position {
243+ margin- top: - 16vh ;
244+ }
163245< / style>
0 commit comments