Avoid rendering roomId on screen.
This commit is contained in:
parent
871265117a
commit
1ed593926f
5 changed files with 28 additions and 13 deletions
|
|
@ -211,7 +211,7 @@ internal fun ContentState.toInviteData(): InviteData? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is ContentState.Loaded -> InviteData(
|
is ContentState.Loaded -> InviteData(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
roomName = computedTitle,
|
roomName = name ?: roomId.value,
|
||||||
isDirect = isDirect
|
isDirect = isDirect
|
||||||
)
|
)
|
||||||
else -> null
|
else -> null
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,6 @@ sealed interface ContentState {
|
||||||
val roomAvatarUrl: String?,
|
val roomAvatarUrl: String?,
|
||||||
val joinAuthorisationStatus: JoinAuthorisationStatus,
|
val joinAuthorisationStatus: JoinAuthorisationStatus,
|
||||||
) : ContentState {
|
) : ContentState {
|
||||||
val computedTitle = name ?: roomId.value
|
|
||||||
|
|
||||||
val computedSubtitle = when {
|
|
||||||
alias != null -> alias.value
|
|
||||||
name == null -> ""
|
|
||||||
else -> roomId.value
|
|
||||||
}
|
|
||||||
|
|
||||||
val showMemberCount = numberOfMembers != null
|
val showMemberCount = numberOfMembers != null
|
||||||
|
|
||||||
fun avatarData(size: AvatarSize): AvatarData {
|
fun avatarData(size: AvatarSize): AvatarData {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
@ -177,13 +178,28 @@ private fun JoinRoomContent(
|
||||||
RoomPreviewOrganism(
|
RoomPreviewOrganism(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
avatar = {
|
avatar = {
|
||||||
Avatar(contentState.avatarData(AvatarSize.RoomHeader))
|
if (contentState.name == null && contentState.roomAvatarUrl == null) {
|
||||||
|
PlaceholderAtom(width = AvatarSize.RoomHeader.dp, height = AvatarSize.RoomHeader.dp)
|
||||||
|
} else {
|
||||||
|
Avatar(contentState.avatarData(AvatarSize.RoomHeader))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
RoomPreviewTitleAtom(contentState.computedTitle)
|
if (contentState.name != null) {
|
||||||
|
RoomPreviewTitleAtom(
|
||||||
|
title = contentState.name,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
RoomPreviewTitleAtom(
|
||||||
|
title = stringResource(id = CommonStrings.common_no_room_name),
|
||||||
|
fontStyle = FontStyle.Italic
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
subtitle = {
|
subtitle = {
|
||||||
RoomPreviewSubtitleAtom(contentState.computedSubtitle)
|
if (contentState.alias != null) {
|
||||||
|
RoomPreviewSubtitleAtom(contentState.alias.value)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
description = {
|
description = {
|
||||||
Column(
|
Column(
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,23 @@ package io.element.android.libraries.designsystem.atomic.atoms
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import io.element.android.compound.theme.ElementTheme
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RoomPreviewTitleAtom(title: String, modifier: Modifier = Modifier) {
|
fun RoomPreviewTitleAtom(
|
||||||
|
title: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
fontStyle: FontStyle? = null,
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
text = title,
|
text = title,
|
||||||
style = ElementTheme.typography.fontHeadingMdBold,
|
style = ElementTheme.typography.fontHeadingMdBold,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
|
fontStyle = fontStyle,
|
||||||
color = ElementTheme.colors.textPrimary,
|
color = ElementTheme.colors.textPrimary,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@
|
||||||
<string name="common_modern">"Modern"</string>
|
<string name="common_modern">"Modern"</string>
|
||||||
<string name="common_mute">"Mute"</string>
|
<string name="common_mute">"Mute"</string>
|
||||||
<string name="common_no_results">"No results"</string>
|
<string name="common_no_results">"No results"</string>
|
||||||
|
<string name="common_no_room_name">"No room name"</string>
|
||||||
<string name="common_offline">"Offline"</string>
|
<string name="common_offline">"Offline"</string>
|
||||||
<string name="common_or">"or"</string>
|
<string name="common_or">"or"</string>
|
||||||
<string name="common_password">"Password"</string>
|
<string name="common_password">"Password"</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue