mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Add support for space rooms on the JoinRoomScreen. (#4582)
* Add support for space rooms to JoinRoomScreenModel. * Make a single wrapper type for JoinRoomScreen previews to simplify instantiation. * Add previews for JoinRoomScreen for spaces.
This commit is contained in:
@@ -29,7 +29,7 @@ struct SpaceHeaderView: View {
|
||||
|
||||
spaceDetails
|
||||
|
||||
SpaceHeaderMembersView(heroes: spaceRoomProxy.heroes,
|
||||
JoinedMembersBadgeView(heroes: spaceRoomProxy.heroes,
|
||||
joinedCount: spaceRoomProxy.joinedMembersCount,
|
||||
mediaProvider: mediaProvider)
|
||||
}
|
||||
@@ -92,64 +92,6 @@ struct SpaceHeaderView: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct SpaceHeaderMembersView: View {
|
||||
let heroes: [UserProfileProxy]
|
||||
let joinedCount: Int
|
||||
|
||||
let mediaProvider: MediaProviderProtocol?
|
||||
|
||||
var body: some View {
|
||||
if heroes.isEmpty {
|
||||
Label(title: title) {
|
||||
CompoundIcon(\.userProfile, size: .small, relativeTo: .compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
}
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
.labelStyle(.custom(spacing: 4))
|
||||
.padding(.trailing, 8)
|
||||
.background(.compound.bgSubtleSecondary, in: Capsule())
|
||||
} else {
|
||||
Label(title: title) {
|
||||
heroesFacePile
|
||||
}
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
.labelStyle(.custom(spacing: 6))
|
||||
}
|
||||
}
|
||||
|
||||
func title() -> Text {
|
||||
Text("\(joinedCount)")
|
||||
}
|
||||
|
||||
var heroesFacePile: some View {
|
||||
HStack(spacing: -8) {
|
||||
ForEach(heroes.prefix(3).reversed()) { hero in
|
||||
LoadableAvatarImage(url: hero.avatarURL,
|
||||
name: hero.displayName,
|
||||
contentID: hero.userID,
|
||||
avatarSize: .user(on: .spaceHeader),
|
||||
mediaProvider: mediaProvider)
|
||||
.mask {
|
||||
Circle()
|
||||
.fill(Color.white)
|
||||
.overlay {
|
||||
if hero != heroes.first {
|
||||
Circle()
|
||||
.inset(by: -2)
|
||||
.fill(Color.black)
|
||||
.offset(x: 12)
|
||||
}
|
||||
}
|
||||
.compositingGroup()
|
||||
.luminanceToAlpha()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
struct SpaceHeaderView_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
Reference in New Issue
Block a user