From 70683b431fcb7eba1c9cdf47258212d3cee9a731 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Sun, 3 May 2026 00:50:25 +0200 Subject: [PATCH] Change reply UI/UX --- .../ui/composable/WriteNewNoteScreen.kt | 2 +- .../widgets/detail/TextNoteEventDetail.kt | 89 +++++++++++++++---- .../widgets/feed/TextNoteFeedItem.kt | 35 ++++++++ 3 files changed, 106 insertions(+), 20 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/WriteNewNoteScreen.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/WriteNewNoteScreen.kt index a79f4dc5..3f9703ca 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/WriteNewNoteScreen.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/WriteNewNoteScreen.kt @@ -461,7 +461,7 @@ private fun WriteNewNoteScreenPreview() { initialWriteNewNoteUIState = WriteNewNoteUIState.InputPrompt( // text = "Yes, I did it. So WHAT?!", - quotedNostrEvent = LocalNostrEvent( + inReplyToNostrEvent = LocalNostrEvent( nostrEvent = NostrEvent( id = "eventId", pubKey = "publicKey", diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/detail/TextNoteEventDetail.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/detail/TextNoteEventDetail.kt index 8c7e1d2c..56e2ce35 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/detail/TextNoteEventDetail.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/detail/TextNoteEventDetail.kt @@ -4,10 +4,14 @@ import ac.cord.auxiliary.compose.database.model.NostrEvent import ac.cord.auxiliary.compose.database.model.Profile import ac.cord.auxiliary.compose.database.model.intermdiate.LocalNostrEvent import ac.cord.auxiliary.compose.extensions.toFormattedTimeAndDateString +import ac.cord.auxiliary.compose.ui.composable.widgets.content.ContentParser +import ac.cord.auxiliary.compose.ui.composable.widgets.content.ContentSegment import ac.cord.auxiliary.compose.ui.composable.widgets.content.RichContent import ac.cord.auxiliary.compose.ui.composable.widgets.profile.ProfileAvatar import ac.cord.auxiliary.compose.ui.composable.widgets.profile.ProfileColor import ac.cord.auxiliary.compose.ui.theme.AuxTheme +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -18,6 +22,10 @@ import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.text.input.InputTransformation +import androidx.compose.foundation.text.input.OutputTransformation +import androidx.compose.foundation.text.input.rememberTextFieldState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AddReaction import androidx.compose.material.icons.filled.ArrowBackIosNew @@ -26,6 +34,8 @@ import androidx.compose.material.icons.filled.CurrencyBitcoin import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.Person import androidx.compose.material.icons.filled.Repeat +import androidx.compose.material.icons.filled.Reply +import androidx.compose.material.icons.filled.Send import androidx.compose.material3.BottomAppBar import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api @@ -37,10 +47,13 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.TextField import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -201,28 +214,66 @@ fun TextNoteEventDetail( ) } }, - floatingActionButton = { - ExtendedFloatingActionButton( - onClick = { - onNavigateToWriteAReply.invoke( - localNostrEvent.nostrEvent.id - ) - }, - icon = { - Icon( - Icons.Default.ChatBubble, - contentDescription = "Reply" - ) - }, - text = { - Text("Reply") - } - ) - }, +// floatingActionButton = { +// ExtendedFloatingActionButton( +// onClick = { +// onNavigateToWriteAReply.invoke( +// localNostrEvent.nostrEvent.id +// ) +// }, +// icon = { +// Icon( +// Icons.Default.ChatBubble, +// contentDescription = "Reply" +// ) +// }, +// text = { +// Text("Reply") +// } +// ) +// }, windowInsets = WindowInsets.navigationBars ) - HorizontalDivider() + Surface( + modifier = Modifier + .fillMaxWidth() + .clickable { + onNavigateToWriteAReply.invoke( + localNostrEvent.nostrEvent.id + ) + }, + color = MaterialTheme.colorScheme.surfaceVariant + ) { + Row( + modifier = Modifier.padding(20.dp).fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(10.dp), + ) { + // TODO: Load user profile... + Icon( + Icons.Default.Person, + contentDescription = "User profile", + tint = ProfileColor.fromPublicKey("profile") + ) +// ProfileAvatar( +// profile = localProfile.profile, +// size = 35.dp +// ) + + Text( + modifier = Modifier.weight(1f), + text = "Reply to ${localNostrEvent.profile?.humanReadableNameOrPubkey() ?: "the above"}", + maxLines = 1, + ) + + Icon( + Icons.Default.ChatBubble, + contentDescription = "User profile", + ) + } + + } + Text("Replies coming soon...") } diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt index e3111151..70f933ff 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/TextNoteFeedItem.kt @@ -4,11 +4,13 @@ import ac.cord.auxiliary.compose.database.model.NostrEvent import ac.cord.auxiliary.compose.database.model.Profile import ac.cord.auxiliary.compose.database.model.intermdiate.LocalInReplyToNostrEvent import ac.cord.auxiliary.compose.database.model.intermdiate.LocalMention +import ac.cord.auxiliary.compose.database.model.intermdiate.LocalNostrEvent import ac.cord.auxiliary.compose.database.model.intermdiate.LocalQuotedNostrEvent import ac.cord.auxiliary.compose.extensions.toFormattedTimeAndDateString import ac.cord.auxiliary.compose.ui.composable.widgets.content.RichContent import ac.cord.auxiliary.compose.ui.composable.widgets.profile.ProfileAvatar import ac.cord.auxiliary.compose.ui.composable.widgets.profile.ProfileColor +import ac.cord.auxiliary.compose.ui.theme.AuxTheme import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -22,11 +24,13 @@ import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SuggestionChip +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.vitorpamplona.quartz.nip01Core.core.HexKey @@ -186,3 +190,34 @@ internal fun TextNoteFeedItem( } } } + +@Preview +@Composable +private fun EventListViewPreview() { + AuxTheme { + Surface( + modifier = Modifier.padding(20.dp) + ) { + TextNoteFeedItem( + nostrEvent = NostrEvent( + id = "hex", + content = "Something something something", + pubKey = "hexpubkeypubkeypubkeypubkey", + kind = 0, + sig = "hexsig", + tags = emptyArray() + ), + profile = Profile( + publicKey = "", + nostrEventId = "referenced", + displayName = "Frank Talk", + nip05 = "frank@talk.at" + ), + localQuotedNostrEvent = null, + localInReplyToNostrEvent = null, + mentionedProfiles = emptyList(), + onNavigateToEvent = {} + ) + } + } +} \ No newline at end of file