@ -17,6 +17,24 @@
<!-- Results List -- >
< ul class = "border-t border-slate-300" >
<!-- "You" entity -- >
< li v-if ="shouldShowYouEntity" class="border-b border-slate-300 py-3" >
< h2 class = "text-base flex gap-4 items-center" >
< span class = "grow flex gap-2 items-center font-medium" >
< font -awesome icon = "hand" class = "text-blue-500 text-4xl" / >
< span class = "text-blue-500" > You < / span >
< / span >
< span class = "text-right" >
< 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"
@ click = "openDialog('You')"
>
< font -awesome icon = "gift" class = "fa-fw" > < / f o n t - a w e s o m e >
< / button >
< / span >
< / h2 >
< / li >
< li class = "border-b border-slate-300 py-3" >
< h2 class = "text-base flex gap-4 items-center" >
< span class = "grow flex gap-2 items-center font-medium" >
@ -71,6 +89,7 @@
: to - project - id = "toProjectId"
: show - projects = "showProjects"
: is - from - project - view = "isFromProjectView"
: hide - show - all = "true"
/ >
< / section >
< / template >
@ -180,7 +199,7 @@ export default class ContactGiftingView extends Vue {
}
}
openDialog ( contact ? : GiverReceiverInputInfo | "Unnamed" ) {
openDialog ( contact ? : GiverReceiverInputInfo | "Unnamed" | "You" ) {
if ( contact === "Unnamed" ) {
/ / S p e c i a l c a s e : P a s s u n d e f i n e d t o t r i g g e r S t e p 1 , b u t w i t h " U n n a m e d " p r e - s e l e c t e d
let recipient : GiverReceiverInputInfo ;
@ -230,6 +249,55 @@ export default class ContactGiftingView extends Vue {
) ;
/ / I m m e d i a t e l y s e l e c t " U n n a m e d " a n d m o v e t o S t e p 2
( this . $refs . customDialog as GiftedDialog ) . selectGiver ( ) ;
} else if ( contact === "You" ) {
/ / S p e c i a l c a s e : H a n d l e " Y o u " e n t i t y s e l e c t i o n
let giver : GiverReceiverInputInfo ;
let recipient : GiverReceiverInputInfo ;
if ( this . stepType === "giver" ) {
/ / W e ' r e s e l e c t i n g a g i v e r , s o " Y o u " b e c o m e s t h e g i v e r
giver = { did : this . activeDid , name : "You" } ;
/ / R e c i p i e n t i s e i t h e r a p r o j e c t o r t h e c u r r e n t u s e r
if ( this . recipientEntityType === "project" ) {
recipient = {
did : this . recipientProjectHandleId ,
name : this . recipientProjectName ,
image : this . recipientProjectImage ,
handleId : this . recipientProjectHandleId ,
} ;
} else {
recipient = { did : this . activeDid , name : "You" } ;
}
} else {
/ / W e ' r e s e l e c t i n g a r e c i p i e n t , s o " Y o u " b e c o m e s t h e r e c i p i e n t
recipient = { did : this . activeDid , name : "You" } ;
/ / P r e s e r v e t h e e x i s t i n g g i v e r f r o m t h e c o n t e x t
if ( this . giverEntityType === "project" ) {
giver = {
did : this . giverProjectHandleId ,
name : this . giverProjectName ,
image : this . giverProjectImage ,
handleId : this . giverProjectHandleId ,
} ;
} else if ( this . giverDid ) {
giver = {
did : this . giverDid ,
name : this . giverProjectName || "Someone" ,
} ;
} else {
giver = { did : this . activeDid , name : "You" } ;
}
}
( this . $refs . customDialog as GiftedDialog ) . open (
giver ,
recipient ,
undefined ,
this . stepType === "giver" ? "Given by You" : "Given to You" ,
this . prompt ,
) ;
} else {
/ / R e g u l a r c a s e : c o n t a c t i s a G i v e r R e c e i v e r I n p u t I n f o
let giver : GiverReceiverInputInfo ;
@ -283,5 +351,12 @@ export default class ContactGiftingView extends Vue {
) ;
}
}
get shouldShowYouEntity ( ) : boolean {
return (
this . stepType === "recipient" ||
( this . stepType === "giver" && this . isFromProjectView )
) ;
}
}
< / script >