From b30d87266d53c7dffab7fc94e6648cf8bb7b8904 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 23 Sep 2025 13:11:15 -0400 Subject: [PATCH] Improves borders for zap messages in notifications --- .../amethyst/ui/note/MultiSetCompose.kt | 27 +++++++++++++------ .../components/TranslatableRichTextViewer.kt | 10 ++++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt index 3ee67c5c7..42799727b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/MultiSetCompose.kt @@ -70,6 +70,7 @@ import com.vitorpamplona.amethyst.service.CachedRichTextParser import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserPicture import com.vitorpamplona.amethyst.ui.components.AnimatedBorderTextCornerRadius import com.vitorpamplona.amethyst.ui.components.CoreSecretMessage +import com.vitorpamplona.amethyst.ui.components.ExpandableRichTextViewer import com.vitorpamplona.amethyst.ui.components.InLineIconRenderer import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer @@ -491,7 +492,9 @@ private fun DisplayAuthorCommentAndAmount( } authorComment.comment?.let { - CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel) + Box(textBoxModifier) { + CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel) + } } } @@ -526,15 +529,23 @@ fun CrossfadeToDisplayComment( ) { TranslatableRichTextViewer( content = comment, - canPreview = true, - quotesLeft = 1, - tags = EmptyTagList, - modifier = textBoxModifier, - backgroundColor = backgroundColor, id = comment, + translationMessageModifier = Modifier.padding(top = 2.dp), accountViewModel = accountViewModel, - nav = nav, - ) + ) { + ExpandableRichTextViewer( + it, + true, + 1, + Modifier, + EmptyTagList, + backgroundColor, + comment, + null, + accountViewModel, + nav, + ) + } } @OptIn(ExperimentalLayoutApi::class) diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt index 31f5553f8..f71a7587c 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/ui/components/TranslatableRichTextViewer.kt @@ -24,8 +24,6 @@ import android.content.res.Resources import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check @@ -61,6 +59,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.Font14SP +import com.vitorpamplona.amethyst.ui.theme.MaxWidthPaddingTop5dp import com.vitorpamplona.amethyst.ui.theme.lessImportantLink import com.vitorpamplona.quartz.nip01Core.core.ImmutableListOfLists import kotlinx.coroutines.Dispatchers @@ -105,6 +104,7 @@ fun TranslatableRichTextViewer( fun TranslatableRichTextViewer( content: String, id: String, + translationMessageModifier: Modifier = MaxWidthPaddingTop5dp, accountViewModel: AccountViewModel, displayText: @Composable (String) -> Unit, ) { @@ -114,6 +114,7 @@ fun TranslatableRichTextViewer( RenderTextWithTranslateOptions( translatedTextState = it, content = content, + translationMessageModifier = translationMessageModifier, accountViewModel = accountViewModel, displayText = displayText, ) @@ -124,6 +125,7 @@ fun TranslatableRichTextViewer( private fun RenderTextWithTranslateOptions( translatedTextState: TranslationConfig, content: String, + translationMessageModifier: Modifier = MaxWidthPaddingTop5dp, accountViewModel: AccountViewModel, displayText: @Composable (String) -> Unit, ) { @@ -146,6 +148,7 @@ private fun RenderTextWithTranslateOptions( TranslationMessage( translatedTextState.sourceLang, translatedTextState.targetLang, + translationMessageModifier, accountViewModel, ) { showOriginal = it @@ -158,6 +161,7 @@ private fun RenderTextWithTranslateOptions( private fun TranslationMessage( source: String, target: String, + modifier: Modifier = MaxWidthPaddingTop5dp, accountViewModel: AccountViewModel, onChangeWhatToShow: (Boolean) -> Unit, ) { @@ -165,7 +169,7 @@ private fun TranslationMessage( val scope = rememberCoroutineScope() Row( - modifier = Modifier.fillMaxWidth().padding(top = 5.dp), + modifier = modifier, ) { val textColor = MaterialTheme.colorScheme.lessImportantLink