Merge remote-tracking branch 'eric/gradient-all-the-things'

This commit is contained in:
William Casarin
2023-03-27 10:22:01 -04:00
7 changed files with 58 additions and 30 deletions

View File

@@ -24,27 +24,45 @@ struct NIP05Badge: View {
self.clickable = clickable
}
var nip05_color: Color {
return get_nip05_color(pubkey: pubkey, contacts: contacts)
var nip05_color: Bool {
return use_nip05_color(pubkey: pubkey, contacts: contacts)
}
var body: some View {
HStack(spacing: 2) {
Image(systemName: "checkmark.seal.fill")
.font(.footnote)
.foregroundColor(nip05_color)
if nip05_color {
LINEAR_GRADIENT
.mask(Image(systemName: "checkmark.seal.fill")
.resizable()
).frame(width: 14, height: 14)
} else {
Image(systemName: "checkmark.seal.fill")
.font(.footnote)
.foregroundColor(.gray)
}
if show_domain {
if clickable {
Text(nip05.host)
.foregroundColor(nip05_color)
.onTapGesture {
if let nip5url = nip05.siteUrl {
openURL(nip5url)
if nip05_color {
Text(nip05.host)
.foregroundStyle(LINEAR_GRADIENT)
.onTapGesture {
if let nip5url = nip05.siteUrl {
openURL(nip5url)
}
}
}
} else {
Text(nip05.host)
.foregroundColor(.gray)
.onTapGesture {
if let nip5url = nip05.siteUrl {
openURL(nip5url)
}
}
}
} else {
Text(nip05.host)
.foregroundColor(nip05_color)
.foregroundColor(.gray)
}
}
}
@@ -52,8 +70,8 @@ struct NIP05Badge: View {
}
}
func get_nip05_color(pubkey: String, contacts: Contacts) -> Color {
return contacts.is_friend_or_self(pubkey) ? .accentColor : .gray
func use_nip05_color(pubkey: String, contacts: Contacts) -> Bool {
return contacts.is_friend_or_self(pubkey) ? true : false
}
struct NIP05Badge_Previews: PreviewProvider {

View File

@@ -22,6 +22,7 @@ struct WebsiteLink: View {
}, label: {
Text(link_text)
.font(.footnote)
.foregroundStyle(LINEAR_GRADIENT)
})
}
}

View File

@@ -77,9 +77,15 @@ struct EventActionBar: View {
send_like()
}
}
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.foregroundColor(bar.liked ? Color.accentColor : Color.gray)
if bar.liked {
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.foregroundStyle(LINEAR_GRADIENT)
} else {
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.foregroundColor(Color.gray)
}
}
@@ -188,8 +194,15 @@ struct LikeButton: View {
amountOfAngleIncrease = 20.0
}
}) {
Image(liked ? "shaka-full" : "shaka-line")
.foregroundColor(liked ? .accentColor : .gray)
if liked {
LINEAR_GRADIENT
.mask(Image("shaka-full")
.resizable()
).frame(width: 14, height: 14)
} else {
Image("shaka-line")
.foregroundColor(.gray)
}
}
.accessibilityLabel(NSLocalizedString("Like", comment: "Accessibility Label for Like button"))
.rotationEffect(Angle(degrees: shouldAnimate ? rotationAngle : 0))

View File

@@ -47,7 +47,7 @@ struct TabButton: View {
.frame(width: 10, height: 10, alignment: .topTrailing)
.alignmentGuide(VerticalAlignment.center) { a in a.height + 2.0 }
.alignmentGuide(HorizontalAlignment.center) { a in a.width - 12.0 }
.foregroundColor(.accentColor)
.foregroundStyle(LINEAR_GRADIENT)
}
}
}

View File

@@ -186,10 +186,10 @@ struct EventGroupView: View {
Image(systemName: "arrow.2.squarepath")
.foregroundColor(Color("DamusGreen"))
case .reaction:
Image("shaka-full")
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(.accentColor)
LINEAR_GRADIENT
.mask(Image("shaka-full")
.resizable()
).frame(width: 24, height: 24)
case .profile_zap(let zapgrp):
ZapIcon(zapgrp)
case .zap(let zapgrp):

View File

@@ -60,11 +60,7 @@ struct ProfileName: View {
var current_nip05: NIP05? {
nip05 ?? damus_state.profiles.is_validated(pubkey)
}
var nip05_color: Color {
return get_nip05_color(pubkey: pubkey, contacts: damus_state.contacts)
}
var current_display_name: DisplayName {
return display_name ?? Profile.displayName(profile: profile, pubkey: pubkey)
}

View File

@@ -30,7 +30,7 @@ struct SearchHomeView: View {
if(!search.isEmpty) {
Text("Cancel", comment: "Cancel out of search view.")
.foregroundColor(.accentColor)
.foregroundStyle(LINEAR_GRADIENT)
.padding(EdgeInsets(top: 0.0, leading: 0.0, bottom: 0.0, trailing: 10.0))
.onTapGesture {
self.search = ""