feat: more native menus with expected reactions

This commit is contained in:
Georg Bauer
2026-07-27 15:09:12 +02:00
parent 8f02f0934b
commit c96675c462
11 changed files with 738 additions and 70 deletions

View File

@@ -55,7 +55,6 @@ impl App {
.spacing(8),
);
} else {
let markdown_style = markdown::Style::from_palette(app_theme().palette());
for (index, message) in self.conversation.iter().enumerate() {
if message.compaction {
messages = messages.push(
@@ -124,22 +123,17 @@ impl App {
}
}
if !message.content.is_empty() {
if message.user || message.tool || message.markdown.items().is_empty() {
let content = if message.reasoning.is_some() {
crate::agent::visible_content(&message.content).trim_start()
} else {
crate::agent::visible_content(&message.content)
};
body = body.push(text(content).size(14));
} else {
body = body.push(
markdown::view(
message.markdown.items(),
markdown::Settings::with_text_size(14, markdown_style),
)
.map(Message::OpenLink),
);
}
body = body.push(
text_editor(&message.transcript)
.id(iced::widget::Id::from(format!(
"transcript-{}-{index}",
message.id
)))
.on_action(move |action| Message::TranscriptAction(index, action))
.padding(0)
.size(14)
.style(selectable_text_style),
);
} else if active && message.reasoning.is_none() {
body = body.push(
text(self.activity.as_deref().unwrap_or("Loading model…")).size(14),
@@ -292,6 +286,20 @@ impl App {
.spacing(6)
.align_y(Alignment::Center),
);
if let Some(notice) = &self.context_notice {
messages = messages.push(
container(
column![
text("Context rebuild").size(11),
text(notice).size(13).color(muted_text()),
]
.spacing(5),
)
.padding(14)
.width(Length::Fill)
.style(preference_group_style),
);
}
let transcript = scrollable(messages)
.id(chat_scroll_id())
.height(Length::Fill);
@@ -337,6 +345,19 @@ impl App {
}
}
fn selectable_text_style(
theme: &Theme,
_status: iced::widget::text_editor::Status,
) -> iced::widget::text_editor::Style {
iced::widget::text_editor::Style {
background: Background::Color(Color::TRANSPARENT),
border: Border::default(),
placeholder: muted_text(),
value: theme.palette().text,
selection: theme.extended_palette().primary.weak.color,
}
}
fn generation_summary(stats: crate::app::generation::GenerationStats) -> Element<'static, Message> {
column![
row![