Refactor: Improve layout structure in ChannelSideDrawer

This commit enhances the layout structure of the ChannelSideDrawer component by reorganizing the placement of UI elements for better readability and visual separation.

- Moved the HorizontalDivider to encapsulate the ChannelItem for SavedMessages, improving the visual hierarchy.
- Removed redundant divider items and adjusted spacing for a cleaner layout.
- Ensured consistent padding and alignment for UI elements within the drawer.
This commit is contained in:
AbronStudio 2025-08-07 12:31:58 +03:30
parent 26e0c3443e
commit 99d47cd51a
1 changed files with 26 additions and 30 deletions

View File

@ -674,46 +674,42 @@ private fun ColumnScope.DirectMessagesChannelListRenderer(
.fillMaxSize()
.weight(1f)
) {
item("top-divider") {
HorizontalDivider(
Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp)
)
}
item(key = "saved_messages") {
val notesChannel = RevoltAPI.channelCache.values.firstOrNull {
it.channelType == ChannelType.SavedMessages
}
if (notesChannel != null) {
ChannelItem(
channel = Channel(
id = notesChannel.id,
name = stringResource(R.string.channel_notes),
channelType = ChannelType.SavedMessages
),
isCurrent = currentDestination is ChatRouterDestination.Channel &&
currentDestination.channelId == notesChannel.id,
onDestinationChanged = {
onDestinationChanged(it)
},
hasUnread = false,
onOpenChannelContextSheet = {},
HorizontalDivider(
Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp)
)
Column(Modifier.fillMaxWidth()) {
ChannelItem(
channel = Channel(
id = notesChannel.id,
name = stringResource(R.string.channel_notes),
channelType = ChannelType.SavedMessages
),
isCurrent = currentDestination is ChatRouterDestination.Channel &&
currentDestination.channelId == notesChannel.id,
onDestinationChanged = {
onDestinationChanged(it)
},
hasUnread = false,
onOpenChannelContextSheet = {},
)
HorizontalDivider(
Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp)
)
Spacer(Modifier.height(4.dp))
}
}
}
item("bottom-divider") {
HorizontalDivider(
Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp)
)
Spacer(Modifier.height(4.dp))
}
if (dmAbleChannels.isEmpty()) {
item(key = "empty-list-state") {
Column(