feature (space) : add string "No space name"

This commit is contained in:
ganfra
2025-09-19 17:42:47 +02:00
parent 5cda6730c4
commit dd13605085
4 changed files with 17 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ private fun SpaceAvatarAndNameRow(
.semantics {
heading()
},
text = name ?: stringResource(CommonStrings.common_no_room_name),
text = name ?: stringResource(CommonStrings.common_no_space_name),
style = ElementTheme.typography.fontBodyLgMedium,
fontStyle = FontStyle.Italic.takeIf { name == null },
maxLines = 1,

View File

@@ -10,6 +10,8 @@ package io.element.android.libraries.matrix.ui.components
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.text.font.FontStyle
import androidx.compose.ui.tooling.preview.datasource.LoremIpsum
import androidx.compose.ui.unit.dp
import io.element.android.libraries.designsystem.atomic.atoms.RoomPreviewDescriptionAtom
@@ -24,6 +26,7 @@ import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.matrix.api.room.join.JoinRule
import io.element.android.libraries.matrix.api.user.MatrixUser
import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
@@ -51,8 +54,13 @@ fun SpaceHeaderView(
)
},
title = {
name?.let {
if (name != null) {
RoomPreviewTitleAtom(title = name)
} else {
RoomPreviewTitleAtom(
title = stringResource(id = CommonStrings.common_no_space_name),
fontStyle = FontStyle.Italic
)
}
},
subtitle = {
@@ -63,10 +71,10 @@ fun SpaceHeaderView(
)
}
},
description = if (topic != null) {
{ RoomPreviewDescriptionAtom(description = topic, maxLines = topicMaxLines) }
} else {
description = if (topic.isNullOrBlank()) {
null
} else {
{ RoomPreviewDescriptionAtom(description = topic, maxLines = topicMaxLines) }
},
memberCount = {
SpaceMembersView(

View File

@@ -69,6 +69,7 @@ fun SpaceRoomItemView(
onLongClick = onLongClick,
) {
NameAndIndicatorRow(
isSpace = spaceRoom.isSpace,
name = spaceRoom.name,
showIndicator = showUnreadIndicator
)
@@ -130,6 +131,7 @@ private fun SubtitleRow(
@Composable
private fun NameAndIndicatorRow(
isSpace: Boolean,
name: String?,
showIndicator: Boolean,
modifier: Modifier = Modifier,
@@ -142,7 +144,7 @@ private fun NameAndIndicatorRow(
Text(
modifier = Modifier.weight(1f),
style = ElementTheme.typography.fontBodyLgMedium,
text = name ?: stringResource(id = CommonStrings.common_no_room_name),
text = name ?: stringResource(id = if(isSpace) CommonStrings.common_no_space_name else CommonStrings.common_no_room_name),
fontStyle = FontStyle.Italic.takeIf { name == null },
color = ElementTheme.colors.textPrimary,
maxLines = 1,

View File

@@ -246,6 +246,7 @@ Reason: %1$s."</string>
<string name="common_name_and_id">"%1$s (%2$s)"</string>
<string name="common_no_results">"No results"</string>
<string name="common_no_room_name">"No room name"</string>
<string name="common_no_space_name">"No space name"</string>
<string name="common_not_encrypted">"Not encrypted"</string>
<string name="common_offline">"Offline"</string>
<string name="common_open_source_licenses">"Open source licenses"</string>