edit relays

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-06-09 13:47:25 -07:00
parent e104de6431
commit 6de7d7ae58
7 changed files with 329 additions and 36 deletions

View File

@@ -0,0 +1,55 @@
//
// AddRelayView.swift
// damus
//
// Created by William Casarin on 2022-06-09.
//
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("Add Relay") {
TextField("wss://some.relay.com", text: $relay)
.textInputAutocapitalization(.never)
}
}
VStack {
HStack {
Button("Cancel") {
show_add_relay = false
action(nil)
}
.contentShape(Rectangle())
Spacer()
Button("Add") {
show_add_relay = false
action(relay)
}
.buttonStyle(.borderedProminent)
.contentShape(Rectangle())
}
.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 })
}
}