Updated QR Code view, include profile image, name, and remove pubkey text

Closes: #443
Changelog-Changed: Updated QR code view, include profile image, etc
This commit is contained in:
ericholguin
2023-01-30 20:33:31 -07:00
committed by William Casarin
parent d5ee9e4780
commit 99b619e011

View File

@@ -23,19 +23,44 @@ struct QRCodeView: View {
}
var body: some View {
ZStack(alignment: .topLeading) {
DamusGradient()
Button {
presentationMode.wrappedValue.dismiss()
} label: {
Image(systemName: "xmark")
.foregroundColor(.white)
.font(.subheadline)
.padding(.leading, 20)
ZStack(alignment: .center) {
ZStack(alignment: .topLeading) {
DamusGradient()
Button {
presentationMode.wrappedValue.dismiss()
} label: {
Image(systemName: "xmark")
.foregroundColor(.white)
.font(.subheadline)
.padding(.leading, 20)
}
.zIndex(1)
}
.zIndex(1)
VStack(alignment: .center) {
let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
if (damus_state.profiles.lookup(id: damus_state.pubkey)?.picture) != nil {
ProfilePicView(pubkey: damus_state.pubkey, size: 90.0, highlight: .custom(Color("DamusWhite"), 4.0), profiles: damus_state.profiles)
.padding(.top, 50)
} else {
Image(systemName: "person.fill")
.font(.system(size: 60))
.foregroundColor(Color("DamusWhite"))
.padding(.top, 50)
}
if let display_name = profile?.display_name {
Text(display_name)
.foregroundColor(Color("DamusWhite"))
.font(.system(size: 24, weight: .heavy))
}
if let name = profile?.name {
Text("@" + name)
.foregroundColor(Color("DamusWhite"))
.font(.body)
}
Spacer()
@@ -46,15 +71,24 @@ struct QRCodeView: View {
.scaledToFit()
.frame(width: 200, height: 200)
.padding()
Text(key)
.font(.headline)
.foregroundColor(Color(.white))
.padding()
.cornerRadius(10)
.overlay(RoundedRectangle(cornerRadius: 10)
.stroke(Color("DamusWhite"), lineWidth: 1))
.shadow(radius: 10)
}
Spacer()
Text("Follow me on nostr")
.foregroundColor(Color("DamusWhite"))
.font(.system(size: 24, weight: .heavy))
.padding(.top)
Text("Scan the code")
.foregroundColor(Color("DamusWhite"))
.font(.system(size: 18, weight: .ultraLight))
Spacer()
}
}