@ -28,7 +28,7 @@
< button
< button
type = "button"
type = "button"
class = "block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
class = "block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
@ click = "openDialog('You')"
@ click = "openDialog({ did: activeDid, name: 'You' } )"
>
>
< font -awesome icon = "gift" class = "fa-fw" > < / f o n t - a w e s o m e >
< font -awesome icon = "gift" class = "fa-fw" > < / f o n t - a w e s o m e >
< / button >
< / button >
@ -48,7 +48,7 @@
< button
< button
type = "button"
type = "button"
class = "block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
class = "block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
@ click = "openDialog('Unnamed')"
@ click = "openDialog({ did: '', name: 'Unnamed' } )"
>
>
< font -awesome icon = "gift" class = "fa-fw" > < / f o n t - a w e s o m e >
< font -awesome icon = "gift" class = "fa-fw" > < / f o n t - a w e s o m e >
< / button >
< / button >
@ -207,7 +207,7 @@ export default class ContactGiftingView extends Vue {
}
}
}
}
openDialog ( contact ? : GiverReceiverInputInfo | "Unnamed" | "You" ) {
openDialog ( contact ? : GiverReceiverInputInfo ) {
/ / D e t e r m i n e t h e s e l e c t e d e n t i t y b a s e d o n c o n t a c t t y p e
/ / D e t e r m i n e t h e s e l e c t e d e n t i t y b a s e d o n c o n t a c t t y p e
const selectedEntity = this . createEntityFromContact ( contact ) ;
const selectedEntity = this . createEntityFromContact ( contact ) ;
@ -231,19 +231,26 @@ export default class ContactGiftingView extends Vue {
/ * *
/ * *
* Creates an entity object from the contact parameter
* Creates an entity object from the contact parameter
* Uses DID - based logic to determine "You" and "Unnamed" entities
* /
* /
private createEntityFromContact (
private createEntityFromContact (
contact ? : GiverReceiverInputInfo | "Unnamed" | "You" ,
contact ? : GiverReceiverInputInfo ,
) : GiverReceiverInputInfo | undefined {
) : GiverReceiverInputInfo | undefined {
if ( contact === "You" ) {
if ( ! contact ) {
return undefined ;
}
/ / H a n d l e G i v e r R e c e i v e r I n p u t I n f o o b j e c t
if ( contact . did === this . activeDid ) {
/ / I f D I D m a t c h e s a c t i v e D I D , c r e a t e " Y o u " e n t i t y
return { did : this . activeDid , name : "You" } ;
return { did : this . activeDid , name : "You" } ;
} else if ( contact === "Unnamed" ) {
} else if ( ! contact . did || contact . did === "" ) {
/ / I f D I D i s e m p t y / n u l l , c r e a t e " U n n a m e d " e n t i t y
return { did : "" , name : "Unnamed" } ;
return { did : "" , name : "Unnamed" } ;
} else if ( contact ) {
} else {
/ / C r e a t e a c o p y o f t h e c o n t a c t t o a v o i d m o d i f y i n g t h e o r i g i n a l
/ / C r e a t e a c o p y o f t h e c o n t a c t t o a v o i d m o d i f y i n g t h e o r i g i n a l
return { ... contact } ;
return { ... contact } ;
}
}
return undefined ;
}
}
/ * *
/ * *