gui: one incoming-change banner component for Notes and the podcast queue

notes' render_incoming_body_banner and the queue's render_incoming_banner were
the same strip (icon, copy::incoming_change sentence, take/keep buttons) with
different ids and handlers. components::incoming_banner is that strip once —
the desktop counterpart of Android's ui/IncomingBodyStrip. Render-identical.
Clippings keeps its in-card column variant (a layout decision, see handoff).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Greg ShuflinandClaude Opus 5.5 committed 2026-09-28 14:28:09 -07:00
1 parent 11eeca1334
commit e8a7b566f1
4 files changed
+74 -98

No files matched your search

+8 -48
View File
@@ -55,6 +55,7 @@ use crate::components::button::{button, icon_button};
use crate::components::hierarchical_sidebar::{
HierarchicalSidebar, TreeEvent, TreeNode, TreeStyle,
};
use crate::components::incoming_banner::incoming_banner;
use crate::components::markup_view::{
ImageContext, ImageState, LinkContext, MathContext, ScrollRegion, markup_view,
};
@@ -1817,54 +1818,13 @@ impl NotesView {
cx: &mut Context<Self>,
) -> Option<impl IntoElement + use<>> {
self.incoming_body.as_ref()?;
Some(
div()
.flex_none()
.flex()
.flex_row()
.items_center()
.gap_3()
.h(control::ROW_LG)
.px_4()
.border_b_1()
.border_color(theme.border_default)
.bg(theme.bg_card)
.child(
gpui::svg()
.path(Icon::ArrowDownUp.path())
.size(icon::SM)
.flex_none()
.text_color(theme.accent),
)
.child(
div()
.flex_1()
.min_w(px(0.))
.text_size(font::SMALL)
.text_color(theme.text_secondary)
.child(incoming_change::Subject::NoteBody.banner()),
)
.child(
button(
theme,
"notes-load-incoming-body",
incoming_change::Subject::NoteBody.take_theirs(),
false,
true,
)
.on_click(cx.listener(|this, _, _, cx| this.load_incoming_body(cx))),
)
.child(
button(
theme,
"notes-keep-local-body",
incoming_change::Subject::NoteBody.keep_mine(),
false,
true,
)
.on_click(cx.listener(|this, _, _, cx| this.keep_local_body(cx))),
),
)
Some(incoming_banner(
theme,
incoming_change::Subject::NoteBody,
("notes-load-incoming-body", "notes-keep-local-body"),
cx.listener(|this, _, _, cx| this.load_incoming_body(cx)),
cx.listener(|this, _, _, cx| this.keep_local_body(cx)),
))
}
/// Format dropdown (§6): Markdown / Typst / Plain text, reusing the same
+9 -50
View File
@@ -25,14 +25,14 @@ use synchronicity::stores::Store;
use crate::agent_sidebar::{AgentSidebar, View};
use crate::agents::podcasts::cover_art;
use crate::agents::podcasts::episode_audio_source;
use crate::assets::Icon;
use crate::background::spawn_then;
use crate::components::button::button;
use crate::components::incoming_banner::incoming_banner;
use crate::components::note::note;
use crate::components::player_controls::{Adjacency, NowPlaying, PlayerControls, TrackArt};
use crate::components::sync_guarded::SyncGuarded;
use crate::sizing::layout::CONTENT_MAX_WIDTH;
use crate::sizing::{control, font, icon, shape};
use crate::sizing::{font, shape};
use crate::store_watch;
use crate::theme::{ActiveTheme, Theme};
@@ -259,54 +259,13 @@ impl PodcastQueueView {
cx: &mut Context<Self>,
) -> Option<impl IntoElement + use<>> {
self.entries.incoming()?;
Some(
div()
.flex_none()
.flex()
.flex_row()
.items_center()
.gap_3()
.h(control::ROW_LG)
.px_4()
.border_b_1()
.border_color(theme.border_default)
.bg(theme.bg_card)
.child(
gpui::svg()
.path(Icon::ArrowDownUp.path())
.size(icon::SM)
.flex_none()
.text_color(theme.accent),
)
.child(
div()
.flex_1()
.min_w(px(0.))
.text_size(font::SMALL)
.text_color(theme.text_secondary)
.child(incoming_change::Subject::PodcastQueue.banner()),
)
.child(
button(
theme,
"queue-load-incoming",
incoming_change::Subject::PodcastQueue.take_theirs(),
false,
true,
)
.on_click(cx.listener(|this, _, _, cx| this.load_incoming(cx))),
)
.child(
button(
theme,
"queue-dismiss-incoming",
incoming_change::Subject::PodcastQueue.keep_mine(),
false,
true,
)
.on_click(cx.listener(|this, _, _, cx| this.dismiss_incoming(cx))),
),
)
Some(incoming_banner(
theme,
incoming_change::Subject::PodcastQueue,
("queue-load-incoming", "queue-dismiss-incoming"),
cx.listener(|this, _, _, cx| this.load_incoming(cx)),
cx.listener(|this, _, _, cx| this.dismiss_incoming(cx)),
))
}
fn render_content(&self, theme: &Theme, cx: &mut Context<Self>) -> impl IntoElement + use<> {
@@ -0,0 +1,56 @@
//! The alert-don't-apply strip over something the user is in, when a newer
//! version of it arrived from another node: an icon, what happened and what is
//! being held, and the two choices — take theirs, keep mine.
//!
//! The desktop counterpart of Android's `ui/IncomingBodyStrip`. The words are
//! `copy::incoming_change`'s, named by [`Subject`]; a screen supplies only
//! what each choice does. See CLAUDE.md's first design principle, and
//! [`SyncGuarded`](super::sync_guarded::SyncGuarded) for the state it is
//! usually drawn over.
use gpui::{App, ClickEvent, Div, Window, div, prelude::*, px, svg};
use synchronicity::copy::incoming_change::Subject;
use crate::assets::Icon;
use crate::components::button::button;
use crate::sizing::{control, font, icon};
use crate::theme::Theme;
/// A full-width strip under a screen's header. `ids` are the take and keep
/// buttons' element ids.
pub fn incoming_banner(
theme: &Theme,
subject: Subject,
ids: (&'static str, &'static str),
on_take: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
on_keep: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> Div {
div()
.flex_none()
.flex()
.flex_row()
.items_center()
.gap_3()
.h(control::ROW_LG)
.px_4()
.border_b_1()
.border_color(theme.border_default)
.bg(theme.bg_card)
.child(
svg()
.path(Icon::ArrowDownUp.path())
.size(icon::SM)
.flex_none()
.text_color(theme.accent),
)
.child(
div()
.flex_1()
.min_w(px(0.))
.text_size(font::SMALL)
.text_color(theme.text_secondary)
.child(subject.banner()),
)
.child(button(theme, ids.0, subject.take_theirs(), false, true).on_click(on_take))
.child(button(theme, ids.1, subject.keep_mine(), false, true).on_click(on_keep))
}
+1
View File
@@ -13,6 +13,7 @@ pub mod hierarchical_sidebar;
pub mod import_prompt;
pub mod import_trigger;
pub mod imports_in_progress;
pub mod incoming_banner;
pub mod markup_view;
pub mod media_library;
pub mod media_session;