57 lines
1.7 KiB
Swift
57 lines
1.7 KiB
Swift
import SwiftUI
|
|
|
|
struct ChatsListScreen: View {
|
|
@EnvironmentObject var clientsStore: ClientsStore
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
// Background color
|
|
Color.Material.Background.light
|
|
.ignoresSafeArea()
|
|
|
|
// Content
|
|
VStack(spacing: 0) {
|
|
// Header
|
|
SharedNavigationBar(
|
|
centerText: .init(text: L10n.ChatsList.title),
|
|
rightButton: .init(
|
|
image: Image(systemName: "square.and.pencil"),
|
|
action: {
|
|
// isCretePanelPresented = true
|
|
}
|
|
)
|
|
)
|
|
|
|
// Chats list
|
|
if !clientsStore.actualChats.isEmpty {
|
|
List {
|
|
ForEach(clientsStore.actualChats) { chat in
|
|
ChatsRow(chat: chat)
|
|
}
|
|
}
|
|
.listStyle(.plain)
|
|
.background(Color.Material.Background.light)
|
|
} else {
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
// .fullScreenCover(isPresented: $isCretePanelPresented) {
|
|
// ChatsCreateMainScreen(isPresented: $isCretePanelPresented)
|
|
// }
|
|
}
|
|
}
|
|
|
|
private struct ChatsRow: View {
|
|
// @EnvironmentObject var store: AppStore
|
|
|
|
var chat: Chat
|
|
|
|
var body: some View {
|
|
SharedListRow(iconType: .charCircle(chat.participant), text: chat.participant)
|
|
.onTapGesture {
|
|
// store.dispatch(.chatsAction(.startChat(accountJid: chat.account, participantJid: chat.participant)))
|
|
}
|
|
}
|
|
}
|