add button to make relay adds more obvious
This commit is contained in:
@@ -13,6 +13,7 @@ struct UserRelaysView: View {
|
||||
let relays: [String]
|
||||
|
||||
@State var relay_state: [(String, Bool)]
|
||||
@State private var showAddButton = false
|
||||
|
||||
init (state: DamusState, pubkey: String, relays: [String]) {
|
||||
self.state = state
|
||||
@@ -30,12 +31,25 @@ struct UserRelaysView: View {
|
||||
|
||||
var body: some View {
|
||||
List(relay_state, id: \.0) { (r, add) in
|
||||
RecommendedRelayView(damus: state, relay: r, add_button: add)
|
||||
RecommendedRelayView(damus: state, relay: r, add_button: add, showActionButtons: $showAddButton)
|
||||
}
|
||||
.onReceive(handle_notify(.relays_changed)) { _ in
|
||||
self.relay_state = UserRelaysView.make_relay_state(pool: state.pool, relays: self.relays)
|
||||
}
|
||||
.navigationBarTitle("Relays")
|
||||
.toolbar{
|
||||
if state.keypair.privkey != nil {
|
||||
if showAddButton {
|
||||
Button("Done") {
|
||||
showAddButton.toggle()
|
||||
}
|
||||
} else {
|
||||
Button("Show Add") {
|
||||
showAddButton.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user