From a699bcd1c4497d36eaf374ca057e694fef0a7bfd Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 12 Jun 2026 19:28:09 +0000 Subject: [PATCH] feat: zap renderings embed the zapped post, like reactions and reposts do MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RenderLnZap, RenderNutzap, and RenderOnchainZap now show the post the zap targets above the transfer card (via the zap note's replyTo, mirroring RenderReaction), so the target is visible wherever a zap renders — the thread master view, composer reply previews, and quoted embeds. Reactions already embedded their target. https://claude.ai/code/session_01LM3KTECMMAdNBHZfs1dANa --- .../amethyst/ui/note/NoteCompose.kt | 6 ++-- .../amethyst/ui/note/types/Nutzap.kt | 3 ++ .../amethyst/ui/note/types/OnchainZapEvent.kt | 3 ++ .../amethyst/ui/note/types/ZapEvent.kt | 30 +++++++++++++++++++ .../loggedIn/threadview/ThreadFeedView.kt | 6 ++-- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 54eee4fc18..af62bde3c0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -1009,15 +1009,15 @@ private fun RenderNoteRow( } is LnZapEvent -> { - RenderLnZap(baseNote, backgroundColor, accountViewModel, nav) + RenderLnZap(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } is NutzapEvent -> { - RenderNutzap(baseNote, backgroundColor, accountViewModel, nav) + RenderNutzap(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } is OnchainZapEvent -> { - RenderOnchainZap(baseNote, backgroundColor, accountViewModel, nav) + RenderOnchainZap(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } is LiveActivitiesClipEvent -> { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Nutzap.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Nutzap.kt index 80200a9fea..ac8b5da929 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Nutzap.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Nutzap.kt @@ -41,6 +41,7 @@ import java.math.BigDecimal @Composable fun RenderNutzap( note: Note, + quotesLeft: Int, backgroundColor: MutableState, accountViewModel: AccountViewModel, nav: INav, @@ -49,6 +50,8 @@ fun RenderNutzap( val recipientKey = nutzapEvent.linkedPubKeys().firstOrNull() ?: return + RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + val card = remember(note) { ZapAmountCommentNotification( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/OnchainZapEvent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/OnchainZapEvent.kt index a4b6075330..4c9104cb61 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/OnchainZapEvent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/OnchainZapEvent.kt @@ -90,6 +90,7 @@ private const val MEMPOOL_TX_URL = "https://mempool.space/tx/" @Composable fun RenderOnchainZap( note: Note, + quotesLeft: Int, backgroundColor: MutableState, accountViewModel: AccountViewModel, nav: INav, @@ -97,6 +98,8 @@ fun RenderOnchainZap( val event = note.event as? OnchainZapEvent ?: return val sender = note.author?.pubkeyHex ?: event.pubKey val recipient = event.recipient() ?: return + + RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) val sats = event.claimedAmountInSats() ?: 0L val txid = event.txid() val message = event.content.takeIf { it.isNotBlank() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt index 16dcbacdd8..2499397031 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt @@ -44,6 +44,7 @@ import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.note.CrossfadeToDisplayComment +import com.vitorpamplona.amethyst.ui.note.NoteCompose import com.vitorpamplona.amethyst.ui.note.UserPicture import com.vitorpamplona.amethyst.ui.note.ZapAmountCommentNotification import com.vitorpamplona.amethyst.ui.note.ZapIcon @@ -61,15 +62,44 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext +/** + * Shows the post a zap targets above the transfer card, mirroring how + * reactions and reposts embed their target. + */ +@Composable +fun RenderZappedPost( + zapNote: Note, + quotesLeft: Int, + backgroundColor: MutableState, + accountViewModel: AccountViewModel, + nav: INav, +) { + zapNote.replyTo?.lastOrNull()?.let { + NoteCompose( + it, + modifier = Modifier, + isBoostedNote = true, + unPackReply = ReplyRenderType.NONE, + quotesLeft = quotesLeft - 1, + parentBackgroundColor = backgroundColor, + accountViewModel = accountViewModel, + nav = nav, + ) + } +} + @Composable fun RenderLnZap( note: Note, + quotesLeft: Int, backgroundColor: MutableState, accountViewModel: AccountViewModel, nav: INav, ) { val zapEvent = note.event as? LnZapEvent ?: return + RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + val card by parseAuthorCommentAndAmount(note, accountViewModel) val destinationKey = zapEvent.zappedAuthor().firstOrNull() ?: return diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index df87864236..68892d3a83 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -743,11 +743,11 @@ private fun FullBleedNoteCompose( } else if (noteEvent is AdvertisedRelayListEvent) { DisplayNIP65RelayList(baseNote, backgroundColor, accountViewModel, nav) } else if (noteEvent is LnZapEvent) { - RenderLnZap(baseNote, backgroundColor, accountViewModel, nav) + RenderLnZap(baseNote, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is NutzapEvent) { - RenderNutzap(baseNote, backgroundColor, accountViewModel, nav) + RenderNutzap(baseNote, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is OnchainZapEvent) { - RenderOnchainZap(baseNote, backgroundColor, accountViewModel, nav) + RenderOnchainZap(baseNote, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is ReactionEvent) { RenderReaction(baseNote, quotesLeft = 3, backgroundColor, accountViewModel, nav) } else if (noteEvent is SearchRelayListEvent) {