event mentions working

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-07 17:48:00 -07:00
parent 0ad17c05fe
commit 4db06b015c
10 changed files with 175 additions and 27 deletions

View File

@@ -59,7 +59,9 @@ struct ContentView: View {
@State var friend_events: [NostrEvent] = []
@State var notifications: [NostrEvent] = []
@State var active_profile: String? = nil
@State var active_event_id: String? = nil
@State var profile_open: Bool = false
@State var thread_open: Bool = false
// connect retry timer
let timer = Timer.publish(every: 60, on: .main, in: .common).autoconnect()
@@ -151,6 +153,9 @@ struct ContentView: View {
NavigationLink(destination: MaybeProfileView, isActive: $profile_open) {
EmptyView()
}
NavigationLink(destination: MaybeThreadView, isActive: $thread_open) {
EmptyView()
}
switch selected_timeline {
case .home:
PostingTimelineView
@@ -178,6 +183,18 @@ struct ContentView: View {
.navigationViewStyle(.stack)
}
var MaybeThreadView: some View {
Group {
if let evid = self.active_event_id {
let thread_model = ThreadModel(evid: evid, pool: damus!.pool)
ThreadView(thread: thread_model, damus: damus!)
.environmentObject(profiles)
} else {
EmptyView()
}
}
}
var MaybeProfileView: some View {
Group {
if let pk = self.active_profile {
@@ -226,7 +243,8 @@ struct ContentView: View {
active_profile = ref.ref_id
profile_open = true
} else if ref.key == "e" {
// TODO open event view
active_event_id = ref.ref_id
thread_open = true
}
case .filter:
break