move text event to its own file, improve zaps
This commit is contained in:
@@ -21,13 +21,26 @@ enum ActionBarSheet: Identifiable {
|
||||
struct EventActionBar: View {
|
||||
let damus_state: DamusState
|
||||
let event: NostrEvent
|
||||
let test_lnurl: String?
|
||||
let generator = UIImpactFeedbackGenerator(style: .medium)
|
||||
|
||||
// just used for previews
|
||||
@State var sheet: ActionBarSheet? = nil
|
||||
@State var confirm_boost: Bool = false
|
||||
@State var show_share_sheet: Bool = false
|
||||
@StateObject var bar: ActionBarModel
|
||||
|
||||
init(damus_state: DamusState, event: NostrEvent, bar: ActionBarModel, test_lnurl: String? = nil) {
|
||||
self.damus_state = damus_state
|
||||
self.event = event
|
||||
self.test_lnurl = test_lnurl
|
||||
_bar = StateObject.init(wrappedValue: bar)
|
||||
}
|
||||
|
||||
var lnurl: String? {
|
||||
test_lnurl ?? damus_state.profiles.lookup(id: event.pubkey)?.lnurl
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if damus_state.keypair.privkey != nil {
|
||||
@@ -51,6 +64,7 @@ struct EventActionBar: View {
|
||||
.foregroundColor(bar.boosted ? Color.green : Color.gray)
|
||||
}
|
||||
Spacer()
|
||||
|
||||
ZStack {
|
||||
LikeButton(liked: bar.liked) {
|
||||
if bar.liked {
|
||||
@@ -66,7 +80,7 @@ struct EventActionBar: View {
|
||||
|
||||
}
|
||||
|
||||
if let lnurl = damus_state.profiles.lookup(id: event.pubkey)?.lnurl {
|
||||
if let lnurl = self.lnurl {
|
||||
Spacer()
|
||||
ZapButton(damus_state: damus_state, event: event, lnurl: lnurl, bar: bar)
|
||||
}
|
||||
@@ -177,7 +191,7 @@ struct EventActionBar_Previews: PreviewProvider {
|
||||
|
||||
EventActionBar(damus_state: ds, event: ev, bar: maxed_bar)
|
||||
|
||||
EventActionBar(damus_state: ds, event: ev, bar: zapbar)
|
||||
EventActionBar(damus_state: ds, event: ev, bar: zapbar, test_lnurl: "lnurl")
|
||||
}
|
||||
.padding(20)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ struct EventDetailBar: View {
|
||||
}
|
||||
|
||||
if bar.zaps > 0 {
|
||||
Text("\(Text("\(bar.zaps)", comment: "Number of zap payments on a post.").font(.body.bold())) \(Text(String(format: NSLocalizedString("zaps_count", comment: "Part of a larger sentence to describe how many zap payments there are on a post."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many zap payments there are on a post. In source English, the first variable is the number of zap payments, and the second variable is 'Zap' or 'Zaps'.")
|
||||
Text("\(Text("\(bar.zaps)", comment: "Number of zap payments on a post.").font(.body.bold())) \(Text(String(format: NSLocalizedString("Zaps", comment: "Part of a larger sentence to describe how many zap payments there are on a post."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many zap payments there are on a post. In source English, the first variable is the number of zap payments, and the second variable is 'Zap' or 'Zaps'.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user