@@ -15,7 +15,10 @@ struct EventDetailBar: View {
|
||||
var body: some View {
|
||||
HStack {
|
||||
if bar.boosts > 0 {
|
||||
Text("\(Text("\(bar.boosts)", comment: "Number of reposts.").font(.body.bold())) \(Text(String(format: NSLocalizedString("reposts_count", comment: "Part of a larger sentence to describe how many reposts there are."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reposts. In source English, the first variable is the number of reposts, and the second variable is 'Repost' or 'Reposts'.")
|
||||
NavigationLink(destination: RepostsView(damus_state: state, model: RepostsModel(state: state, target: target))) {
|
||||
Text("\(Text("\(bar.boosts)", comment: "Number of reposts.").font(.body.bold())) \(Text(String(format: NSLocalizedString("reposts_count", comment: "Part of a larger sentence to describe how many reposts there are."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reposts. In source English, the first variable is the number of reposts, and the second variable is 'Repost' or 'Reposts'.")
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
|
||||
if bar.likes > 0 {
|
||||
|
||||
24
damus/Views/Reposts/RepostView.swift
Normal file
24
damus/Views/Reposts/RepostView.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// RepostView.swift
|
||||
// damus
|
||||
//
|
||||
// Created by Terry Yiu on 1/22/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RepostView: View {
|
||||
let damus_state: DamusState
|
||||
let repost: NostrEvent
|
||||
|
||||
var body: some View {
|
||||
FollowUserView(target: .pubkey(repost.pubkey), damus_state: damus_state)
|
||||
}
|
||||
}
|
||||
|
||||
struct RepostView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
RepostView(damus_state: test_damus_state(), repost: NostrEvent(id: "", content: "", pubkey: ""))
|
||||
}
|
||||
}
|
||||
|
||||
38
damus/Views/RepostsView.swift
Normal file
38
damus/Views/RepostsView.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// RepostsView.swift
|
||||
// damus
|
||||
//
|
||||
// Created by Terry Yiu on 1/22/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RepostsView: View {
|
||||
let damus_state: DamusState
|
||||
@StateObject var model: RepostsModel
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(model.reposts, id: \.id) { ev in
|
||||
RepostView(damus_state: damus_state, repost: ev)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.navigationBarTitle(NSLocalizedString("Reposts", comment: "Navigation bar title for Reposts view."))
|
||||
.onAppear {
|
||||
model.subscribe()
|
||||
}
|
||||
.onDisappear {
|
||||
model.unsubscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RepostsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
let state = test_damus_state()
|
||||
RepostsView(damus_state: state, model: RepostsModel(state: state, target: "pubkey"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user