From d6fc3232b21abc126aef735a680915fd31f0d63d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 26 Jun 2026 19:37:43 +0000 Subject: [PATCH] fix: keep zap/reaction card inner content on the card's tint The embedded note and comment inside the lightning / nutzap / onchain-zap and reaction activity cards were handed the parent feed / MultiSetCard background state, so they drew black (the app background) or flashed the new-note highlight instead of letting the card's orange (or like-tinted) wash show through. ActivityCardFrame now exposes a stable transparent background state to its content for the inner note and comment to draw on; the hand-built onchain card uses a matching local state. Nothing inside the card's layout changes background from the feed anymore. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01GEUsgVr5e31qYeqNSjgHif --- .../amethyst/ui/note/types/ActivityCard.kt | 17 +++++++++++++++-- .../amethyst/ui/note/types/Nutzap.kt | 6 +++--- .../amethyst/ui/note/types/OnchainZapEvent.kt | 8 +++++++- .../amethyst/ui/note/types/Reaction.kt | 4 ++-- .../amethyst/ui/note/types/ZapEvent.kt | 6 +++--- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ActivityCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ActivityCard.kt index 33fbbe195a..08a6375273 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ActivityCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ActivityCard.kt @@ -36,6 +36,9 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -57,12 +60,20 @@ val LikeTint = Color(0xFFCA395F) * Gradient card frame shared by the reaction / zap / nutzap / onchain-zap * renderings, mirroring the onchain card's look: rounded corners and a soft * top-to-bottom wash of the kind's tint. + * + * The content lambda receives a stable [transparentCardBackground] state to hand + * down to the embedded note and comment: everything inside the card sits on the + * orange (or like-tinted) wash, so inner content must draw transparent and let + * that wash show through. Passing the parent feed / MultiSetCard background here + * instead would paint the inner note black (the app background) or flash it with + * the new-note highlight, breaking the card's solid tint. */ @Composable fun ActivityCardFrame( tint: Color, - content: @Composable ColumnScope.() -> Unit, + content: @Composable ColumnScope.(transparentCardBackground: MutableState) -> Unit, ) { + val transparentCardBackground = remember { mutableStateOf(Color.Transparent) } Box( modifier = Modifier @@ -78,7 +89,9 @@ fun ActivityCardFrame( ), ).padding(horizontal = 12.dp, vertical = 10.dp), ) { - Column(verticalArrangement = Arrangement.spacedBy(8.dp), content = content) + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { + content(transparentCardBackground) + } } } 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 c7c1d08cf9..1fcf052518 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 @@ -61,7 +61,7 @@ fun RenderNutzap( val recipientKey = nutzapEvent.linkedPubKeys().firstOrNull() val orange = MaterialTheme.colorScheme.bitcoinColor - ActivityCardFrame(orange) { + ActivityCardFrame(orange) { cardBackground -> ActivityHeaderRow( tint = orange, pillLabel = "CASHU", @@ -89,12 +89,12 @@ fun RenderNutzap( }, ) - RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + RenderZappedPost(note, quotesLeft, cardBackground, accountViewModel, nav) ActivityAmountRow(showAmount(BigDecimal(nutzapEvent.claimedSatsTotal())), orange) nutzapEvent.content.ifBlank { null }?.let { - CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel) + CrossfadeToDisplayComment(it, cardBackground, nav, accountViewModel) } } } 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 7cb99cc8e5..7cc8a1a22c 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 @@ -105,6 +105,12 @@ fun RenderOnchainZap( val orange = MaterialTheme.colorScheme.bitcoinColor + // The embedded note sits on the orange wash, so it must draw transparent and + // let that show through. Handing it the parent feed / MultiSetCard background + // instead would paint it black (the app background) or flash it with the + // new-note highlight, breaking the card's solid tint. + val cardBackground = remember { mutableStateOf(Color.Transparent) } + // Async chain lookup so we can show a real "Confirmed at block N" or // "In mempool…" pill rather than a sender-claimed status. Null = backend // not configured, or fetch failed — we just show the sender-claimed sats @@ -143,7 +149,7 @@ fun RenderOnchainZap( nav = nav, ) - RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + RenderZappedPost(note, quotesLeft, cardBackground, accountViewModel, nav) AmountRow(sats = sats, orange = orange) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Reaction.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Reaction.kt index d9b959b9d8..6772cc4130 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Reaction.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Reaction.kt @@ -50,7 +50,7 @@ fun RenderReaction( ) { val reactionType = note.event?.content ?: "" - ActivityCardFrame(LikeTint) { + ActivityCardFrame(LikeTint) { cardBackground -> ActivityHeaderRow( tint = LikeTint, pillLabel = "REACTION", @@ -77,6 +77,6 @@ fun RenderReaction( }, ) - RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + RenderZappedPost(note, quotesLeft, cardBackground, accountViewModel, nav) } } 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 3330a012fb..9c7ce8efe5 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 @@ -127,7 +127,7 @@ fun RenderLnZapCard( ) { val orange = MaterialTheme.colorScheme.bitcoinColor - ActivityCardFrame(orange) { + ActivityCardFrame(orange) { cardBackground -> ActivityHeaderRow( tint = orange, pillLabel = "LIGHTNING", @@ -150,12 +150,12 @@ fun RenderLnZapCard( }, ) - RenderZappedPost(note, quotesLeft, backgroundColor, accountViewModel, nav) + RenderZappedPost(note, quotesLeft, cardBackground, accountViewModel, nav) card.amount?.let { ActivityAmountRow(it, orange) } card.comment?.let { - CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel) + CrossfadeToDisplayComment(it, cardBackground, nav, accountViewModel) } } }