mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Added disclosure groups for rooms and people.
This commit is contained in:
@@ -35,12 +35,20 @@ struct HomeScreenViewState: BindableState {
|
|||||||
var rooms: [HomeScreenRoom] = []
|
var rooms: [HomeScreenRoom] = []
|
||||||
var isLoadingRooms: Bool = false
|
var isLoadingRooms: Bool = false
|
||||||
|
|
||||||
var directRooms: [HomeScreenRoom] {
|
var firstDirectRooms: [HomeScreenRoom] {
|
||||||
rooms.filter { $0.isDirect }
|
Array(rooms.filter { $0.isDirect }.prefix(upTo: 5))
|
||||||
}
|
}
|
||||||
|
|
||||||
var nondirectRooms: [HomeScreenRoom] {
|
var otherDirectRooms: [HomeScreenRoom] {
|
||||||
rooms.filter { !$0.isDirect }
|
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 {
|
} else {
|
||||||
List {
|
List {
|
||||||
Section("People") {
|
Section("People") {
|
||||||
ForEach(context.viewState.directRooms) { room in
|
ForEach(context.viewState.firstDirectRooms) { room in
|
||||||
RoomCell(room: room, context: context)
|
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") {
|
Section("Rooms") {
|
||||||
ForEach(context.viewState.nondirectRooms) { room in
|
ForEach(context.viewState.firstNondirectRooms) { room in
|
||||||
RoomCell(room: room, context: context)
|
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)
|
.headerProminence(.increased)
|
||||||
|
|||||||
Reference in New Issue
Block a user