This commit is contained in:
fmodf 2024-08-06 18:53:22 +02:00
parent 6006275690
commit bf77fb8188
2 changed files with 35 additions and 14 deletions

View file

@ -3,8 +3,6 @@ import SwiftUI
struct ChatsListScreen: View { struct ChatsListScreen: View {
@EnvironmentObject var store: AppStore @EnvironmentObject var store: AppStore
@State private var isShowingAddScreen = false
var body: some View { var body: some View {
ZStack { ZStack {
// Background color // Background color
@ -14,7 +12,7 @@ struct ChatsListScreen: View {
// Content // Content
VStack(spacing: 0) { VStack(spacing: 0) {
// Header // Header
ChatsScreenHeader(isShowingAddScreen: $isShowingAddScreen) ChatsScreenHeader()
// Chats list // Chats list
if !store.state.chatsState.chats.isEmpty { if !store.state.chatsState.chats.isEmpty {
@ -33,16 +31,10 @@ struct ChatsListScreen: View {
SharedTabBar() SharedTabBar()
} }
} }
.sheet(isPresented: $isShowingAddScreen) {
CreateRoomScreen()
.transition(.move(edge: .bottom))
}
} }
} }
private struct ChatsScreenHeader: View { private struct ChatsScreenHeader: View {
@Binding var isShowingAddScreen: Bool
var body: some View { var body: some View {
ZStack { ZStack {
// bg // bg
@ -59,7 +51,7 @@ private struct ChatsScreenHeader: View {
Image(systemName: "square.and.pencil") Image(systemName: "square.and.pencil")
.foregroundColor(.Material.Elements.active) .foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(12)) { .tappablePadding(.symmetric(12)) {
isShowingAddScreen = true // print("Create new chat")
} }
} }
.padding(.horizontal, 16) .padding(.horizontal, 16)

View file

@ -15,12 +15,20 @@ struct CreateRoomScreen: View {
// Header // Header
CreateRoomScreenHeader(presentationMode: presentationMode) CreateRoomScreenHeader(presentationMode: presentationMode)
// Create room form // List with buttons
// CreateRoomForm() 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)
// Tab bar // Tab bar
Spacer() Spacer()
Text("test")
} }
} }
} }
@ -46,9 +54,30 @@ private struct CreateRoomScreenHeader: View {
} }
// title // title
Text("New") Text("New conversation")
.font(.head2) .font(.head2)
.foregroundColor(Color.Material.Text.main) .foregroundColor(Color.Material.Text.main)
} }
} }
} }
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()
}
}
}