From e9809ccfc7e2a26a568553344dd19a162f3f7333 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Tue, 31 Mar 2026 12:25:05 +0700 Subject: [PATCH] . --- crates/chat/src/lib.rs | 10 ++++++++- crates/chat_ui/src/lib.rs | 43 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/crates/chat/src/lib.rs b/crates/chat/src/lib.rs index 2833518..cd89cd0 100644 --- a/crates/chat/src/lib.rs +++ b/crates/chat/src/lib.rs @@ -468,7 +468,15 @@ impl ChatRegistry { self.trashes.clone() } - /// Get the relays that have seen a given message. + /// Get the relays that have seen a given rumor id. + pub fn rumor_seen_on(&self, id: &EventId) -> Option> { + self.event_map + .read_blocking() + .get(id) + .map(|id| self.seen_on(id)) + } + + /// Get the relays that have seen a given gift wrap id. pub fn seen_on(&self, id: &EventId) -> HashSet { self.seens .read_blocking() diff --git a/crates/chat_ui/src/lib.rs b/crates/chat_ui/src/lib.rs index ebb6406..e81de04 100644 --- a/crates/chat_ui/src/lib.rs +++ b/crates/chat_ui/src/lib.rs @@ -3,7 +3,7 @@ use std::sync::Arc; pub use actions::*; use anyhow::{Context as AnyhowContext, Error}; -use chat::{Message, RenderedMessage, Room, RoomEvent, SendReport, SendStatus}; +use chat::{ChatRegistry, Message, RenderedMessage, Room, RoomEvent, SendReport, SendStatus}; use common::RenderedTimestamp; use gpui::prelude::FluentBuilder; use gpui::{ @@ -665,9 +665,46 @@ impl ChatPanel { } fn open_trace(&mut self, id: &EventId, window: &mut Window, cx: &mut Context) { + let chat = ChatRegistry::global(cx); + let seen_on = chat.read(cx).rumor_seen_on(id); + window.open_modal(cx, move |this, _window, cx| { - // TODO - this.child(v_flex().child("")) + this.title("Seen on").show_close(true).child( + v_flex() + .gap_1() + .when_none(&seen_on, |this| { + this.child( + h_flex() + .h_10() + .justify_center() + .text_sm() + .bg(cx.theme().elevated_surface_background) + .rounded(cx.theme().radius) + .child("Message isn't traced yet"), + ) + }) + .when_some(seen_on.as_ref(), |this, relays| { + this.children({ + let mut items = vec![]; + + for url in relays.iter() { + items.push( + h_flex() + .h_7() + .px_2() + .gap_2() + .bg(cx.theme().elevated_surface_background) + .rounded(cx.theme().radius) + .text_sm() + .child(div().size_1p5().rounded_full().bg(gpui::green())) + .child(SharedString::from(url.to_string())), + ); + } + + items + }) + }), + ) }); }