conversations-classic-ios/ConversationsClassic/View/Screens/Create/CreateConversationMainScreen.swift

84 lines
2.2 KiB
Swift
Raw Normal View History

2024-08-06 12:14:00 +00:00
import SwiftUI
2024-08-07 08:36:33 +00:00
struct CreateConversationMainScreen: View {
2024-08-06 12:14:00 +00:00
@EnvironmentObject var store: AppStore
var body: some View {
ZStack {
// Background color
Color.Material.Background.light
.ignoresSafeArea()
// Content
VStack(spacing: 0) {
// Header
2024-08-07 08:36:33 +00:00
CreateConversationHeader()
2024-08-06 12:14:00 +00:00
2024-08-07 08:36:33 +00:00
// Chats list
// if !store.state.chatsState.chats.isEmpty {
// List {
// ForEach(store.state.chatsState.chats) { chat in
// ChatsRow(chat: chat)
// }
// }
// .listStyle(.plain)
// .background(Color.Material.Background.light)
// } else {
// Spacer()
// }
//
// // Tab bar
// SharedTabBar()
2024-08-06 12:14:00 +00:00
}
}
}
}
2024-08-07 08:36:33 +00:00
private struct CreateConversationHeader: View {
@EnvironmentObject var store: AppStore
2024-08-06 12:14:00 +00:00
var body: some View {
ZStack {
// bg
Color.Material.Background.dark
.ignoresSafeArea()
HStack(spacing: 0) {
2024-08-07 08:36:33 +00:00
Image(systemName: "arrow.left")
2024-08-06 12:14:00 +00:00
.foregroundColor(.Material.Elements.active)
2024-08-07 08:36:33 +00:00
.padding(.leading, 16)
2024-08-06 12:14:00 +00:00
.tappablePadding(.symmetric(12)) {
2024-08-07 08:36:33 +00:00
store.dispatch(.changeFlow(store.state.previousFlow))
2024-08-06 12:14:00 +00:00
}
Spacer()
}
// title
2024-08-06 16:53:22 +00:00
Text("New conversation")
2024-08-06 12:14:00 +00:00
.font(.head2)
.foregroundColor(Color.Material.Text.main)
}
}
}
2024-08-06 16:53:22 +00:00
private struct CreateRoomRowButton: View {
var title: String
var image: String
var action: () -> Void
var body: some View {
HStack(spacing: 16) {
Image(systemName: image)
.foregroundColor(.Material.Elements.active)
Text(title)
.font(.body)
.foregroundColor(.Material.Text.main)
Spacer()
}
.sharedListRow()
.onTapGesture {
action()
}
}
}