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:
committed by
GitHub
parent
b524645b89
commit
17f5b0fe77
@@ -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(),
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user