From 523b0616cf3e5b2af3d79e0f6b6afea398e504a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 18:45:26 +0000 Subject: [PATCH 1/2] fix: quoted NoteCompose stuck on the "new item" purple background calculateBackgroundColor captured parentBackgroundColor?.value once inside remember(createdAt), so an inner NoteCompose (repost or reply preview) that first composed while the outer was still highlighted would snapshot the purple color and never observe the outer's fade back to the default background. - Repost inner notes now share the parent's bgColor State directly when they have no own read-tracking, so they fade in lockstep with the outer. - Reply previews no longer receive parentBackgroundColor at all; they rely on replyModifier for their own visual style and never inherit the purple "new item" highlight from the surrounding post. --- .../com/vitorpamplona/amethyst/ui/note/NoteCompose.kt | 11 ++++++----- .../com/vitorpamplona/amethyst/ui/note/types/Text.kt | 2 +- .../vitorpamplona/amethyst/ui/note/types/ZapPoll.kt | 2 +- 3 files changed, 8 insertions(+), 7 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 e33451c4c4..47c15460ca 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 @@ -490,9 +490,12 @@ fun calculateBackgroundColor( val defaultBackgroundColor = MaterialTheme.colorScheme.background val newItemColor = MaterialTheme.colorScheme.newItemBackgroundColor - // Only fade in/out the "new item" highlight for items that track read state. - // Inner notes (reposts/quotes) pass routeForLastRead = null and reuse the parent color directly, - // so the LaunchedEffect would just park a coroutine for 5s per item during scroll. + // Inner notes (reposts) pass routeForLastRead = null with the parent's bgColor state; + // share it directly so the inner highlight fades in lockstep with the outer. + if (routeForLastRead == null && parentBackgroundColor != null) { + return parentBackgroundColor + } + val isNew = remember(createdAt, routeForLastRead) { routeForLastRead != null && accountViewModel.loadAndMarkAsRead(routeForLastRead, createdAt) @@ -1493,7 +1496,6 @@ fun getGradient(backgroundColor: MutableState): Brush = @Composable fun ReplyNoteComposition( replyingDirectlyTo: Note, - backgroundColor: MutableState, accountViewModel: AccountViewModel, nav: INav, ) { @@ -1504,7 +1506,6 @@ fun ReplyNoteComposition( unPackReply = ReplyRenderType.NONE, makeItShort = true, quotesLeft = 0, - parentBackgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt index ce5eb75ba0..c8aaead89f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt @@ -109,7 +109,7 @@ fun RenderTextEvent( if (replyingDirectlyTo != null && canShowReply) { when (unPackReply) { ReplyRenderType.FULL -> { - ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav) + ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav) Spacer(modifier = StdVertSpacer) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt index 48847aa61b..81bfb1b86f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt @@ -87,7 +87,7 @@ fun RenderZapPoll( } } if (replyingDirectlyTo != null) { - ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav) + ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav) Spacer(modifier = StdVertSpacer) } } From 19309c45873cf756e5d08c2f77ccad4f1bda55f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 19:07:26 +0000 Subject: [PATCH 2/2] fix: also fade reply previews together with the parent NoteCompose Restores ReplyNoteComposition's parentBackgroundColor parameter (reverting part of the previous commit). With calculateBackgroundColor now returning the parent State directly when routeForLastRead is null, every inner NoteCompose call site (replies, reposts, reactions, reports, approvals, attestations, multi-set / message-set notification cards, and rich-text nostr:event/nostr:note quotes) shares the level-0 bgColor State and fades in lockstep with the outer note. --- .../main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt | 2 ++ .../main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt | 2 +- .../java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt | 2 +- 3 files changed, 4 insertions(+), 2 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 47c15460ca..f56c0137e5 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 @@ -1496,6 +1496,7 @@ fun getGradient(backgroundColor: MutableState): Brush = @Composable fun ReplyNoteComposition( replyingDirectlyTo: Note, + backgroundColor: MutableState, accountViewModel: AccountViewModel, nav: INav, ) { @@ -1506,6 +1507,7 @@ fun ReplyNoteComposition( unPackReply = ReplyRenderType.NONE, makeItShort = true, quotesLeft = 0, + parentBackgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt index c8aaead89f..ce5eb75ba0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt @@ -109,7 +109,7 @@ fun RenderTextEvent( if (replyingDirectlyTo != null && canShowReply) { when (unPackReply) { ReplyRenderType.FULL -> { - ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav) + ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav) Spacer(modifier = StdVertSpacer) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt index 81bfb1b86f..48847aa61b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapPoll.kt @@ -87,7 +87,7 @@ fun RenderZapPoll( } } if (replyingDirectlyTo != null) { - ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav) + ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav) Spacer(modifier = StdVertSpacer) } }