mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Added disclosure groups for rooms and people.
This commit is contained in:
parent
bea929a2ae
commit
1fbdff55fc
@ -35,12 +35,20 @@ struct HomeScreenViewState: BindableState {
|
||||
var rooms: [HomeScreenRoom] = []
|
||||
var isLoadingRooms: Bool = false
|
||||
|
||||
var directRooms: [HomeScreenRoom] {
|
||||
rooms.filter { $0.isDirect }
|
||||
var firstDirectRooms: [HomeScreenRoom] {
|
||||
Array(rooms.filter { $0.isDirect }.prefix(upTo: 5))
|
||||
}
|
||||
|
||||
var nondirectRooms: [HomeScreenRoom] {
|
||||
rooms.filter { !$0.isDirect }
|
||||
var otherDirectRooms: [HomeScreenRoom] {
|
||||
Array(rooms.filter { $0.isDirect }.suffix(from: 5))
|
||||
}
|
||||
|
||||
var firstNondirectRooms: [HomeScreenRoom] {
|
||||
Array(rooms.filter { !$0.isDirect }.prefix(upTo: 5))
|
||||
}
|
||||
|
||||
var otherNondirectRooms: [HomeScreenRoom] {
|
||||
Array(rooms.filter { !$0.isDirect }.suffix(from: 5))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,15 +50,35 @@ struct HomeScreen: View {
|
||||
} else {
|
||||
List {
|
||||
Section("People") {
|
||||
ForEach(context.viewState.directRooms) { room in
|
||||
ForEach(context.viewState.firstDirectRooms) { room in
|
||||
RoomCell(room: room, context: context)
|
||||
}
|
||||
|
||||
let other = context.viewState.otherDirectRooms
|
||||
|
||||
if other.count > 0 {
|
||||
DisclosureGroup("See more") {
|
||||
ForEach(other) { room in
|
||||
RoomCell(room: room, context: context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section("Rooms") {
|
||||
ForEach(context.viewState.nondirectRooms) { room in
|
||||
ForEach(context.viewState.firstNondirectRooms) { room in
|
||||
RoomCell(room: room, context: context)
|
||||
}
|
||||
|
||||
let other = context.viewState.otherNondirectRooms
|
||||
|
||||
if other.count > 0 {
|
||||
DisclosureGroup("See more") {
|
||||
ForEach(other) { room in
|
||||
RoomCell(room: room, context: context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.headerProminence(.increased)
|
||||
|
Loading…
x
Reference in New Issue
Block a user