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

View File

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

View File

@@ -77,9 +77,15 @@ struct EventActionBar: View {
send_like() send_like()
} }
} }
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")") if bar.liked {
.font(.footnote.weight(.medium)) Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.foregroundColor(bar.liked ? Color.accentColor : Color.gray) .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 amountOfAngleIncrease = 20.0
} }
}) { }) {
Image(liked ? "shaka-full" : "shaka-line") if liked {
.foregroundColor(liked ? .accentColor : .gray) 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")) .accessibilityLabel(NSLocalizedString("Like", comment: "Accessibility Label for Like button"))
.rotationEffect(Angle(degrees: shouldAnimate ? rotationAngle : 0)) .rotationEffect(Angle(degrees: shouldAnimate ? rotationAngle : 0))

View File

@@ -47,7 +47,7 @@ struct TabButton: View {
.frame(width: 10, height: 10, alignment: .topTrailing) .frame(width: 10, height: 10, alignment: .topTrailing)
.alignmentGuide(VerticalAlignment.center) { a in a.height + 2.0 } .alignmentGuide(VerticalAlignment.center) { a in a.height + 2.0 }
.alignmentGuide(HorizontalAlignment.center) { a in a.width - 12.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") Image(systemName: "arrow.2.squarepath")
.foregroundColor(Color("DamusGreen")) .foregroundColor(Color("DamusGreen"))
case .reaction: case .reaction:
Image("shaka-full") LINEAR_GRADIENT
.resizable() .mask(Image("shaka-full")
.frame(width: 24, height: 24) .resizable()
.foregroundColor(.accentColor) ).frame(width: 24, height: 24)
case .profile_zap(let zapgrp): case .profile_zap(let zapgrp):
ZapIcon(zapgrp) ZapIcon(zapgrp)
case .zap(let zapgrp): case .zap(let zapgrp):

View File

@@ -61,10 +61,6 @@ struct ProfileName: View {
nip05 ?? damus_state.profiles.is_validated(pubkey) 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 { var current_display_name: DisplayName {
return display_name ?? Profile.displayName(profile: profile, pubkey: pubkey) return display_name ?? Profile.displayName(profile: profile, pubkey: pubkey)
} }

View File

@@ -30,7 +30,7 @@ struct SearchHomeView: View {
if(!search.isEmpty) { if(!search.isEmpty) {
Text("Cancel", comment: "Cancel out of search view.") 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)) .padding(EdgeInsets(top: 0.0, leading: 0.0, bottom: 0.0, trailing: 10.0))
.onTapGesture { .onTapGesture {
self.search = "" self.search = ""