feat: zap renderings embed the zapped post, like reactions and reposts do

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
This commit is contained in:
Claude
2026-06-12 19:28:09 +00:00
parent eb5f7d5434
commit a699bcd1c4
5 changed files with 42 additions and 6 deletions
@@ -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 -> {
@@ -41,6 +41,7 @@ import java.math.BigDecimal
@Composable
fun RenderNutzap(
note: Note,
quotesLeft: Int,
backgroundColor: MutableState<Color>,
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(
@@ -90,6 +90,7 @@ private const val MEMPOOL_TX_URL = "https://mempool.space/tx/"
@Composable
fun RenderOnchainZap(
note: Note,
quotesLeft: Int,
backgroundColor: MutableState<Color>,
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() }
@@ -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<Color>,
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<Color>,
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
@@ -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) {