clicking chat quotes now just expands thems

jumping to them is kind of annoying

Changelog-Changed: Clicking a chatroom quote reply will now expand it instead of jumping to it
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-08-09 16:49:41 -07:00
parent 22cad4b072
commit 65710eeb5e
3 changed files with 17 additions and 6 deletions

View File

@@ -66,8 +66,9 @@ struct EventDetailView: View {
.onTapGesture {
//self.uncollapse_section(scroller: proxy, c: c)
//self.toggle_collapse_thread(scroller: proxy, id: nil)
let ev = thread.events[c.start]
thread.set_active_event(ev, privkey: damus.keypair.privkey)
if let ev = thread.events[safe: c.start] {
thread.set_active_event(ev, privkey: damus.keypair.privkey)
}
toggle_thread_view()
}
case .event(let ev, let highlight):
@@ -333,3 +334,12 @@ func scroll_to_event(scroller: ScrollViewProxy, id: String, delay: Double, anima
}
}
*/
extension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript (safe index: Index) -> Element? {
return indices.contains(index) ? self[index] : nil
}
}