From 3b044a8d23ee99d44edbb44ea2a13b034f80a796 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 9 May 2024 17:54:01 +0530 Subject: [PATCH] chore: reflow `UserProfile` code for pedantic reasons --- .../msfjarvis/claw/common/user/UserProfile.kt | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/user/UserProfile.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/user/UserProfile.kt index f27e189d..016f8247 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/user/UserProfile.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/user/UserProfile.kt @@ -110,31 +110,33 @@ private fun UserProfileInternal( Text(text = user.username, style = MaterialTheme.typography.displaySmall) ThemedRichText(text = user.about) user.invitedBy?.let { invitedBy -> + val linkTextStyle = + with(LocalTextStyle.current) { + SpanStyle( + LocalContentColor.current, + fontSize, + fontWeight, + fontStyle, + fontSynthesis, + fontFamily, + fontFeatureSettings, + letterSpacing, + baselineShift, + textGeometricTransform, + localeList, + background, + textDecoration, + shadow, + ) + } val text = buildAnnotatedString { - val style = - with(LocalTextStyle.current) { - SpanStyle( - LocalContentColor.current, - fontSize, - fontWeight, - fontStyle, - fontSynthesis, - fontFamily, - fontFeatureSettings, - letterSpacing, - baselineShift, - textGeometricTransform, - localeList, - background, - textDecoration, - shadow, - ) - } - withStyle(style = style) { append("Invited by ") } + withStyle(linkTextStyle) { append("Invited by ") } pushStringAnnotation(tag = "URL", annotation = invitedBy) withStyle( - style = - style.copy(textDecoration = TextDecoration.Underline, fontWeight = FontWeight.Bold) + linkTextStyle.copy( + textDecoration = TextDecoration.Underline, + fontWeight = FontWeight.Bold, + ) ) { append(invitedBy) }