UX cleanup: DM details screen (#2817)
* UX cleanup: DM details screen Reuse `MainActionsSection` for DMs too, hiding the Share CTA in that case. * Update screenshots * Fix tests --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
46b22d7db7
commit
0bbb107dea
7 changed files with 32 additions and 33 deletions
|
|
@ -49,7 +49,6 @@ import io.element.android.compound.theme.ElementTheme
|
|||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.leaveroom.api.LeaveRoomView
|
||||
import io.element.android.features.userprofile.shared.UserProfileHeaderSection
|
||||
import io.element.android.features.userprofile.shared.UserProfileMainActionsSection
|
||||
import io.element.android.features.userprofile.shared.blockuser.BlockUserDialogs
|
||||
import io.element.android.features.userprofile.shared.blockuser.BlockUserSection
|
||||
import io.element.android.libraries.architecture.coverage.ExcludeFromCoverage
|
||||
|
|
@ -153,7 +152,12 @@ fun RoomDetailsView(
|
|||
openAvatarPreview(member.getBestName(), avatarUrl)
|
||||
},
|
||||
)
|
||||
UserProfileMainActionsSection(onShareUser = ::onShareMember)
|
||||
MainActionsSection(
|
||||
state = state,
|
||||
onShareRoom = onShareRoom,
|
||||
onInvitePeople = invitePeople,
|
||||
onCall = onJoinCallClicked,
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(18.dp))
|
||||
|
|
@ -295,18 +299,21 @@ private fun MainActionsSection(
|
|||
onClick = onCall,
|
||||
)
|
||||
}
|
||||
if (state.roomType is RoomDetailsType.Room && state.canInvite) {
|
||||
if (state.roomType is RoomDetailsType.Room) {
|
||||
if (state.canInvite) {
|
||||
MainActionButton(
|
||||
title = stringResource(CommonStrings.action_invite),
|
||||
imageVector = CompoundIcons.UserAdd(),
|
||||
onClick = onInvitePeople,
|
||||
)
|
||||
}
|
||||
// Share CTA should be hidden for DMs
|
||||
MainActionButton(
|
||||
title = stringResource(CommonStrings.action_invite),
|
||||
imageVector = CompoundIcons.UserAdd(),
|
||||
onClick = onInvitePeople,
|
||||
title = stringResource(CommonStrings.action_share),
|
||||
imageVector = CompoundIcons.ShareAndroid(),
|
||||
onClick = onShareRoom
|
||||
)
|
||||
}
|
||||
MainActionButton(
|
||||
title = stringResource(CommonStrings.action_share),
|
||||
imageVector = CompoundIcons.ShareAndroid(),
|
||||
onClick = onShareRoom
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,19 +66,6 @@ class RoomDetailsViewTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `click on share member invokes expected callback`() {
|
||||
val state = aDmRoomDetailsState()
|
||||
val roomMember = (state.roomType as RoomDetailsType.Dm).roomMember
|
||||
ensureCalledOnceWithParam(roomMember) { callback ->
|
||||
rule.setRoomDetailView(
|
||||
state = aDmRoomDetailsState(),
|
||||
onShareMember = callback,
|
||||
)
|
||||
rule.clickOn(CommonStrings.action_share)
|
||||
}
|
||||
}
|
||||
|
||||
@Config(qualifiers = "h1024dp")
|
||||
@Test
|
||||
fun `click on room members invokes expected callback`() {
|
||||
|
|
|
|||
|
|
@ -19,16 +19,21 @@ package io.element.android.features.userprofile.shared
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.libraries.designsystem.components.button.MainActionButton
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
@Composable
|
||||
fun UserProfileMainActionsSection(onShareUser: () -> Unit, modifier: Modifier = Modifier) {
|
||||
Row(modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
|
||||
Row(
|
||||
modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
||||
horizontalArrangement = Arrangement.SpaceEvenly,
|
||||
) {
|
||||
MainActionButton(
|
||||
title = stringResource(CommonStrings.action_share),
|
||||
imageVector = CompoundIcons.ShareAndroid(),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:92e67efa400e387c6eaab1933b763d01a711030ec582c9bb01d6b75f925db660
|
||||
size 42570
|
||||
oid sha256:0e1a3a63380ed457edaf6c5e992238647724e1f6e64e0d0693b279b7e93c8be9
|
||||
size 43338
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:92e67efa400e387c6eaab1933b763d01a711030ec582c9bb01d6b75f925db660
|
||||
size 42570
|
||||
oid sha256:0e1a3a63380ed457edaf6c5e992238647724e1f6e64e0d0693b279b7e93c8be9
|
||||
size 43338
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:883e53d8ad2f6da6e3002274d5d808081e89242b43ec398d1366e986b7329d71
|
||||
size 43849
|
||||
oid sha256:6aacd02b8bc6b9cd63bfd7e49e2f1feacdee4290495905246b81d29622f1ef6b
|
||||
size 44611
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:883e53d8ad2f6da6e3002274d5d808081e89242b43ec398d1366e986b7329d71
|
||||
size 43849
|
||||
oid sha256:6aacd02b8bc6b9cd63bfd7e49e2f1feacdee4290495905246b81d29622f1ef6b
|
||||
size 44611
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue