commit d19596c17ea59088e6607b023fcf1cfec7564e81
parent 0b40cd127c929762819426e30fda085ca6e7c3bb
Author: William Casarin <jb55@jb55.com>
Date: Mon, 27 Mar 2023 10:22:01 -0400
Merge remote-tracking branch 'eric/gradient-all-the-things'
Diffstat:
7 files changed, 58 insertions(+), 30 deletions(-)
diff --git a/damus/Components/NIP05Badge.swift b/damus/Components/NIP05Badge.swift
@@ -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 {
diff --git a/damus/Components/WebsiteLink.swift b/damus/Components/WebsiteLink.swift
@@ -22,6 +22,7 @@ struct WebsiteLink: View {
}, label: {
Text(link_text)
.font(.footnote)
+ .foregroundStyle(LINEAR_GRADIENT)
})
}
}
diff --git a/damus/Views/ActionBar/EventActionBar.swift b/damus/Views/ActionBar/EventActionBar.swift
@@ -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))
diff --git a/damus/Views/MainTabView.swift b/damus/Views/MainTabView.swift
@@ -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)
}
}
}
diff --git a/damus/Views/Notifications/EventGroupView.swift b/damus/Views/Notifications/EventGroupView.swift
@@ -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):
diff --git a/damus/Views/Profile/ProfileName.swift b/damus/Views/Profile/ProfileName.swift
@@ -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)
}
diff --git a/damus/Views/SearchHomeView.swift b/damus/Views/SearchHomeView.swift
@@ -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 = ""