More Space tweaks. (#5086)

* Centre align the title in the space filter cells.

* Update SpaceRoomCell and SpaceHeaderView with consistent content.
This commit is contained in:
Doug
2026-02-10 13:44:04 +00:00
committed by GitHub
parent cf3920b8e5
commit b89a9dc794
121 changed files with 279 additions and 283 deletions

View File

@@ -61,27 +61,36 @@ struct ChatsSpaceFilterCell: View {
}
private var content: some View {
HStack(spacing: 16) {
ZStack {
// Hidden text to maintain consistent height.
placeholderContent.hidden()
VStack(alignment: .leading, spacing: 2) {
Text(filter.room.name)
.font(.compound.bodyLG)
.foregroundColor(.compound.textPrimary)
.lineLimit(1)
ZStack {
// Hidden text to maintain consistent height.
Text("")
.hidden()
if let alias = filter.room.canonicalAlias {
Text(alias)
.font(.compound.bodyMD)
.foregroundColor(.compound.textSecondary)
.lineLimit(1)
}
if let alias = filter.room.canonicalAlias {
Text(alias)
.font(.compound.bodyMD)
.foregroundColor(.compound.textSecondary)
.lineLimit(1)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
private var placeholderContent: some View {
VStack(alignment: .leading, spacing: 2) {
Text(filter.room.name)
.font(.compound.bodyLG)
.lineLimit(1)
Text(" ")
.font(.compound.bodyMD)
.lineLimit(1)
}
}
}

View File

@@ -76,14 +76,15 @@ struct SpaceHeaderView: View {
CompoundIcon(spaceDetailsVisibilityIcon, size: .small, relativeTo: .compound.bodyLG)
.foregroundStyle(.compound.iconTertiary)
}
.labelStyle(.custom(spacing: 4))
}
private var spaceDetailsVisibilityTitle: String {
switch spaceServiceRoom.visibility {
case .public: L10n.commonPublicSpace
case .private: L10n.commonPrivateSpace
case .restricted: L10n.commonSharedSpace
case .none: L10n.commonPrivateSpace
case .public: L10n.commonPublic
case .private: L10n.commonPrivate
case .restricted: L10n.commonSpaceMembers
case .none: L10n.commonPrivate
}
}

View File

@@ -33,36 +33,24 @@ struct SpaceRoomCell: View {
isSelected && !isEditModeActive
}
private var subtitle: String {
if spaceServiceRoom.isSpace {
switch spaceServiceRoom.visibility {
case .public: L10n.commonPublicSpace
case .private: L10n.commonPrivateSpace
case .restricted: L10n.commonSharedSpace
case .none: L10n.commonPrivateSpace
}
} else {
L10n.commonMemberCount(spaceServiceRoom.joinedMembersCount)
private var visibilityTitle: String {
switch spaceServiceRoom.visibility {
case .public: L10n.commonPublic
case .private: L10n.commonPrivate
case .restricted: L10n.commonSpaceMembers
case .none: L10n.commonPrivate
}
}
var visibilityIcon: KeyPath<CompoundIcons, Image>? {
var visibilityIcon: KeyPath<CompoundIcons, Image> {
switch spaceServiceRoom.visibility {
case .public: \.public
case .private: \.lockSolid
case .restricted: nil
case .restricted: \.spaceSolid
case .none: \.lockSolid
}
}
private var details: String {
if spaceServiceRoom.isSpace {
L10n.commonMemberCount(spaceServiceRoom.joinedMembersCount)
} else {
spaceServiceRoom.topic ?? " " // Use a single space to reserve a consistent amount of space.
}
}
var body: some View {
Button {
action(.select(spaceServiceRoom))
@@ -121,9 +109,9 @@ struct SpaceRoomCell: View {
.foregroundColor(.compound.textPrimary)
.lineLimit(1)
subtitleLabel
visibilityLabel
Text(details)
Text(L10n.commonMemberCount(spaceServiceRoom.joinedMembersCount))
.font(.compound.bodyMD)
.foregroundColor(.compound.textSecondary)
.lineLimit(1)
@@ -134,19 +122,17 @@ struct SpaceRoomCell: View {
}
}
private var subtitleLabel: some View {
private var visibilityLabel: some View {
Label {
Text(subtitle)
Text(visibilityTitle)
.font(.compound.bodyMD)
.foregroundStyle(.compound.textSecondary)
.lineLimit(1)
} icon: {
if let visibilityIcon {
CompoundIcon(visibilityIcon,
size: .xSmall,
relativeTo: .compound.bodyMD)
.foregroundStyle(.compound.iconTertiary)
}
CompoundIcon(visibilityIcon,
size: .xSmall,
relativeTo: .compound.bodyMD)
.foregroundStyle(.compound.iconTertiary)
}
.labelStyle(.custom(spacing: 4))
}

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01799147849a30494e90271d86b44705a8e4722c59cdfd753ca8fa18f936e954
size 169626
oid sha256:7b79889036386c97b4f8c6b2de7a9d74514415af80374842d9d2b70fd18ffd20
size 171172

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2011d476a129fc50c403584bd172b659c04d9c00c26c82bedc65724a500086a9
size 177496
oid sha256:f3cdc6b10b928460ed80fd7d4a2f84768bca05dba93a160ba6a87e5f66328194
size 178969

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b7de77332d26d6673a467ac6a3afe580c562b931c770196227f6c672adf3057
size 115333
oid sha256:c8ce158594dc2ae780d86bd19739ca41c5369c667dd80c90610bc569dbb642ac
size 116757

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c47081a2ec8775c5e8b4440bddf970b90dda683811f71a172bc0201012c2fca9
size 121941
oid sha256:3b6392fa2505beef48457bd2d9730c52405bc33ad8f51aa9f211cbd5861fa566
size 123505

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ccc9754e57a5a9af82678a76ef51a95ea4d3392717ac5367bbb2876dd2c857a
size 136425
oid sha256:893d004b83d64f2cc06e2195e7f716ecde611f997943fe825364355b6046dc0d
size 138102

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ebffe641e6e987fd653aea3190ad74d22cd8542fde4877bdb8a8faed971e223
size 144094
oid sha256:80348f2913347ea8f5ef1d0502a1ad971a9f2b9024f4033784aedaef63f78dc0
size 145605

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:40c404bbb3fb95424054d740d653e388ea98f4617b76cc16cd83cc1a5ac8301f
size 83505
oid sha256:69f2bbbf727a7ba9a1401c621ea7854cd2130ec0e9b13bcbdbefb76d22b027b0
size 85036

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:caef2d638fc47f4673a14b7bfb89031ac0b4c92774a1772e61f58e28cdb7516e
size 90167
oid sha256:a7f204968906a6e6c42e4441f3983ec1de38f6a0339d7d556b98ee5901f368f0
size 91749

Some files were not shown because too many files have changed in this diff Show More