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:
@@ -14,6 +14,7 @@ struct ChatView: View {
|
|||||||
|
|
||||||
let damus_state: DamusState
|
let damus_state: DamusState
|
||||||
|
|
||||||
|
@State var expand_reply: Bool = false
|
||||||
@EnvironmentObject var thread: ThreadModel
|
@EnvironmentObject var thread: ThreadModel
|
||||||
|
|
||||||
var just_started: Bool {
|
var just_started: Bool {
|
||||||
@@ -96,8 +97,11 @@ struct ChatView: View {
|
|||||||
if let ref_id = thread.replies.lookup(event.id) {
|
if let ref_id = thread.replies.lookup(event.id) {
|
||||||
if !is_reply_to_prev() {
|
if !is_reply_to_prev() {
|
||||||
ReplyQuoteView(privkey: damus_state.keypair.privkey, quoter: event, event_id: ref_id, image_cache: damus_state.image_cache, profiles: damus_state.profiles)
|
ReplyQuoteView(privkey: damus_state.keypair.privkey, quoter: event, event_id: ref_id, image_cache: damus_state.image_cache, profiles: damus_state.profiles)
|
||||||
.frame(maxHeight: 100)
|
.frame(maxHeight: expand_reply ? nil : 100)
|
||||||
.environmentObject(thread)
|
.environmentObject(thread)
|
||||||
|
.onTapGesture {
|
||||||
|
expand_reply = !expand_reply
|
||||||
|
}
|
||||||
ReplyDescription
|
ReplyDescription
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ struct EventDetailView: View {
|
|||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
//self.uncollapse_section(scroller: proxy, c: c)
|
//self.uncollapse_section(scroller: proxy, c: c)
|
||||||
//self.toggle_collapse_thread(scroller: proxy, id: nil)
|
//self.toggle_collapse_thread(scroller: proxy, id: nil)
|
||||||
let ev = thread.events[c.start]
|
if let ev = thread.events[safe: c.start] {
|
||||||
thread.set_active_event(ev, privkey: damus.keypair.privkey)
|
thread.set_active_event(ev, privkey: damus.keypair.privkey)
|
||||||
|
}
|
||||||
toggle_thread_view()
|
toggle_thread_view()
|
||||||
}
|
}
|
||||||
case .event(let ev, let highlight):
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ struct ReplyQuoteView: View {
|
|||||||
.padding(4)
|
.padding(4)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
|
||||||
NotificationCenter.default.post(name: .select_quote, object: event)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(.circular)
|
.progressViewStyle(.circular)
|
||||||
|
|||||||
Reference in New Issue
Block a user