From bf77fb818898cd793db1274caab750cf1f189909 Mon Sep 17 00:00:00 2001 From: fmodf Date: Tue, 6 Aug 2024 18:53:22 +0200 Subject: [PATCH] wip --- .../View/Screens/ChatsListScreen.swift | 12 +----- .../View/Screens/CreateRoomScreen.swift | 37 +++++++++++++++++-- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/ConversationsClassic/View/Screens/ChatsListScreen.swift b/ConversationsClassic/View/Screens/ChatsListScreen.swift index b0d0a12..83e181d 100644 --- a/ConversationsClassic/View/Screens/ChatsListScreen.swift +++ b/ConversationsClassic/View/Screens/ChatsListScreen.swift @@ -3,8 +3,6 @@ import SwiftUI struct ChatsListScreen: View { @EnvironmentObject var store: AppStore - @State private var isShowingAddScreen = false - var body: some View { ZStack { // Background color @@ -14,7 +12,7 @@ struct ChatsListScreen: View { // Content VStack(spacing: 0) { // Header - ChatsScreenHeader(isShowingAddScreen: $isShowingAddScreen) + ChatsScreenHeader() // Chats list if !store.state.chatsState.chats.isEmpty { @@ -33,16 +31,10 @@ struct ChatsListScreen: View { SharedTabBar() } } - .sheet(isPresented: $isShowingAddScreen) { - CreateRoomScreen() - .transition(.move(edge: .bottom)) - } } } private struct ChatsScreenHeader: View { - @Binding var isShowingAddScreen: Bool - var body: some View { ZStack { // bg @@ -59,7 +51,7 @@ private struct ChatsScreenHeader: View { Image(systemName: "square.and.pencil") .foregroundColor(.Material.Elements.active) .tappablePadding(.symmetric(12)) { - isShowingAddScreen = true + // print("Create new chat") } } .padding(.horizontal, 16) diff --git a/ConversationsClassic/View/Screens/CreateRoomScreen.swift b/ConversationsClassic/View/Screens/CreateRoomScreen.swift index c7b9079..e5b0a00 100644 --- a/ConversationsClassic/View/Screens/CreateRoomScreen.swift +++ b/ConversationsClassic/View/Screens/CreateRoomScreen.swift @@ -15,12 +15,20 @@ struct CreateRoomScreen: View { // Header CreateRoomScreenHeader(presentationMode: presentationMode) - // Create room form - // CreateRoomForm() + // 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) // Tab bar Spacer() - Text("test") } } } @@ -46,9 +54,30 @@ private struct CreateRoomScreenHeader: View { } // title - Text("New") + Text("New conversation") .font(.head2) .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() + } + } +}