mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 23:26:49 +01:00
Fixes the visual references to communities and hashtags in the top right of the post
This commit is contained in:
@@ -22,14 +22,12 @@ package com.vitorpamplona.amethyst.ui.note.elements
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.ui.components.buildLinkString
|
||||
import com.vitorpamplona.amethyst.ui.components.ClickableTextColor
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -53,29 +51,20 @@ private fun DisplayCommunity(
|
||||
note: Note,
|
||||
nav: INav,
|
||||
) {
|
||||
val communityTag =
|
||||
remember(note) { note.event?.communityAddress() } ?: return
|
||||
val communityTag = note.event?.communityAddress() ?: return
|
||||
|
||||
val displayTag =
|
||||
remember(note) {
|
||||
buildLinkString(
|
||||
getCommunityShortName(communityTag),
|
||||
) {
|
||||
nav.nav(Route.Community(communityTag.kind, communityTag.pubKeyHex, communityTag.dTag))
|
||||
ClickableTextColor(
|
||||
getCommunityShortName(communityTag),
|
||||
linkColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.52f),
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
) {
|
||||
nav.nav {
|
||||
note.event?.communityAddress()?.let { communityTag ->
|
||||
Route.Community(communityTag.kind, communityTag.pubKeyHex, communityTag.dTag)
|
||||
}
|
||||
}
|
||||
|
||||
Text(
|
||||
text = displayTag,
|
||||
style =
|
||||
LocalTextStyle.current.copy(
|
||||
color =
|
||||
MaterialTheme.colorScheme.primary.copy(
|
||||
alpha = 0.52f,
|
||||
),
|
||||
),
|
||||
maxLines = 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun getCommunityShortName(communityAddress: Address): String {
|
||||
|
||||
@@ -23,9 +23,7 @@ package com.vitorpamplona.amethyst.ui.note.elements
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -36,7 +34,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.ui.components.buildLinkString
|
||||
import com.vitorpamplona.amethyst.ui.components.ClickableTextColor
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -82,15 +80,12 @@ private fun DisplayTagList(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
Text(
|
||||
text =
|
||||
remember(firstTag) {
|
||||
buildLinkString(" #$firstTag") {
|
||||
nav.nav(Route.Hashtag(firstTag))
|
||||
}
|
||||
},
|
||||
style = LocalTextStyle.current.copy(MaterialTheme.colorScheme.primary.copy(alpha = 0.52f)),
|
||||
ClickableTextColor(
|
||||
"#$firstTag",
|
||||
linkColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.52f),
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
)
|
||||
) {
|
||||
nav.nav(Route.Hashtag(firstTag))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user