Browse Source

Some more improvements to the two views. Looking better for sure

profile-edit
Sam DuBois 2 years ago
parent
commit
8c010e864a
  1. 15
      damus/Views/FollowButtonView.swift
  2. 41
      damus/Views/ProfileView.swift

15
damus/Views/FollowButtonView.swift

@ -12,10 +12,21 @@ struct FollowButtonView: View {
@State var follow_state: FollowState @State var follow_state: FollowState
var body: some View { var body: some View {
Button("\(follow_btn_txt(follow_state))") { Button {
follow_state = perform_follow_btn_action(follow_state, target: target) 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 .onReceive(handle_notify(.followed)) { notif in
let pk = notif.object as! String let pk = notif.object as! String
if pk != target.pubkey { if pk != target.pubkey {

41
damus/Views/ProfileView.swift

@ -82,8 +82,10 @@ struct ProfileView: View {
Button(action: { Button(action: {
UIApplication.shared.open(url) UIApplication.shared.open(url)
}) { }) {
Label("", systemImage: "bolt.fill") Image(systemName: "bolt.circle")
.foregroundColor(.orange) .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) let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey)
.environmentObject(dm_model) .environmentObject(dm_model)
return NavigationLink(destination: dmview) { 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 { var TopSection: some View {
@ -106,13 +110,14 @@ struct ProfileView: View {
Spacer() Spacer()
KeyView(pubkey: profile.pubkey)
.pubkey_context_menu(bech32_pubkey: bech32_pubkey(profile.pubkey) ?? profile.pubkey)
if let lnuri = data?.lightning_uri { if let lnuri = data?.lightning_uri {
LNButton(lnuri) LNButton(lnuri)
.padding([.trailing], 20)
} }
DMButton DMButton
.padding([.trailing], 20)
FollowButtonView(target: profile.get_follow_target(), follow_state: damus_state.contacts.follow_state(profile.pubkey)) 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) ProfileNameView(pubkey: profile.pubkey, profile: data, contacts: damus_state.contacts)
.padding(.bottom) .padding(.bottom)
KeyView(pubkey: profile.pubkey)
.padding(.bottom, 10)
.pubkey_context_menu(bech32_pubkey: bech32_pubkey(profile.pubkey) ?? profile.pubkey)
Text(data?.about ?? "") Text(data?.about ?? "")
Divider() Divider()
@ -209,18 +210,20 @@ struct KeyView: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
@State private var isCopied = false
var body: some View { var body: some View {
let col = id_to_color(pubkey) let col = id_to_color(pubkey)
let bech32 = bech32_pubkey(pubkey) ?? pubkey let bech32 = bech32_pubkey(pubkey) ?? pubkey
let half = bech32.count / 2
Button {
VStack { UIPasteboard.general.string = bech32
Text("\(String(bech32.prefix(half)))") isCopied = true
.foregroundColor(colorScheme == .light ? .black : col) } label: {
.font(.footnote.monospaced()) Label(isCopied ? "Copied" : "", systemImage: "key.fill")
Text("\(String(bech32.suffix(half)))") .font(isCopied ? .caption : .system(size: 15).weight(.light))
.font(.footnote.monospaced()) .symbolRenderingMode(.hierarchical)
.foregroundColor(colorScheme == .light ? .black : col) .foregroundColor(isCopied ? .gray : col)
} }
} }
} }

Loading…
Cancel
Save