Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-04-19 19:46:30 -07:00
parent b100e9887b
commit 78c5b47f11
12 changed files with 519 additions and 107 deletions

View File

@@ -0,0 +1,64 @@
//
// SwiftUIView.swift
// damus
//
// Created by William Casarin on 2022-04-19.
//
import SwiftUI
struct ReplyQuoteView: View {
let quoter: NostrEvent
let event_id: String
@EnvironmentObject var profiles: Profiles
@EnvironmentObject var thread: ThreadModel
func MainContent(event: NostrEvent) -> some View {
HStack(alignment: .top) {
ProfilePicView(picture: profiles.lookup(id: event.pubkey)?.picture, size: 16, highlight: .none)
//.border(Color.blue)
VStack {
HStack {
ProfileName(pubkey: event.pubkey, profile: profiles.lookup(id: event.pubkey))
Text("\(format_relative_time(event.created_at))")
.foregroundColor(.gray)
Spacer()
}
Text(event.content)
.frame(maxWidth: .infinity, alignment: .leading)
.textSelection(.enabled)
//Spacer()
}
//.border(Color.red)
}
//.border(Color.green)
}
var body: some View {
Group {
if let event = thread.lookup(event_id) {
Group {
MainContent(event: event)
.padding(4)
}
.background(Color.secondary.opacity(0.2))
.cornerRadius(8.0)
} else {
ProgressView()
.progressViewStyle(.circular)
}
}
}
}
/*
struct SwiftUIView_Previews: PreviewProvider {
static var previews: some View {
SwiftUIView()
}
}
*/