Improves borders for zap messages in notifications

This commit is contained in:
Vitor Pamplona
2025-09-23 13:11:15 -04:00
parent f9204d37f2
commit b30d87266d
2 changed files with 26 additions and 11 deletions
@@ -70,6 +70,7 @@ import com.vitorpamplona.amethyst.service.CachedRichTextParser
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserPicture import com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.observeUserPicture
import com.vitorpamplona.amethyst.ui.components.AnimatedBorderTextCornerRadius import com.vitorpamplona.amethyst.ui.components.AnimatedBorderTextCornerRadius
import com.vitorpamplona.amethyst.ui.components.CoreSecretMessage 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.InLineIconRenderer
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
@@ -491,7 +492,9 @@ private fun DisplayAuthorCommentAndAmount(
} }
authorComment.comment?.let { authorComment.comment?.let {
CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel) Box(textBoxModifier) {
CrossfadeToDisplayComment(it, backgroundColor, nav, accountViewModel)
}
} }
} }
@@ -526,15 +529,23 @@ fun CrossfadeToDisplayComment(
) { ) {
TranslatableRichTextViewer( TranslatableRichTextViewer(
content = comment, content = comment,
canPreview = true,
quotesLeft = 1,
tags = EmptyTagList,
modifier = textBoxModifier,
backgroundColor = backgroundColor,
id = comment, id = comment,
translationMessageModifier = Modifier.padding(top = 2.dp),
accountViewModel = accountViewModel, accountViewModel = accountViewModel,
nav = nav, ) {
) ExpandableRichTextViewer(
it,
true,
1,
Modifier,
EmptyTagList,
backgroundColor,
comment,
null,
accountViewModel,
nav,
)
}
} }
@OptIn(ExperimentalLayoutApi::class) @OptIn(ExperimentalLayoutApi::class)
@@ -24,8 +24,6 @@ import android.content.res.Resources
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer 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.foundation.layout.size
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check 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.stringRes
import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.DividerThickness
import com.vitorpamplona.amethyst.ui.theme.Font14SP import com.vitorpamplona.amethyst.ui.theme.Font14SP
import com.vitorpamplona.amethyst.ui.theme.MaxWidthPaddingTop5dp
import com.vitorpamplona.amethyst.ui.theme.lessImportantLink import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
import com.vitorpamplona.quartz.nip01Core.core.ImmutableListOfLists import com.vitorpamplona.quartz.nip01Core.core.ImmutableListOfLists
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@@ -105,6 +104,7 @@ fun TranslatableRichTextViewer(
fun TranslatableRichTextViewer( fun TranslatableRichTextViewer(
content: String, content: String,
id: String, id: String,
translationMessageModifier: Modifier = MaxWidthPaddingTop5dp,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
displayText: @Composable (String) -> Unit, displayText: @Composable (String) -> Unit,
) { ) {
@@ -114,6 +114,7 @@ fun TranslatableRichTextViewer(
RenderTextWithTranslateOptions( RenderTextWithTranslateOptions(
translatedTextState = it, translatedTextState = it,
content = content, content = content,
translationMessageModifier = translationMessageModifier,
accountViewModel = accountViewModel, accountViewModel = accountViewModel,
displayText = displayText, displayText = displayText,
) )
@@ -124,6 +125,7 @@ fun TranslatableRichTextViewer(
private fun RenderTextWithTranslateOptions( private fun RenderTextWithTranslateOptions(
translatedTextState: TranslationConfig, translatedTextState: TranslationConfig,
content: String, content: String,
translationMessageModifier: Modifier = MaxWidthPaddingTop5dp,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
displayText: @Composable (String) -> Unit, displayText: @Composable (String) -> Unit,
) { ) {
@@ -146,6 +148,7 @@ private fun RenderTextWithTranslateOptions(
TranslationMessage( TranslationMessage(
translatedTextState.sourceLang, translatedTextState.sourceLang,
translatedTextState.targetLang, translatedTextState.targetLang,
translationMessageModifier,
accountViewModel, accountViewModel,
) { ) {
showOriginal = it showOriginal = it
@@ -158,6 +161,7 @@ private fun RenderTextWithTranslateOptions(
private fun TranslationMessage( private fun TranslationMessage(
source: String, source: String,
target: String, target: String,
modifier: Modifier = MaxWidthPaddingTop5dp,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
onChangeWhatToShow: (Boolean) -> Unit, onChangeWhatToShow: (Boolean) -> Unit,
) { ) {
@@ -165,7 +169,7 @@ private fun TranslationMessage(
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
Row( Row(
modifier = Modifier.fillMaxWidth().padding(top = 5.dp), modifier = modifier,
) { ) {
val textColor = MaterialTheme.colorScheme.lessImportantLink val textColor = MaterialTheme.colorScheme.lessImportantLink