diff --git a/ConversationsClassic/Resources/Strings/Localizable.strings b/ConversationsClassic/Resources/Strings/Localizable.strings index a5fefd7..cc5e6b2 100644 --- a/ConversationsClassic/Resources/Strings/Localizable.strings +++ b/ConversationsClassic/Resources/Strings/Localizable.strings @@ -43,6 +43,11 @@ "Chat.title" = "Chat"; "Chat.textfieldPrompt" = "Type a message"; +"Chats.Create.Main.title" = "Create"; +"Chats.Create.Main.createGroup" = "Create puplic group"; +"Chats.Create.Main.createPrivateGroup" = "Create private group"; +"Chats.Create.Main.findGroup" = "Find public group"; + // MARK: Accounts add screen "Accounts.Add.or" = "or"; "Accounts.Add.Exist.title" = "Add existing\naccount"; diff --git a/ConversationsClassic/View/Screens/Chats/ChatsCreateMainScreen.swift b/ConversationsClassic/View/Screens/Chats/ChatsCreateMainScreen.swift new file mode 100644 index 0000000..8509dca --- /dev/null +++ b/ConversationsClassic/View/Screens/Chats/ChatsCreateMainScreen.swift @@ -0,0 +1,136 @@ +import SwiftUI + +struct ChatsCreateMainScreen: View { + @Binding var isPresented: Bool + + var body: some View { + ZStack { + // Background color + Color.Material.Background.light + .ignoresSafeArea() + + // Content + VStack(spacing: 0) { + // Header + SharedNavigationBar( + leftButton: .init( + image: Image(systemName: "xmark"), + action: { + isPresented = false + } + ), + centerText: .init(text: L10n.Chats.Create.Main.title) + ) + + // List + List { + CreateRoomRowButton( + title: L10n.Chats.Create.Main.createGroup, + image: "person.2.square.stack", + action: {} + ) + CreateRoomRowButton( + title: L10n.Chats.Create.Main.createPrivateGroup, + image: "person.2.square.stack", + action: {} + ) + CreateRoomRowButton( + title: L10n.Chats.Create.Main.findGroup, + image: "person.2.square.stack", + action: {} + ) + } + .listStyle(.plain) + + Spacer() + } + } + } +} + +private struct CreateRoomRowButton: View { + var title: String + var image: String + var action: () -> Void + + var body: some View { + HStack(spacing: 16) { + Image(systemName: image) + .font(.head2) + .foregroundColor(.Material.Elements.active) + .padding(.leading, 16) + Text(title) + .font(.body1) + .foregroundColor(.Material.Text.main) + Spacer() + } + .sharedListRow() + .onTapGesture { + action() + } + } +} + +// import SwiftUI +// +// struct CreateConversationMainScreen: View { +// @EnvironmentObject var store: AppStore +// +// var body: some View { +// ZStack { +// // Background color +// Color.Material.Background.light +// .ignoresSafeArea() +// +// // Content +// VStack(spacing: 0) { +// // Header +// CreateConversationHeader() +// +// // 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() +// } +// } +// } +// } +// +// private struct CreateConversationHeader: View { +// @EnvironmentObject var store: AppStore +// +// var body: some View { +// ZStack { +// // bg +// Color.Material.Background.dark +// .ignoresSafeArea() +// +// HStack(spacing: 0) { +// Image(systemName: "arrow.left") +// .foregroundColor(.Material.Elements.active) +// .padding(.leading, 16) +// .tappablePadding(.symmetric(12)) { +// store.dispatch(.changeFlow(store.state.previousFlow)) +// } +// Spacer() +// } +// +// // title +// Text("New conversation") +// .font(.head2) +// .foregroundColor(Color.Material.Text.main) +// } +// } +// } +// diff --git a/ConversationsClassic/View/Screens/Chats/ChatsListScreen.swift b/ConversationsClassic/View/Screens/Chats/ChatsListScreen.swift index 06d3870..9a8f079 100644 --- a/ConversationsClassic/View/Screens/Chats/ChatsListScreen.swift +++ b/ConversationsClassic/View/Screens/Chats/ChatsListScreen.swift @@ -3,6 +3,8 @@ import SwiftUI struct ChatsListScreen: View { @EnvironmentObject var store: AppStore + @State private var isCretePanelPresented = false + var body: some View { ZStack { // Background color @@ -17,7 +19,7 @@ struct ChatsListScreen: View { rightButton: .init( image: Image(systemName: "square.and.pencil"), action: { - print("Create chat") + isCretePanelPresented = true } ) ) @@ -39,6 +41,9 @@ struct ChatsListScreen: View { SharedTabBar() } } + .fullScreenCover(isPresented: $isCretePanelPresented) { + ChatsCreateMainScreen(isPresented: $isCretePanelPresented) + } } } diff --git a/ConversationsClassic/View/Screens/Chats/CreateConversationMainScreen.swift b/ConversationsClassic/View/Screens/Chats/CreateConversationMainScreen.swift deleted file mode 100644 index 8a8bf03..0000000 --- a/ConversationsClassic/View/Screens/Chats/CreateConversationMainScreen.swift +++ /dev/null @@ -1,83 +0,0 @@ -import SwiftUI - -struct CreateConversationMainScreen: View { - @EnvironmentObject var store: AppStore - - var body: some View { - ZStack { - // Background color - Color.Material.Background.light - .ignoresSafeArea() - - // Content - VStack(spacing: 0) { - // Header - CreateConversationHeader() - - // 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() - } - } - } -} - -private struct CreateConversationHeader: View { - @EnvironmentObject var store: AppStore - - var body: some View { - ZStack { - // bg - Color.Material.Background.dark - .ignoresSafeArea() - - HStack(spacing: 0) { - Image(systemName: "arrow.left") - .foregroundColor(.Material.Elements.active) - .padding(.leading, 16) - .tappablePadding(.symmetric(12)) { - store.dispatch(.changeFlow(store.state.previousFlow)) - } - Spacer() - } - - // title - 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() - } - } -}