Some more improvements to the two views
Looking better for sure Changelog-Changed: Improved look of profile view
This commit is contained in:
committed by
William Casarin
parent
8d4c7a5ddc
commit
70539ade45
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|
||||||
VStack {
|
Button {
|
||||||
Text("\(String(bech32.prefix(half)))")
|
UIPasteboard.general.string = bech32
|
||||||
.foregroundColor(colorScheme == .light ? .black : col)
|
isCopied = true
|
||||||
.font(.footnote.monospaced())
|
} label: {
|
||||||
Text("\(String(bech32.suffix(half)))")
|
Label(isCopied ? "Copied" : "", systemImage: "key.fill")
|
||||||
.font(.footnote.monospaced())
|
.font(isCopied ? .caption : .system(size: 15).weight(.light))
|
||||||
.foregroundColor(colorScheme == .light ? .black : col)
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.foregroundColor(isCopied ? .gray : col)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user