@ -19,14 +19,14 @@
/ > < / a >
< div >
< h3 class = "font-semibold" > < a href = "" > [ POSTER_NAME ] < / a > < / h3 >
< p class = "ms-auto text-xs text-slate-500 italic" > [ TIMESTAMP ] < / p >
<!-- < p
class = "ms-auto text-xs text-slate-500 italic"
: title = "record.timestamp"
>
{ { formattedTimestamp } }
< / p > -- >
< h3 class = "font-semibold" >
< a href = "" class = "hover:underline" >
{ { record . giver . known ? record . giver . displayName : 'Anonymous Giver' } }
< / a >
< / h3 >
< p class = "ms-auto text-xs text-slate-500 italic" >
{ { friendlyDate } }
< / p >
< / div >
< / div >
@ -55,34 +55,35 @@
class = "w-28 sm:w-48 text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
>
< div class = "relative w-fit mx-auto" >
<!--
If unknown user , icon = "person-circle-question"
If project with no photo , icon = "image"
-- >
< fa
v - if = "!record.giver.profileImageUrl"
icon = "person-circle-question"
class = "text-slate-300 text-5xl sm:text-8xl"
/ >
< EntityIcon
v - else
: profile - image - url = "record.giver.profileImageUrl"
: class = "
record . giver . known
? 'rounded-full size-12 sm:size-24 object-cover'
: 'rounded size-12 sm:size-24 object-cover'
"
/ >
<!--
< span
class = "absolute -end-3 -bottom-2 bg-slate-400 rounded-full leading-1.25 p-1 sm:px-1.5 -mt-6 border sm:border-2 border-white text-xs sm:text-base"
>
< template v-if ="record.giver.profileImageUrl" >
< EntityIcon
: profile - image - url = "record.giver.profileImageUrl"
: class = " [
record . giver . known
? 'rounded-full size-12 sm:size-24 object-cover'
: 'rounded size-12 sm:size-24 object-cover'
] "
/ >
< / template >
< template v-else >
<!-- Identicon for DIDs -- >
< img
v - if = "record.giver.did"
: src = "`https://a.fsdn.com/con/app/proj/identicons/screenshots/225506.jpg`"
: class = " [
record . giver . known
? 'rounded-full size-12 sm:size-24'
: 'rounded size-12 sm:size-24'
] "
alt = "Identicon"
/ >
<!-- Fallback icon for projects -- >
< fa
: icon = "record.giver.known ? 'user' : 'hammer'"
class = "fa-fw text-white"
v - else
icon = "person-circle-question"
class = "text-slate-300 text-5xl sm:text-8xl"
/ >
< / span >
-- >
< / template >
< / div >
< div class = "text-xs mt-2 line-clamp-2" >
< fa
@ -109,34 +110,35 @@
class = "w-28 sm:w-48 text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
>
< div class = "relative w-fit mx-auto" >
<!--
If unknown user , icon = "person-circle-question"
If project with no photo , icon = "image"
-- >
< fa
v - if = "!record.receiver.profileImageUrl"
icon = "image"
class = "text-slate-300 text-5xl sm:text-8xl"
/ >
< EntityIcon
v - else
: profile - image - url = "record.receiver.profileImageUrl"
: class = "
record . receiver . known
? 'rounded-full size-12 sm:size-24 object-cover'
: 'rounded size-12 sm:size-24 object-cover'
"
/ >
<!--
< span
class = "absolute -end-3 -bottom-2 bg-slate-400 rounded-full leading-1.25 p-1 sm:px-1.5 -mt-6 border sm:border-2 border-white text-xs sm:text-base"
>
< template v-if ="record.receiver.profileImageUrl" >
< EntityIcon
: profile - image - url = "record.receiver.profileImageUrl"
: class = " [
record . receiver . known
? 'rounded-full size-12 sm:size-24 object-cover'
: 'rounded size-12 sm:size-24 object-cover'
] "
/ >
< / template >
< template v-else >
<!-- Identicon for DIDs -- >
< img
v - if = "record.receiver.did"
: src = "`https://a.fsdn.com/con/app/proj/identicons/screenshots/225506.jpg`"
: class = " [
record . receiver . known
? 'rounded-full size-12 sm:size-24'
: 'rounded size-12 sm:size-24'
] "
alt = "Identicon"
/ >
<!-- Fallback icon for projects -- >
< fa
: icon = "record.receiver.known ? 'user' : 'hammer'"
class = "fa-fw text-white"
v - else
icon = "image"
class = "text-slate-300 text-5xl sm:text-8xl"
/ >
< / span >
-- >
< / template >
< / div >
< div class = "text-xs mt-2 line-clamp-2" >
< fa
@ -164,7 +166,14 @@
< fa icon = "circle-info" class = "fa-fw text-slate-500" / >
< / a >
< button
class = "text-sm text-white bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] px-3 py-1.5 ms-auto rounded-md"
@ click = "handleConfirmClick"
: disabled = "!canConfirm"
class = "text-sm text-white px-3 py-1.5 ms-auto rounded-md"
: class = " [
canConfirm
? 'bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)]'
: 'bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] opacity-50'
] "
>
Confirm
< / button >
@ -176,6 +185,8 @@
import { Component , Prop , Vue } from "vue-facing-decorator" ;
import { GiveRecordWithContactInfo } from "../types" ;
import EntityIcon from "./EntityIcon.vue" ;
import { isGiveClaimType , notifyWhyCannotConfirm } from "../libs/util" ;
import { containsHiddenDid } from "../libs/endorserServer" ;
@ Component ( {
components : {
@ -185,6 +196,9 @@ import EntityIcon from "./EntityIcon.vue";
export default class ActivityListItem extends Vue {
@ Prop ( ) record ! : GiveRecordWithContactInfo ;
@ Prop ( ) lastViewedClaimId ? : string ;
@ Prop ( ) isRegistered ! : boolean ;
@ Prop ( ) activeDid ! : string ;
@ Prop ( ) confirmerIdList ? : string [ ] ;
private formatAmount ( claim : unknown ) : string {
const amount = claim . object ? . amountOfThisGood
@ -274,5 +288,39 @@ export default class ActivityListItem extends Vue {
/ / A d d y o u r t i m e s t a m p f o r m a t t i n g l o g i c h e r e
return this . record . timestamp ;
}
get canConfirm ( ) : boolean {
if ( ! this . isRegistered ) return false ;
if ( ! isGiveClaimType ( this . record . fullClaim ? . [ "@type" ] ) ) return false ;
if ( this . confirmerIdList ? . includes ( this . activeDid ) ) return false ;
if ( this . record . issuerDid === this . activeDid ) return false ;
if ( containsHiddenDid ( this . record . fullClaim ) ) return false ;
return true ;
}
handleConfirmClick ( ) {
if ( ! this . canConfirm ) {
notifyWhyCannotConfirm (
this . $notify ,
this . isRegistered ,
this . record . fullClaim ? . [ "@type" ] ,
this . record ,
this . activeDid ,
this . confirmerIdList
) ;
return ;
}
this . $emit ( 'confirmClaim' , this . record ) ;
}
get friendlyDate ( ) : string {
const date = new Date ( this . record . issuedAt ) ;
return date . toLocaleDateString ( undefined , {
year : 'numeric' ,
month : 'short' ,
day : 'numeric'
} ) ;
}
}
< / script >