problem: incorrect profile displayed

This commit is contained in:
gsovereignty
2024-07-12 12:48:26 +08:00
parent 518bcaaaa5
commit 5a4bd46ef3

View File

@@ -66,6 +66,15 @@
return zapRequestEvent; return zapRequestEvent;
} }
function getPayerPubkey(zapReceipt:NDKEvent):string|undefined {
let pubkey = undefined
let zreq = getZapRequest(zapReceipt)
if (zreq && zreq.author.pubkey.length == 64) {
pubkey = zreq.author.pubkey
}
return pubkey
}
function getZapAmount(zapRequest?: NDKEvent): number { function getZapAmount(zapRequest?: NDKEvent): number {
let amount = 0; let amount = 0;
let amountTag = zapRequest?.getMatchingTags('amount'); let amountTag = zapRequest?.getMatchingTags('amount');
@@ -96,20 +105,23 @@
</Table.Row> </Table.Row>
</Table.Header> </Table.Header>
<Table.Body> <Table.Body>
{#each $newZaps as [id, zapReceipt]} {#each $newZaps as [id, zapReceipt], _ (id)}
<Table.Row on:click={()=>{console.log(getZapRequest(zapReceipt)?.rawEvent())}} class=" bg-red-800"> <Table.Row on:click={()=>{console.log(getZapRequest(zapReceipt)?.rawEvent())}} class="bg-accent">
<Table.Cell> <Table.Cell>
<div class="flex flex-nowrap"> <div class="flex flex-nowrap">
<div class=" hidden">{getZapRequest(zapReceipt)?.author.pubkey}</div>
<Avatar <Avatar
ndk={$ndk} ndk={$ndk}
pubkey={getZapRequest(zapReceipt)?.author.pubkey} pubkey={getPayerPubkey(zapReceipt)}
class="h-10 w-10 flex-none rounded-full object-cover" class="h-10 w-10 flex-none rounded-full object-cover"
/> />
<Name <Name
ndk={$ndk} ndk={$ndk}
pubkey={getZapRequest(zapReceipt)?.author.pubkey} pubkey={getZapRequest(zapReceipt)?.author.pubkey}
class="inline-block truncate p-2" class="inline-block truncate p-2 max-w-32"
/> />
</div> </div>
</Table.Cell> </Table.Cell>
<Table.Cell class="hidden md:table-cell" <Table.Cell class="hidden md:table-cell"