From e996d5703b94226a7e6d94e803b5615e806041b8 Mon Sep 17 00:00:00 2001 From: ericholguin Date: Thu, 23 Mar 2023 23:53:35 -0600 Subject: [PATCH] buttons moved to relay config view to be outside of form --- damus/Views/AddRelayView.swift | 71 ++++++++++------------------------ 1 file changed, 20 insertions(+), 51 deletions(-) diff --git a/damus/Views/AddRelayView.swift b/damus/Views/AddRelayView.swift index cb9b5299..832018b4 100644 --- a/damus/Views/AddRelayView.swift +++ b/damus/Views/AddRelayView.swift @@ -8,72 +8,41 @@ import SwiftUI struct AddRelayView: View { - @Binding var show_add_relay: Bool @Binding var relay: String - let action: (String?) -> Void - var body: some View { - VStack(alignment: .leading) { - Form { - Section(NSLocalizedString("Add Relay", comment: "Label for section for adding a relay server.")) { - ZStack(alignment: .leading) { - HStack{ - TextField(NSLocalizedString("wss://some.relay.com", comment: "Placeholder example for relay server address."), text: $relay) - .padding(2) - .padding(.leading, 25) - .autocorrectionDisabled(true) - .textInputAutocapitalization(.never) - - Label("", systemImage: "xmark.circle.fill") - .foregroundColor(.blue) - .padding(.trailing, -25.0) - .opacity((relay == "") ? 0.0 : 1.0) - .onTapGesture { - self.relay = "" - } - } - - Label("", systemImage: "doc.on.clipboard") - .padding(.leading, -10) - .onTapGesture { - if let pastedrelay = UIPasteboard.general.string { - self.relay = pastedrelay - } - } + ZStack(alignment: .leading) { + HStack{ + TextField(NSLocalizedString("wss://some.relay.com", comment: "Placeholder example for relay server address."), text: $relay) + .padding(2) + .padding(.leading, 25) + .autocorrectionDisabled(true) + .textInputAutocapitalization(.never) + + Label("", systemImage: "xmark.circle.fill") + .foregroundColor(.accentColor) + .padding(.trailing, -25.0) + .opacity((relay == "") ? 0.0 : 1.0) + .onTapGesture { + self.relay = "" } - } } - VStack { - HStack { - Button(NSLocalizedString("Cancel", comment: "Button to cancel out of view adding user inputted relay.")) { - show_add_relay = false - action(nil) - } - .contentShape(Rectangle()) - - Spacer() - - Button(NSLocalizedString("Add", comment: "Button to confirm adding user inputted relay.")) { - show_add_relay = false - action(relay) - relay = "" - } - .buttonStyle(.borderedProminent) - .contentShape(Rectangle()) + Label("", systemImage: "doc.on.clipboard") + .padding(.leading, -10) + .onTapGesture { + if let pastedrelay = UIPasteboard.general.string { + self.relay = pastedrelay } - .padding() } } } } struct AddRelayView_Previews: PreviewProvider { - @State static var show: Bool = true @State static var relay: String = "" static var previews: some View { - AddRelayView(show_add_relay: $show, relay: $relay, action: {_ in }) + AddRelayView(relay: $relay) } }