Compare commits
1 Commits
transactio
...
quote-repo
| Author | SHA1 | Date | |
|---|---|---|---|
|
612abfd862
|
@@ -12,9 +12,19 @@ struct QuoteRepostsView: View {
|
|||||||
@ObservedObject var model: EventsModel
|
@ObservedObject var model: EventsModel
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TimelineView<AnyView>(events: model.events, loading: $model.loading, damus: damus_state, show_friend_icon: true, filter: ContentFilters.default_filters(damus_state: damus_state).filter(ev:))
|
TimelineView(events: model.events, loading: $model.loading, damus: damus_state, show_friend_icon: true, filter: ContentFilters.default_filters(damus_state: damus_state).filter(ev:)) {
|
||||||
|
ZStack(alignment: .leading) {
|
||||||
|
DamusBackground(maxHeight: 250)
|
||||||
|
.mask(LinearGradient(gradient: Gradient(colors: [.black, .black, .black, .clear]), startPoint: .top, endPoint: .bottom))
|
||||||
|
Text("Quotes", comment: "Navigation bar title for Quote Reposts view.")
|
||||||
|
.foregroundStyle(DamusLogoGradient.gradient)
|
||||||
|
.font(.title.bold())
|
||||||
|
.padding(.leading, 30)
|
||||||
|
.padding(.top, 30)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ignoresSafeArea()
|
||||||
.padding(.bottom, tabHeight)
|
.padding(.bottom, tabHeight)
|
||||||
.navigationBarTitle(NSLocalizedString("Quotes", comment: "Navigation bar title for Quote Reposts view."))
|
|
||||||
.onAppear {
|
.onAppear {
|
||||||
model.subscribe()
|
model.subscribe()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,14 @@ struct TransactionView: View {
|
|||||||
let formatter = RelativeDateTimeFormatter()
|
let formatter = RelativeDateTimeFormatter()
|
||||||
let relativeDate = formatter.localizedString(for: created_at, relativeTo: Date.now)
|
let relativeDate = formatter.localizedString(for: created_at, relativeTo: Date.now)
|
||||||
let event = decode_nostr_event_json(transaction.description ?? "") ?? transaction.metadata?.nostr
|
let event = decode_nostr_event_json(transaction.description ?? "") ?? transaction.metadata?.nostr
|
||||||
let pubkey = self.pubkeyToDisplay(for: event, isIncomingTransaction: isIncomingTransaction)
|
let pubkey = self.pubkeyToDisplay(for: event, isIncomingTransaction: isIncomingTransaction) ?? ANON_PUBKEY
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
ZStack {
|
ZStack {
|
||||||
ProfilePicView(pubkey: pubkey ?? ANON_PUBKEY, size: 45, highlight: .custom(.damusAdaptableBlack, 0.1), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
|
ProfilePicView(pubkey: pubkey, size: 45, highlight: .custom(.damusAdaptableBlack, 0.1), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if let pubkey {
|
damus_state.nav.push(route: Route.ProfileByKey(pubkey: pubkey))
|
||||||
damus_state.nav.push(route: Route.ProfileByKey(pubkey: pubkey))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image(txType)
|
Image(txType)
|
||||||
@@ -86,15 +84,17 @@ struct TransactionView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func userDisplayName(pubkey: Pubkey?) -> String {
|
func userDisplayName(pubkey: Pubkey) -> String {
|
||||||
guard let pubkey else {
|
|
||||||
return NSLocalizedString("Unknown", comment: "A name label for an unknown user")
|
|
||||||
}
|
|
||||||
|
|
||||||
let profile_txn = damus_state.profiles.lookup(id: pubkey, txn_name: "txview-profile")
|
let profile_txn = damus_state.profiles.lookup(id: pubkey, txn_name: "txview-profile")
|
||||||
let profile = profile_txn?.unsafeUnownedValue
|
let profile = profile_txn?.unsafeUnownedValue
|
||||||
|
|
||||||
return Profile.displayName(profile: profile, pubkey: pubkey).displayName
|
if let display_name = profile?.display_name {
|
||||||
|
return display_name
|
||||||
|
} else if let name = profile?.name {
|
||||||
|
return "@" + name
|
||||||
|
} else {
|
||||||
|
return NSLocalizedString("Unknown", comment: "A name label for an unknown user")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user