commit c4acebdfee89867ba1d206a62eb48a48ed5f441a
parent b23203825a3c98144f55de4cbce097d1105c18ef
Author: Suhail Saqan <suhail.saqan@gmail.com>
Date: Tue, 27 Dec 2022 23:53:35 -0600
Added paste and delete buttons to add relay field
Closes: #168
Changelog-Added: Added paste and delete buttons to add relay field
Diffstat:
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/damus/Views/AddRelayView.swift b/damus/Views/AddRelayView.swift
@@ -17,9 +17,31 @@ struct AddRelayView: View {
VStack(alignment: .leading) {
Form {
Section("Add Relay") {
- TextField("wss://some.relay.com", text: $relay)
- .autocorrectionDisabled(true)
- .textInputAutocapitalization(.never)
+ ZStack(alignment: .leading) {
+ HStack{
+ TextField("wss://some.relay.com", 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
+ }
+ }
+ }
}
}