mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-21 00:01:26 +02:00
Putting user tags in the reply Information box
This commit is contained in:
@@ -109,7 +109,7 @@ fun NoteCompose(baseNote: Note, modifier: Modifier = Modifier, isInnerNote: Bool
|
|||||||
|
|
||||||
Column(modifier = Modifier.padding(start = if (!isInnerNote) 10.dp else 0.dp)
|
Column(modifier = Modifier.padding(start = if (!isInnerNote) 10.dp else 0.dp)
|
||||||
.clickable(onClick = {
|
.clickable(onClick = {
|
||||||
note?.let {
|
note.let {
|
||||||
navController.navigate("Note/${note.idHex}")
|
navController.navigate("Note/${note.idHex}")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -133,7 +133,7 @@ fun NoteCompose(baseNote: Note, modifier: Modifier = Modifier, isInnerNote: Bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (note.event is TextNoteEvent && (note.replyTo != null || note.mentions != null)) {
|
if (note.event is TextNoteEvent && (note.replyTo != null || note.mentions != null)) {
|
||||||
ReplyInformation(note.replyTo, note.mentions)
|
ReplyInformation(note.replyTo, note.mentions, navController)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.event is ReactionEvent || note.event is RepostEvent) {
|
if (note.event is ReactionEvent || note.event is RepostEvent) {
|
||||||
|
@@ -1,61 +1,65 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.note
|
package com.vitorpamplona.amethyst.ui.note
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.text.ClickableText
|
||||||
|
import androidx.compose.material.LocalTextStyle
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.navigation.NavController
|
||||||
import com.google.accompanist.flowlayout.FlowRow
|
import com.google.accompanist.flowlayout.FlowRow
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ReplyInformation(replyTo: MutableList<Note>?, mentions: List<User>?) {
|
fun ReplyInformation(replyTo: MutableList<Note>?, mentions: List<User>?, navController: NavController) {
|
||||||
FlowRow() {
|
FlowRow() {
|
||||||
/*
|
|
||||||
if (replyTo != null && replyTo.isNotEmpty()) {
|
|
||||||
Text(
|
|
||||||
" in reply to ",
|
|
||||||
fontSize = 13.sp,
|
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
|
||||||
)
|
|
||||||
replyTo.toSet().forEachIndexed { idx, note ->
|
|
||||||
val innerNoteState by note.live.observeAsState()
|
|
||||||
Text(
|
|
||||||
"${innerNoteState?.note?.idDisplayHex}${if (idx < replyTo.size - 1) ", " else ""}",
|
|
||||||
fontSize = 13.sp,
|
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (mentions != null && mentions.isNotEmpty()) {
|
if (mentions != null && mentions.isNotEmpty()) {
|
||||||
Text(
|
if (replyTo != null && replyTo.isNotEmpty()) {
|
||||||
"replying to ",
|
|
||||||
fontSize = 13.sp,
|
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
|
||||||
)
|
|
||||||
mentions.toSet().forEachIndexed { idx, user ->
|
|
||||||
val innerUserState by user.live.observeAsState()
|
|
||||||
Text(
|
Text(
|
||||||
"${innerUserState?.user?.toBestDisplayName()}",
|
"replying to ",
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (idx < mentions.size - 2) {
|
mentions.toSet().forEachIndexed { idx, user ->
|
||||||
Text(
|
val innerUserState by user.live.observeAsState()
|
||||||
", ",
|
val innerUser = innerUserState?.user
|
||||||
fontSize = 13.sp,
|
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
innerUser?.let { myUser ->
|
||||||
)
|
ClickableText(
|
||||||
} else if (idx < mentions.size - 1) {
|
AnnotatedString("@${myUser.toBestDisplayName()}"),
|
||||||
Text(
|
style = LocalTextStyle.current.copy(color = MaterialTheme.colors.primary.copy(alpha = 0.52f), fontSize = 13.sp),
|
||||||
" and ",
|
onClick = {
|
||||||
fontSize = 13.sp,
|
navController.navigate("User/${myUser.pubkeyHex}")
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (idx < mentions.size - 2) {
|
||||||
|
Text(
|
||||||
|
", ",
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
} else if (idx < mentions.size - 1) {
|
||||||
|
Text(
|
||||||
|
" and ",
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user