damus

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

commit 70539ade4505974d67ff9c4430a95bbafd81ffe3
parent 8d4c7a5ddc6704e5704f148055d0485f5642a34a
Author: Sam DuBois <sdubois@umass.edu>
Date:   Sat, 17 Dec 2022 23:28:35 -0700

Some more improvements to the two views

Looking better for sure

Changelog-Changed: Improved look of profile view

Diffstat:
Mdamus/Views/FollowButtonView.swift | 15+++++++++++++--
Mdamus/Views/ProfileView.swift | 39+++++++++++++++++++++------------------
2 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/damus/Views/FollowButtonView.swift b/damus/Views/FollowButtonView.swift @@ -12,10 +12,21 @@ struct FollowButtonView: View { @State var follow_state: FollowState var body: some View { - Button("\(follow_btn_txt(follow_state))") { + Button { follow_state = perform_follow_btn_action(follow_state, target: target) + } label: { + Text(follow_btn_txt(follow_state)) + .padding(.horizontal, 20) + .padding(.vertical, 7) + .font(.caption.weight(.bold)) + .foregroundColor(follow_state == .unfollows ? .white : .black) + .background(follow_state == .unfollows ? .black : .white) + .cornerRadius(20) + .overlay { + RoundedRectangle(cornerRadius: 16) + .stroke(follow_state == .unfollows ? .white : .gray, lineWidth: 1) + } } - .buttonStyle(.bordered) .onReceive(handle_notify(.followed)) { notif in let pk = notif.object as! String if pk != target.pubkey { diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift @@ -82,8 +82,10 @@ struct ProfileView: View { Button(action: { UIApplication.shared.open(url) }) { - Label("", systemImage: "bolt.fill") - .foregroundColor(.orange) + Image(systemName: "bolt.circle") + .symbolRenderingMode(.palette) + .foregroundStyle(.black, .gray) + .font(.system(size: 27).weight(.thin)) } } @@ -92,9 +94,11 @@ struct ProfileView: View { let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey) .environmentObject(dm_model) return NavigationLink(destination: dmview) { - Label("", systemImage: "text.bubble") + Image(systemName: "bubble.left.circle") + .symbolRenderingMode(.palette) + .font(.system(size: 29).weight(.thin)) + .foregroundStyle(.black, .gray) } - .buttonStyle(PlainButtonStyle()) } var TopSection: some View { @@ -106,13 +110,14 @@ struct ProfileView: View { Spacer() + KeyView(pubkey: profile.pubkey) + .pubkey_context_menu(bech32_pubkey: bech32_pubkey(profile.pubkey) ?? profile.pubkey) + if let lnuri = data?.lightning_uri { LNButton(lnuri) - .padding([.trailing], 20) } DMButton - .padding([.trailing], 20) FollowButtonView(target: profile.get_follow_target(), follow_state: damus_state.contacts.follow_state(profile.pubkey)) } @@ -120,10 +125,6 @@ struct ProfileView: View { ProfileNameView(pubkey: profile.pubkey, profile: data, contacts: damus_state.contacts) .padding(.bottom) - KeyView(pubkey: profile.pubkey) - .padding(.bottom, 10) - .pubkey_context_menu(bech32_pubkey: bech32_pubkey(profile.pubkey) ?? profile.pubkey) - Text(data?.about ?? "") Divider() @@ -209,18 +210,20 @@ struct KeyView: View { @Environment(\.colorScheme) var colorScheme + @State private var isCopied = false + var body: some View { let col = id_to_color(pubkey) let bech32 = bech32_pubkey(pubkey) ?? pubkey - let half = bech32.count / 2 - VStack { - Text("\(String(bech32.prefix(half)))") - .foregroundColor(colorScheme == .light ? .black : col) - .font(.footnote.monospaced()) - Text("\(String(bech32.suffix(half)))") - .font(.footnote.monospaced()) - .foregroundColor(colorScheme == .light ? .black : col) + Button { + UIPasteboard.general.string = bech32 + isCopied = true + } label: { + Label(isCopied ? "Copied" : "", systemImage: "key.fill") + .font(isCopied ? .caption : .system(size: 15).weight(.light)) + .symbolRenderingMode(.hierarchical) + .foregroundColor(isCopied ? .gray : col) } } }