BlueGit

ict rusty-teams

feat(notify): mark one activity entry as read from the bell popup

Hovering an unread entry swaps its dot for a check button. Clicking it marks
only that entry read; the popup stays open and the chat keeps its unread state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-08 · 7 weeks ago

Hash
b41a05ad0542e8e674521ba15174bcf185f05aa5
Parent
09f9187c
1 file changed +51 −7
crates/app/src/views/activity_panel.rs +51 −7
@@ -1,6 +1,6 @@
1 1 use chrono::{DateTime, Local, NaiveDate, Offset};
2 2 use gpui_kit::assets::IconName;
3 use gpui_kit::component::{h_flex, v_flex};
3 use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
4 4 use gpui_kit::prelude::FluentBuilder as _;
5 5 use gpui_kit::*;
6 6 use store::Sidebar;
@@ -20,6 +20,7 @@ const PANEL_MARGIN: f32 = 8.;
20 20 const AVATAR_SIZE: f32 = 32.;
21 21 const KIND_MARKER_SIZE: f32 = 16.;
22 22 const BUTTON_SIZE: f32 = 28.;
23 const MARK_READ_SIZE: f32 = 24.;
23 24 const FILTER_KEY: &str = "activity_filter";
24 25
25 26 pub enum ActivityPanelEvent {
@@ -189,6 +190,7 @@ impl ActivityPanel {
189 190 offset: chrono::FixedOffset,
190 191 panel: Entity<ActivityPanel>,
191 192 ) -> AnyElement {
193 let activity = self.activity.clone();
192 194 let id = entry.id;
193 195 let unread = !entry.read;
194 196 let actor = entry.latest_actor();
@@ -198,8 +200,10 @@ impl ActivityPanel {
198 200 actor.map_or("", |actor| actor.name.as_str()),
199 201 AVATAR_SIZE,
200 202 );
203 let group = SharedString::from(format!("activity-row-group-{id}"));
201 204 h_flex()
202 205 .id(ElementId::Name(format!("activity-row-{id}").into()))
206 .group(group.clone())
203 207 .mx(px(6.))
204 208 .px(px(6.))
205 209 .py(px(8.))
@@ -253,24 +257,64 @@ impl ActivityPanel {
253 257 v_flex()
254 258 .flex_none()
255 259 .items_end()
256 .gap(px(6.))
260 .gap(px(2.))
257 261 .child(
258 262 div()
259 263 .text_size(px(11.))
260 264 .text_color(theme::text_muted())
261 265 .child(format::list_time_label(entry.updated_at, today, offset)),
262 266 )
263 .child(if unread {
264 dot(8.)
265 } else {
266 div().size(px(8.)).flex_none()
267 }),
267 .child(status_slot(id, unread, group, activity)),
268 268 )
269 269 .on_click(move |_, _, cx| panel.update(cx, |this, cx| this.open(id, cx)))
270 270 .into_any_element()
271 271 }
272 272 }
273 273
274 fn status_slot(
275 id: i64,
276 unread: bool,
277 group: SharedString,
278 activity: Entity<ActivityCenter>,
279 ) -> Div {
280 let slot = div()
281 .h(px(MARK_READ_SIZE))
282 .flex()
283 .flex_none()
284 .items_center()
285 .justify_end();
286 if !unread {
287 return slot;
288 }
289 slot.child(
290 div()
291 .flex()
292 .group_hover(group.clone(), |wrapper| wrapper.hidden())
293 .child(dot(8.)),
294 )
295 .child(
296 div()
297 .id(ElementId::Name(format!("activity-mark-read-{id}").into()))
298 .hidden()
299 .group_hover(group, |button| button.flex())
300 .size(px(MARK_READ_SIZE))
301 .flex_none()
302 .items_center()
303 .justify_center()
304 .rounded(px(6.))
305 .border_1()
306 .border_color(theme::border_strong())
307 .bg(theme::surface_raised())
308 .cursor_pointer()
309 .child(icon(IconName::Check, 14., theme::text()))
310 .tooltip(|window, cx| Tooltip::new("Mark as read").build(window, cx))
311 .on_click(move |_, _, cx| {
312 cx.stop_propagation();
313 activity.update(cx, |activity, cx| activity.mark_read(id, cx));
314 }),
315 )
316 }
317
274 318 fn kind_marker(entry: &Entry) -> Div {
275 319 let marker = div()
276 320 .absolute()
@@ -1,6 +1,6 @@
1use chrono::{DateTime, Local, NaiveDate, Offset};
1use chrono::{DateTime, Local, NaiveDate, Offset};
2use gpui_kit::assets::IconName;
2use gpui_kit::assets::IconName;
3use gpui_kit::component::{h_flex, v_flex};
3use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
4use gpui_kit::prelude::FluentBuilder as _;
4use gpui_kit::prelude::FluentBuilder as _;
5use gpui_kit::*;
5use gpui_kit::*;
6use store::Sidebar;
6use store::Sidebar;
@@ -20,6 +20,7 @@ const PANEL_MARGIN: f32 = 8.;
20const AVATAR_SIZE: f32 = 32.;
20const AVATAR_SIZE: f32 = 32.;
21const KIND_MARKER_SIZE: f32 = 16.;
21const KIND_MARKER_SIZE: f32 = 16.;
22const BUTTON_SIZE: f32 = 28.;
22const BUTTON_SIZE: f32 = 28.;
23const MARK_READ_SIZE: f32 = 24.;
23const FILTER_KEY: &str = "activity_filter";
24const FILTER_KEY: &str = "activity_filter";
24
25
25pub enum ActivityPanelEvent {
26pub enum ActivityPanelEvent {
@@ -189,6 +190,7 @@ impl ActivityPanel {
189 offset: chrono::FixedOffset,
190 offset: chrono::FixedOffset,
190 panel: Entity<ActivityPanel>,
191 panel: Entity<ActivityPanel>,
191 ) -> AnyElement {
192 ) -> AnyElement {
193 let activity = self.activity.clone();
192 let id = entry.id;
194 let id = entry.id;
193 let unread = !entry.read;
195 let unread = !entry.read;
194 let actor = entry.latest_actor();
196 let actor = entry.latest_actor();
@@ -198,8 +200,10 @@ impl ActivityPanel {
198 actor.map_or("", |actor| actor.name.as_str()),
200 actor.map_or("", |actor| actor.name.as_str()),
199 AVATAR_SIZE,
201 AVATAR_SIZE,
200 );
202 );
203 let group = SharedString::from(format!("activity-row-group-{id}"));
201 h_flex()
204 h_flex()
202 .id(ElementId::Name(format!("activity-row-{id}").into()))
205 .id(ElementId::Name(format!("activity-row-{id}").into()))
206 .group(group.clone())
203 .mx(px(6.))
207 .mx(px(6.))
204 .px(px(6.))
208 .px(px(6.))
205 .py(px(8.))
209 .py(px(8.))
@@ -253,24 +257,64 @@ impl ActivityPanel {
253 v_flex()
257 v_flex()
254 .flex_none()
258 .flex_none()
255 .items_end()
259 .items_end()
256 .gap(px(6.))
260 .gap(px(2.))
257 .child(
261 .child(
258 div()
262 div()
259 .text_size(px(11.))
263 .text_size(px(11.))
260 .text_color(theme::text_muted())
264 .text_color(theme::text_muted())
261 .child(format::list_time_label(entry.updated_at, today, offset)),
265 .child(format::list_time_label(entry.updated_at, today, offset)),
262 )
266 )
263 .child(if unread {
267 .child(status_slot(id, unread, group, activity)),
264 dot(8.)
265 } else {
266 div().size(px(8.)).flex_none()
267 }),
268 )
268 )
269 .on_click(move |_, _, cx| panel.update(cx, |this, cx| this.open(id, cx)))
269 .on_click(move |_, _, cx| panel.update(cx, |this, cx| this.open(id, cx)))
270 .into_any_element()
270 .into_any_element()
271 }
271 }
272}
272}
273
273
274fn status_slot(
275 id: i64,
276 unread: bool,
277 group: SharedString,
278 activity: Entity<ActivityCenter>,
279) -> Div {
280 let slot = div()
281 .h(px(MARK_READ_SIZE))
282 .flex()
283 .flex_none()
284 .items_center()
285 .justify_end();
286 if !unread {
287 return slot;
288 }
289 slot.child(
290 div()
291 .flex()
292 .group_hover(group.clone(), |wrapper| wrapper.hidden())
293 .child(dot(8.)),
294 )
295 .child(
296 div()
297 .id(ElementId::Name(format!("activity-mark-read-{id}").into()))
298 .hidden()
299 .group_hover(group, |button| button.flex())
300 .size(px(MARK_READ_SIZE))
301 .flex_none()
302 .items_center()
303 .justify_center()
304 .rounded(px(6.))
305 .border_1()
306 .border_color(theme::border_strong())
307 .bg(theme::surface_raised())
308 .cursor_pointer()
309 .child(icon(IconName::Check, 14., theme::text()))
310 .tooltip(|window, cx| Tooltip::new("Mark as read").build(window, cx))
311 .on_click(move |_, _, cx| {
312 cx.stop_propagation();
313 activity.update(cx, |activity, cx| activity.mark_read(id, cx));
314 }),
315 )
316}
317
274fn kind_marker(entry: &Entry) -> Div {
318fn kind_marker(entry: &Entry) -> Div {
275 let marker = div()
319 let marker = div()
276 .absolute()
320 .absolute()