2024-08-06 12:14:00 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct CreateRoomScreen: View {
|
|
|
|
@EnvironmentObject var store: AppStore
|
|
|
|
@Environment(\.presentationMode) var presentationMode
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
ZStack {
|
|
|
|
// Background color
|
|
|
|
Color.Material.Background.light
|
|
|
|
.ignoresSafeArea()
|
|
|
|
|
|
|
|
// Content
|
|
|
|
VStack(spacing: 0) {
|
|
|
|
// Header
|
|
|
|
CreateRoomScreenHeader(presentationMode: presentationMode)
|
|
|
|
|
2024-08-06 16:53:22 +00:00
|
|
|
// List with buttons
|
|
|
|
List {
|
|
|
|
CreateRoomRowButton(title: "Create group chat", image: "person.2.square.stack") {
|
|
|
|
print("Create chat")
|
|
|
|
}
|
|
|
|
CreateRoomRowButton(title: "Find public chats", image: "magnifyingglass") {
|
|
|
|
print("Create group chat")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.listStyle(.plain)
|
|
|
|
.background(Color.Material.Background.light)
|
2024-08-06 12:14:00 +00:00
|
|
|
|
|
|
|
// Tab bar
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private struct CreateRoomScreenHeader: View {
|
|
|
|
@Binding var presentationMode: PresentationMode
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
ZStack {
|
|
|
|
// bg
|
|
|
|
Color.Material.Background.dark
|
|
|
|
.ignoresSafeArea()
|
|
|
|
|
|
|
|
HStack(spacing: 0) {
|
|
|
|
Image(systemName: "xmark")
|
|
|
|
.foregroundColor(.Material.Elements.active)
|
|
|
|
.padding(.trailing, 16)
|
|
|
|
.tappablePadding(.symmetric(12)) {
|
|
|
|
presentationMode.dismiss()
|
|
|
|
}
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|