- Fixes some of the TopBar padding issues.
- Adds more info tap on single-user chat rooms - Moves creation date to a new line.
This commit is contained in:
@@ -91,6 +91,7 @@ import com.vitorpamplona.amethyst.ui.note.LongCommunityHeader
|
|||||||
import com.vitorpamplona.amethyst.ui.note.NonClickableUserPictures
|
import com.vitorpamplona.amethyst.ui.note.NonClickableUserPictures
|
||||||
import com.vitorpamplona.amethyst.ui.note.SearchIcon
|
import com.vitorpamplona.amethyst.ui.note.SearchIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.ShortCommunityHeader
|
import com.vitorpamplona.amethyst.ui.note.ShortCommunityHeader
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.UserCompose
|
||||||
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
@@ -108,7 +109,6 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.SpinnerSelectionDialog
|
|||||||
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier
|
import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size22Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size22Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size34dp
|
import com.vitorpamplona.amethyst.ui.theme.Size34dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size40dp
|
import com.vitorpamplona.amethyst.ui.theme.Size40dp
|
||||||
@@ -231,7 +231,7 @@ private fun CommunityTopBar(
|
|||||||
ShortCommunityHeader(baseNote, fontWeight = FontWeight.Medium, accountViewModel, nav)
|
ShortCommunityHeader(baseNote, fontWeight = FontWeight.Medium, accountViewModel, nav)
|
||||||
},
|
},
|
||||||
extendableRow = {
|
extendableRow = {
|
||||||
LongCommunityHeader(baseNote, accountViewModel, nav)
|
LongCommunityHeader(baseNote = baseNote, accountViewModel = accountViewModel, nav = nav)
|
||||||
},
|
},
|
||||||
popBack = navPopBack
|
popBack = navPopBack
|
||||||
)
|
)
|
||||||
@@ -297,6 +297,17 @@ private fun RenderRoomTopBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
extendableRow = {
|
||||||
|
LoadUser(baseUserHex = room.users.first()) {
|
||||||
|
if (it != null) {
|
||||||
|
UserCompose(
|
||||||
|
baseUser = it,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
nav = nav
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
popBack = navPopBack
|
popBack = navPopBack
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@@ -308,10 +319,17 @@ private fun RenderRoomTopBar(
|
|||||||
size = Size34dp
|
size = Size34dp
|
||||||
)
|
)
|
||||||
|
|
||||||
RoomNameOnlyDisplay(room, Modifier.padding(start = 10.dp).weight(1f), fontWeight = FontWeight.Medium, accountViewModel.userProfile())
|
RoomNameOnlyDisplay(
|
||||||
|
room,
|
||||||
|
Modifier
|
||||||
|
.padding(start = 10.dp)
|
||||||
|
.weight(1f),
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
accountViewModel.userProfile()
|
||||||
|
)
|
||||||
},
|
},
|
||||||
extendableRow = {
|
extendableRow = {
|
||||||
LongRoomHeader(room, accountViewModel, nav)
|
LongRoomHeader(room = room, accountViewModel = accountViewModel, nav = nav)
|
||||||
},
|
},
|
||||||
popBack = navPopBack
|
popBack = navPopBack
|
||||||
)
|
)
|
||||||
@@ -342,7 +360,7 @@ private fun ChannelTopBar(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
extendableRow = {
|
extendableRow = {
|
||||||
LongChannelHeader(baseChannel, accountViewModel, nav)
|
LongChannelHeader(baseChannel = baseChannel, accountViewModel = accountViewModel, nav = nav)
|
||||||
},
|
},
|
||||||
popBack = navPopBack
|
popBack = navPopBack
|
||||||
)
|
)
|
||||||
@@ -861,9 +879,7 @@ fun MyExtensibleTopAppBar(
|
|||||||
|
|
||||||
if (expanded.value && extendableRow != null) {
|
if (expanded.value && extendableRow != null) {
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(bottom = Size10dp),
|
|
||||||
horizontalArrangement = Arrangement.Start,
|
horizontalArrangement = Arrangement.Start,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.JoinCommunityButton
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.JoinCommunityButton
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.LeaveCommunityButton
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.LeaveCommunityButton
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.LiveFlag
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.LiveFlag
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.NormalTimeAgo
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ScheduledFlag
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ScheduledFlag
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
@@ -124,6 +125,7 @@ import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding
|
|||||||
import com.vitorpamplona.amethyst.ui.theme.HalfVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.HalfVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier
|
import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.QuoteBorder
|
import com.vitorpamplona.amethyst.ui.theme.QuoteBorder
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size15Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size15Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size16Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size16Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
||||||
@@ -517,7 +519,7 @@ fun CommunityHeader(
|
|||||||
Column(Modifier.fillMaxWidth()) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
modifier = modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
if (sendToCommunity) {
|
if (sendToCommunity) {
|
||||||
routeFor(baseNote, accountViewModel.userProfile())?.let {
|
routeFor(baseNote, accountViewModel.userProfile())?.let {
|
||||||
nav(it)
|
nav(it)
|
||||||
@@ -534,7 +536,7 @@ fun CommunityHeader(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (expanded.value) {
|
if (expanded.value) {
|
||||||
LongCommunityHeader(baseNote, accountViewModel, nav)
|
LongCommunityHeader(baseNote = baseNote, lineModifier = modifier, accountViewModel = accountViewModel, nav = nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,23 +549,24 @@ fun CommunityHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
fun LongCommunityHeader(
|
||||||
|
baseNote: AddressableNote,
|
||||||
|
lineModifier: Modifier = Modifier.padding(horizontal = Size10dp, vertical = Size5dp),
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit
|
||||||
|
) {
|
||||||
val noteState by baseNote.live().metadata.observeAsState()
|
val noteState by baseNote.live().metadata.observeAsState()
|
||||||
val noteEvent = remember(noteState) { noteState?.note?.event as? CommunityDefinitionEvent } ?: return
|
val noteEvent = remember(noteState) { noteState?.note?.event as? CommunityDefinitionEvent } ?: return
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 10.dp)
|
|
||||||
) {
|
) {
|
||||||
val summary = remember(noteState) {
|
val summary = remember(noteState) {
|
||||||
noteEvent.description()?.ifBlank { null }
|
noteEvent.description()?.ifBlank { null }
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier.weight(1f)
|
||||||
.weight(1f)
|
|
||||||
.padding(start = 10.dp)
|
|
||||||
) {
|
) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
val defaultBackground = MaterialTheme.colors.background
|
val defaultBackground = MaterialTheme.colors.background
|
||||||
@@ -598,17 +601,14 @@ fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountView
|
|||||||
}
|
}
|
||||||
|
|
||||||
rules?.let {
|
rules?.let {
|
||||||
Spacer(DoubleVertSpacer)
|
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 10.dp)
|
|
||||||
) {
|
) {
|
||||||
val defaultBackground = MaterialTheme.colors.background
|
val defaultBackground = MaterialTheme.colors.background
|
||||||
val background = remember {
|
val background = remember {
|
||||||
mutableStateOf(defaultBackground)
|
mutableStateOf(defaultBackground)
|
||||||
}
|
}
|
||||||
val tags = remember(noteEvent) { noteEvent?.tags()?.toImmutableListOfLists() ?: ImmutableListOfLists() }
|
val tags = remember(noteEvent) { noteEvent.tags().toImmutableListOfLists() }
|
||||||
|
|
||||||
TranslatableRichTextViewer(
|
TranslatableRichTextViewer(
|
||||||
content = it,
|
content = it,
|
||||||
@@ -621,12 +621,8 @@ fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(DoubleVertSpacer)
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier,
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 10.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -639,8 +635,6 @@ fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountView
|
|||||||
NoteAuthorPicture(baseNote, nav, accountViewModel, Size25dp)
|
NoteAuthorPicture(baseNote, nav, accountViewModel, Size25dp)
|
||||||
Spacer(DoubleHorzSpacer)
|
Spacer(DoubleHorzSpacer)
|
||||||
NoteUsernameDisplay(baseNote, remember { Modifier.weight(1f) })
|
NoteUsernameDisplay(baseNote, remember { Modifier.weight(1f) })
|
||||||
TimeAgo(baseNote)
|
|
||||||
MoreOptionsButton(baseNote, accountViewModel)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var participantUsers by remember(baseNote) {
|
var participantUsers by remember(baseNote) {
|
||||||
@@ -664,12 +658,9 @@ fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountView
|
|||||||
|
|
||||||
participantUsers.forEach {
|
participantUsers.forEach {
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier.clickable {
|
||||||
.fillMaxWidth()
|
nav("User/${it.second.pubkeyHex}")
|
||||||
.padding(start = 10.dp, top = 10.dp)
|
},
|
||||||
.clickable {
|
|
||||||
nav("User/${it.second.pubkeyHex}")
|
|
||||||
},
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
it.first.role?.let { it1 ->
|
it.first.role?.let { it1 ->
|
||||||
@@ -686,6 +677,21 @@ fun LongCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountView
|
|||||||
UsernameDisplay(it.second, remember { Modifier.weight(1f) })
|
UsernameDisplay(it.second, remember { Modifier.weight(1f) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row(
|
||||||
|
lineModifier,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.created_at),
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = Modifier.width(75.dp)
|
||||||
|
)
|
||||||
|
Spacer(DoubleHorzSpacer)
|
||||||
|
NormalTimeAgo(baseNote = baseNote, Modifier.weight(1f))
|
||||||
|
MoreOptionsButton(baseNote, accountViewModel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -3424,7 +3430,12 @@ fun AudioHeader(noteEvent: AudioHeaderEvent, note: Note, accountViewModel: Accou
|
|||||||
}
|
}
|
||||||
|
|
||||||
content?.let {
|
content?.let {
|
||||||
Row(verticalAlignment = CenterVertically, modifier = Modifier.fillMaxWidth().padding(top = 5.dp)) {
|
Row(
|
||||||
|
verticalAlignment = CenterVertically,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(top = 5.dp)
|
||||||
|
) {
|
||||||
TranslatableRichTextViewer(
|
TranslatableRichTextViewer(
|
||||||
content = it,
|
content = it,
|
||||||
canPreview = true,
|
canPreview = true,
|
||||||
|
|||||||
@@ -13,18 +13,12 @@ import androidx.compose.ui.unit.dp
|
|||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UserCompose(
|
fun UserCompose(
|
||||||
baseUser: User,
|
baseUser: User,
|
||||||
overallModifier: Modifier = remember {
|
overallModifier: Modifier = StdPadding,
|
||||||
Modifier
|
|
||||||
.padding(
|
|
||||||
start = 12.dp,
|
|
||||||
end = 12.dp,
|
|
||||||
top = 10.dp
|
|
||||||
)
|
|
||||||
},
|
|
||||||
showDiviser: Boolean = true,
|
showDiviser: Boolean = true,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
@@ -56,7 +50,6 @@ fun UserCompose(
|
|||||||
|
|
||||||
if (showDiviser) {
|
if (showDiviser) {
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(top = 10.dp),
|
|
||||||
thickness = 0.25.dp
|
thickness = 0.25.dp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ import com.vitorpamplona.amethyst.ui.note.LoadChannel
|
|||||||
import com.vitorpamplona.amethyst.ui.note.MoreOptionsButton
|
import com.vitorpamplona.amethyst.ui.note.MoreOptionsButton
|
||||||
import com.vitorpamplona.amethyst.ui.note.NoteAuthorPicture
|
import com.vitorpamplona.amethyst.ui.note.NoteAuthorPicture
|
||||||
import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay
|
import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.note.TimeAgo
|
|
||||||
import com.vitorpamplona.amethyst.ui.note.UserPicture
|
import com.vitorpamplona.amethyst.ui.note.UserPicture
|
||||||
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
|
||||||
import com.vitorpamplona.amethyst.ui.note.ZapReaction
|
import com.vitorpamplona.amethyst.ui.note.ZapReaction
|
||||||
import com.vitorpamplona.amethyst.ui.note.routeFor
|
import com.vitorpamplona.amethyst.ui.note.routeFor
|
||||||
import com.vitorpamplona.amethyst.ui.note.timeAgo
|
import com.vitorpamplona.amethyst.ui.note.timeAgo
|
||||||
|
import com.vitorpamplona.amethyst.ui.note.timeAgoShort
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrChannelFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrChannelFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists
|
||||||
@@ -580,7 +580,7 @@ fun ChannelHeader(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (expanded.value) {
|
if (expanded.value) {
|
||||||
LongChannelHeader(baseChannel, accountViewModel, nav)
|
LongChannelHeader(baseChannel = baseChannel, accountViewModel = accountViewModel, nav = nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,6 +722,7 @@ fun ShortChannelHeader(
|
|||||||
@Composable
|
@Composable
|
||||||
fun LongChannelHeader(
|
fun LongChannelHeader(
|
||||||
baseChannel: Channel,
|
baseChannel: Channel,
|
||||||
|
lineModifier: Modifier = Modifier.padding(horizontal = 10.dp, vertical = 5.dp),
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -731,18 +732,14 @@ fun LongChannelHeader(
|
|||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 10.dp)
|
|
||||||
) {
|
) {
|
||||||
val summary = remember(channelState) {
|
val summary = remember(channelState) {
|
||||||
channel.summary()?.ifBlank { null }
|
channel.summary()?.ifBlank { null }
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier.weight(1f)
|
||||||
.weight(1f)
|
|
||||||
.padding(start = 10.dp)
|
|
||||||
) {
|
) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
val defaultBackground = MaterialTheme.colors.background
|
val defaultBackground = MaterialTheme.colors.background
|
||||||
@@ -769,7 +766,9 @@ fun LongChannelHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (baseChannel is LiveActivitiesChannel) {
|
if (baseChannel is LiveActivitiesChannel) {
|
||||||
val hashtags = remember(baseChannel.info) { baseChannel.info?.hashtags()?.toImmutableList() ?: persistentListOf() }
|
val hashtags = remember(baseChannel.info) {
|
||||||
|
baseChannel.info?.hashtags()?.toImmutableList() ?: persistentListOf()
|
||||||
|
}
|
||||||
DisplayUncitedHashtags(hashtags, summary ?: "", nav)
|
DisplayUncitedHashtags(hashtags, summary ?: "", nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,28 +783,37 @@ fun LongChannelHeader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(DoubleVertSpacer)
|
LoadNote(baseNoteHex = channel.idHex) { loadingNote ->
|
||||||
|
loadingNote?.let { note ->
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier,
|
||||||
.fillMaxWidth()
|
verticalAlignment = Alignment.CenterVertically
|
||||||
.padding(start = 10.dp),
|
) {
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
LoadNote(baseNoteHex = channel.idHex) {
|
|
||||||
it?.let {
|
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.owner),
|
text = stringResource(id = R.string.owner),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.width(55.dp)
|
modifier = Modifier.width(75.dp)
|
||||||
)
|
)
|
||||||
Spacer(DoubleHorzSpacer)
|
Spacer(DoubleHorzSpacer)
|
||||||
NoteAuthorPicture(it, nav, accountViewModel, Size25dp)
|
NoteAuthorPicture(note, nav, accountViewModel, Size25dp)
|
||||||
Spacer(DoubleHorzSpacer)
|
Spacer(DoubleHorzSpacer)
|
||||||
NoteUsernameDisplay(it, remember { Modifier.weight(1f) })
|
NoteUsernameDisplay(note, remember { Modifier.weight(1f) })
|
||||||
TimeAgo(it)
|
}
|
||||||
MoreOptionsButton(it, accountViewModel)
|
|
||||||
|
Row(
|
||||||
|
lineModifier,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.created_at),
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = Modifier.width(75.dp)
|
||||||
|
)
|
||||||
|
Spacer(DoubleHorzSpacer)
|
||||||
|
NormalTimeAgo(note, remember { Modifier.weight(1f) })
|
||||||
|
MoreOptionsButton(note, accountViewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -831,9 +839,7 @@ fun LongChannelHeader(
|
|||||||
|
|
||||||
participantUsers.forEach {
|
participantUsers.forEach {
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
lineModifier
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 10.dp, top = 10.dp)
|
|
||||||
.clickable {
|
.clickable {
|
||||||
nav("User/${it.second.pubkeyHex}")
|
nav("User/${it.second.pubkeyHex}")
|
||||||
},
|
},
|
||||||
@@ -856,6 +862,24 @@ fun LongChannelHeader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun NormalTimeAgo(baseNote: Note, modifier: Modifier) {
|
||||||
|
val nowStr = stringResource(id = R.string.now)
|
||||||
|
|
||||||
|
val time by remember(baseNote) {
|
||||||
|
derivedStateOf {
|
||||||
|
timeAgoShort(baseNote.createdAt() ?: 0, nowStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = time,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = modifier
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ShortChannelActionOptions(
|
private fun ShortChannelActionOptions(
|
||||||
channel: PublicChatChannel,
|
channel: PublicChatChannel,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import androidx.compose.animation.Crossfade
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
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.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@@ -550,7 +549,7 @@ fun GroupChatroomHeader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (expanded.value) {
|
if (expanded.value) {
|
||||||
LongRoomHeader(room, accountViewModel, nav)
|
LongRoomHeader(room = room, accountViewModel = accountViewModel, nav = nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,15 +686,18 @@ fun NewSubjectView(onClose: () -> Unit, accountViewModel: AccountViewModel, room
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LongRoomHeader(room: ChatroomKey, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
fun LongRoomHeader(
|
||||||
|
room: ChatroomKey,
|
||||||
|
lineModifier: Modifier = StdPadding,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: (String) -> Unit
|
||||||
|
) {
|
||||||
val list = remember(room) {
|
val list = remember(room) {
|
||||||
room.users.toPersistentList()
|
room.users.toPersistentList()
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.padding(top = 10.dp)
|
|
||||||
.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
@@ -712,16 +714,18 @@ fun LongRoomHeader(room: ChatroomKey, accountViewModel: AccountViewModel, nav: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxHeight(),
|
modifier = Modifier,
|
||||||
contentPadding = PaddingValues(
|
|
||||||
bottom = 10.dp
|
|
||||||
),
|
|
||||||
state = rememberLazyListState()
|
state = rememberLazyListState()
|
||||||
) {
|
) {
|
||||||
itemsIndexed(list, key = { _, item -> item }) { _, item ->
|
itemsIndexed(list, key = { _, item -> item }) { _, item ->
|
||||||
LoadUser(baseUserHex = item) {
|
LoadUser(baseUserHex = item) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
UserCompose(baseUser = it, accountViewModel = accountViewModel, nav = nav)
|
UserCompose(
|
||||||
|
baseUser = it,
|
||||||
|
overallModifier = lineModifier,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
nav = nav
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -546,4 +546,6 @@
|
|||||||
|
|
||||||
<string name="copy_url_to_clipboard">Copy URL to clipboard</string>
|
<string name="copy_url_to_clipboard">Copy URL to clipboard</string>
|
||||||
<string name="copy_the_note_id_to_the_clipboard">Copy Note ID to clipboard</string>
|
<string name="copy_the_note_id_to_the_clipboard">Copy Note ID to clipboard</string>
|
||||||
|
|
||||||
|
<string name="created_at">Created at</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user