initial desktop design

This commit is contained in:
Diogo
2024-09-05 13:36:03 +01:00
parent 366d043e72
commit 45b82f752a
2 changed files with 33 additions and 2 deletions

View File

@@ -187,14 +187,14 @@ private fun ActiveUserSection(
}
@Composable
fun UserPickerInactiveUserBadge(userInfo: UserInfo, stopped: Boolean, onClick: (user: User) -> Unit) {
fun UserPickerInactiveUserBadge(userInfo: UserInfo, stopped: Boolean, size: Int = 60, onClick: (user: User) -> Unit) {
Box {
IconButton(
onClick = { onClick(userInfo.user) },
enabled = !stopped
) {
Box {
ProfileImage(size = 60.dp, image = userInfo.user.profile.image, color = MaterialTheme.colors.secondaryVariant)
ProfileImage(size = size.dp, image = userInfo.user.profile.image, color = MaterialTheme.colors.secondaryVariant)
if (userInfo.unreadCount > 0) {
unreadBadge()
}

View File

@@ -1,8 +1,18 @@
package chat.simplex.common.views.chatlist
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.grid.*
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import chat.simplex.common.model.User
import chat.simplex.common.model.UserInfo
import chat.simplex.common.platform.ColumnWithScrollBar
import chat.simplex.common.platform.LazyColumnWithScrollBar
import chat.simplex.common.ui.theme.DEFAULT_PADDING
import chat.simplex.common.ui.theme.DEFAULT_PADDING_HALF
import chat.simplex.res.MR
import dev.icerock.moko.resources.compose.painterResource
import dev.icerock.moko.resources.compose.stringResource
@@ -14,6 +24,27 @@ actual fun UserPickerInactiveUsersSection(
onShowAllProfilesClicked: () -> Unit,
onUserClicked: (user: User) -> Unit,
) {
if (users.isNotEmpty()) {
val userRows = users.chunked(5)
val rowsToDisplay = if (userRows.count() > 2) 2 else userRows.count()
Column(Modifier.padding(horizontal = DEFAULT_PADDING).height((55.dp + DEFAULT_PADDING) * rowsToDisplay)) {
ColumnWithScrollBar(verticalArrangement = Arrangement.spacedBy(DEFAULT_PADDING)) {
userRows.forEach { row ->
Row(
horizontalArrangement = Arrangement.spacedBy(18.dp),
) {
row.forEach { u ->
UserPickerInactiveUserBadge(u, stopped, size = 55) {
onUserClicked(u.user)
}
}
}
}
}
}
}
UserPickerOptionRow(
painterResource(MR.images.ic_manage_accounts),
stringResource(MR.strings.your_chat_profiles),