damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 3e764e75e4c3a8be9c006136bac1a3d09d34994e
parent 7c563cb0aeeb2b7900adc8debb15db8b3be2d228
Author: ericholguin <eric.holguinsanchez@gmail.com>
Date:   Wed,  8 Feb 2023 22:42:00 -0700

Post view improvements

Changelog-Changed: Improve look of post view
Closes: #561

Diffstat:
Mdamus/Views/PostView.swift | 53++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift @@ -80,28 +80,41 @@ struct PostView: View { self.send_post() } } + .font(.system(size: 14, weight: .bold)) + .frame(width: 80, height: 30) + .foregroundColor(.white) + .background(LINEAR_GRADIENT) + .clipShape(Capsule()) } } .padding([.top, .bottom], 4) - - ZStack(alignment: .topLeading) { - TextEditor(text: $post) - .focused($focus) - .textInputAutocapitalization(.sentences) - .onChange(of: post) { _ in - if let replying_to { - damus_state.drafts.replies[replying_to] = post - } else { - damus_state.drafts.post = post + + HStack(alignment: .top) { + + ProfilePicView(pubkey: damus_state.pubkey, size: 45.0, highlight: .none, profiles: damus_state.profiles) + + VStack(alignment: .leading) { + ZStack(alignment: .topLeading) { + + TextEditor(text: $post) + .focused($focus) + .textInputAutocapitalization(.sentences) + .onChange(of: post) { _ in + if let replying_to { + damus_state.drafts.replies[replying_to] = post + } else { + damus_state.drafts.post = post + } + } + + if post.isEmpty { + Text(POST_PLACEHOLDER) + .padding(.top, 8) + .padding(.leading, 4) + .foregroundColor(Color(uiColor: .placeholderText)) + .allowsHitTesting(false) } } - - if post.isEmpty { - Text(POST_PLACEHOLDER) - .padding(.top, 8) - .padding(.leading, 4) - .foregroundColor(Color(uiColor: .placeholderText)) - .allowsHitTesting(false) } } @@ -168,3 +181,9 @@ func get_searching_string(_ post: String) -> String? { return String(last_word.dropFirst()) } + +struct PostView_Previews: PreviewProvider { + static var previews: some View { + PostView(replying_to: nil, references: [], damus_state: test_damus_state()) + } +}