commit 0b40cd127c929762819426e30fda085ca6e7c3bb
parent 754ee254e9cb914b51742ef8bef36400da1648fb
Author: William Casarin <jb55@jb55.com>
Date: Sun, 26 Mar 2023 09:36:02 -0600
Revert "Revert "Don't make previews full bleed""
This reverts commit 57006b928bf48c205d91cd4eb7419979b4d1c1a3.
Diffstat:
1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift
@@ -58,8 +58,28 @@ struct NoteContentView: View {
.font(eventviewsize_to_font(size))
}
- func MainContent() -> some View {
- return VStack(alignment: .leading) {
+ var invoicesView: some View {
+ InvoicesView(our_pubkey: damus_state.keypair.pubkey, invoices: artifacts.invoices)
+ }
+
+ var previewView: some View {
+ Group {
+ if let preview = self.preview, show_images {
+ if let preview_height {
+ preview
+ .frame(height: preview_height)
+ } else {
+ preview
+ }
+ } else if let link = artifacts.links.first {
+ LinkViewRepresentable(meta: .url(link))
+ .frame(height: 50)
+ }
+ }
+ }
+
+ var MainContent: some View {
+ VStack(alignment: .leading) {
if size == .selected {
SelectableText(attributedString: artifacts.content)
TranslateView(damus_state: damus_state, event: event)
@@ -84,25 +104,25 @@ struct NoteContentView: View {
}
if artifacts.invoices.count > 0 {
- InvoicesView(our_pubkey: damus_state.keypair.pubkey, invoices: artifacts.invoices)
- }
-
- if let preview = self.preview, show_images {
- if let preview_height {
- preview
- .frame(height: preview_height)
+ if with_padding {
+ invoicesView
+ .padding(.horizontal)
} else {
- preview
+ invoicesView
}
- } else if let link = artifacts.links.first {
- LinkViewRepresentable(meta: .url(link))
- .frame(height: 50)
}
+
+ if with_padding {
+ previewView.padding(.horizontal)
+ } else {
+ previewView
+ }
+
}
}
var body: some View {
- MainContent()
+ MainContent
.onReceive(handle_notify(.profile_updated)) { notif in
let profile = notif.object as! ProfileUpdate
let blocks = event.blocks(damus_state.keypair.privkey)