damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 05dee129b503f3fd500687e4ccfbd719e3383cfc
parent 7bed47c919f545794d93198891b78a4995e59e27
Author: ericholguin <eric.holguinsanchez@gmail.com>
Date:   Fri,  6 Oct 2023 22:13:47 -0600

relays: allow users to hide the recommended relay view

Closes: https://github.com/damus-io/damus/pull/1587
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Views/Relays/RelayConfigView.swift | 37+++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/damus/Views/Relays/RelayConfigView.swift b/damus/Views/Relays/RelayConfigView.swift @@ -12,6 +12,7 @@ struct RelayConfigView: View { @State var relays: [RelayDescriptor] @State private var showActionButtons = false @State var show_add_relay: Bool = false + @SceneStorage("RelayConfigView.show_recommended") var show_recommended : Bool = true @Environment(\.dismiss) var dismiss @@ -43,8 +44,41 @@ struct RelayConfigView: View { VStack { Divider() - if recommended.count > 0 { + if showActionButtons && !show_recommended { VStack { + Button(action: { + withAnimation(.easeOut(duration: 0.2)) { + show_recommended.toggle() + } + }) { + Text("Show recommended relays", comment: "Button to show recommended relays.") + .foregroundStyle(DamusLightGradient.gradient) + .padding(10) + .background { + RoundedRectangle(cornerRadius: 15) + .stroke(DamusLightGradient.gradient) + } + } + .padding(.top, 10) + } + } + + if recommended.count > 0 && show_recommended { + VStack { + HStack(alignment: .top) { + Spacer() + Button(action: { + withAnimation(.easeOut(duration: 0.2)) { + show_recommended.toggle() + } + }) { + Image(systemName: "xmark.circle") + .font(.system(size: 18)) + .foregroundStyle(DamusLightGradient.gradient) + } + .padding([.top, .trailing], 8) + } + Text("Recommended relays", comment: "Title for view of recommended relays.") .foregroundStyle(DamusLightGradient.gradient) .padding(10) @@ -52,7 +86,6 @@ struct RelayConfigView: View { RoundedRectangle(cornerRadius: 15) .stroke(DamusLightGradient.gradient) } - .padding(.vertical) HStack(spacing: 20) { ForEach(recommended, id: \.url) { r in