Upgrade Iced and render Markdown tables
This commit is contained in:
@@ -16,9 +16,8 @@ use crate::model::{
|
||||
use crate::settings::{GIB, REASONING_MODES};
|
||||
use iced::theme::{Palette, palette};
|
||||
use iced::widget::{
|
||||
Button, Space, Svg, Tooltip, button, checkbox, column, container, horizontal_rule, markdown,
|
||||
mouse_area, opaque, pick_list, progress_bar, row, scrollable, stack, svg, text, text_input,
|
||||
tooltip,
|
||||
Button, Space, Svg, Tooltip, button, checkbox, column, container, markdown, mouse_area, opaque,
|
||||
pick_list, progress_bar, row, rule, scrollable, stack, svg, text, text_input, tooltip,
|
||||
};
|
||||
use iced::{Alignment, Background, Border, Color, Element, Length, Padding, Theme, window};
|
||||
use std::collections::VecDeque;
|
||||
@@ -87,7 +86,7 @@ impl App {
|
||||
body = body.push(self.sidebar());
|
||||
body = body.push(
|
||||
mouse_area(
|
||||
container(Space::with_width(Length::Fill))
|
||||
container(Space::new().width(Length::Fill))
|
||||
.width(5)
|
||||
.height(Length::Fill)
|
||||
.style(divider_style),
|
||||
@@ -107,7 +106,7 @@ impl App {
|
||||
// way to the top edge; the spacer below it lets clicks through.
|
||||
let mut shell = column![stack![
|
||||
body,
|
||||
column![self.title_bar(), Space::with_height(Length::Fill)],
|
||||
column![self.title_bar(), Space::new().height(Length::Fill)],
|
||||
]];
|
||||
if let ModelDownload::Active(download) = &self.model_download {
|
||||
shell = shell.push(download_status_bar(download));
|
||||
@@ -163,7 +162,7 @@ impl App {
|
||||
text("Working directory").size(11).color(muted_text()),
|
||||
text(prompt.working_directory.display().to_string()).size(13),
|
||||
row![
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
action_button("Deny").on_press(Message::DenyTool),
|
||||
action_button("Allow once").on_press(Message::AllowToolOnce),
|
||||
]
|
||||
@@ -188,7 +187,7 @@ impl App {
|
||||
let preference_content = row![
|
||||
icon(ICON_SETTINGS, 17),
|
||||
text("Preferences").size(14),
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
text("⌘,").size(12),
|
||||
]
|
||||
.spacing(9)
|
||||
@@ -212,14 +211,14 @@ impl App {
|
||||
};
|
||||
let header = row![
|
||||
text("DS4Server").size(20),
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
text("Local").size(12),
|
||||
]
|
||||
.align_y(Alignment::Center);
|
||||
let mut projects = column![
|
||||
row![
|
||||
text("PROJECTS").size(11),
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
text("LOCAL").size(10),
|
||||
],
|
||||
add_project.style(button::text),
|
||||
@@ -275,7 +274,7 @@ impl App {
|
||||
let expanded = self.expanded_archives.contains(&project.id);
|
||||
projects = projects.push(
|
||||
row![
|
||||
Space::with_width(26),
|
||||
Space::new().width(26),
|
||||
button(
|
||||
text(format!(
|
||||
"{} Archived sessions ({})",
|
||||
@@ -302,7 +301,7 @@ impl App {
|
||||
let draft_selected = self.draft_selected(project.id);
|
||||
projects = projects.push(
|
||||
row![
|
||||
Space::with_width(26),
|
||||
Space::new().width(26),
|
||||
button(
|
||||
row![
|
||||
icon(ICON_CHAT, 15),
|
||||
@@ -363,7 +362,7 @@ impl App {
|
||||
}
|
||||
label = label.push(text(&session.title).size(13));
|
||||
row![
|
||||
Space::with_width(26),
|
||||
Space::new().width(26),
|
||||
button(label)
|
||||
.width(Length::Fill)
|
||||
.on_press(Message::SelectSession(project_id, session.id))
|
||||
@@ -404,12 +403,12 @@ impl App {
|
||||
};
|
||||
stack![
|
||||
row![
|
||||
Space::with_width(detail_offset),
|
||||
Space::new().width(detail_offset),
|
||||
container(self.detail_tabs())
|
||||
.center_x(Length::Fill)
|
||||
.center_y(Length::Fill),
|
||||
],
|
||||
container(row![Space::with_width(TRAFFIC_LIGHT_WIDTH), toggle]).center_y(Length::Fill),
|
||||
container(row![Space::new().width(TRAFFIC_LIGHT_WIDTH), toggle]).center_y(Length::Fill),
|
||||
]
|
||||
.width(Length::Fill)
|
||||
.height(TITLE_BAR_HEIGHT)
|
||||
@@ -463,7 +462,7 @@ impl App {
|
||||
.on_submit(Message::ConfirmProject)
|
||||
.padding(10),
|
||||
row![
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
action_button("Cancel").on_press(Message::CancelProject),
|
||||
action_button("Add project").on_press(Message::ConfirmProject),
|
||||
]
|
||||
@@ -547,7 +546,7 @@ impl App {
|
||||
.color(muted_text()),
|
||||
actions,
|
||||
row![
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
action_button("Close").on_press(Message::DismissPanel),
|
||||
],
|
||||
]
|
||||
@@ -576,7 +575,7 @@ impl App {
|
||||
.on_submit(Message::ConfirmRenameSession)
|
||||
.padding(10),
|
||||
row![
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
action_button("Cancel").on_press(Message::DismissPanel),
|
||||
action_button("Rename").on_press(Message::ConfirmRenameSession),
|
||||
]
|
||||
@@ -668,9 +667,10 @@ pub(crate) fn app_theme() -> Theme {
|
||||
text: Color::from_rgb8(235, 235, 235),
|
||||
primary: Color::from_rgb8(85, 118, 255),
|
||||
success: Color::from_rgb8(72, 176, 112),
|
||||
warning: Color::from_rgb8(224, 168, 72),
|
||||
danger: Color::from_rgb8(220, 80, 86),
|
||||
};
|
||||
Theme::custom_with_fn("DS4Server".into(), palette, |palette| {
|
||||
Theme::custom_with_fn("DS4Server", palette, |palette| {
|
||||
let mut extended = palette::Extended::generate(palette);
|
||||
extended.background.weak = palette::Pair::new(Color::from_rgb8(38, 38, 40), palette.text);
|
||||
extended.background.strong = palette::Pair::new(Color::from_rgb8(58, 58, 61), palette.text);
|
||||
@@ -714,7 +714,7 @@ fn metric_card(label: &'static str, value: String, detail: String) -> Element<'s
|
||||
fn metric_row(label: &'static str, value: impl ToString) -> Element<'static, Message> {
|
||||
row![
|
||||
text(label).size(12).color(muted_text()),
|
||||
Space::with_width(Length::Fill),
|
||||
Space::new().width(Length::Fill),
|
||||
text(value.to_string()).size(12),
|
||||
]
|
||||
.spacing(12)
|
||||
@@ -750,7 +750,7 @@ fn mini_chart(
|
||||
1.0
|
||||
};
|
||||
bars = bars.push(
|
||||
container(Space::new(Length::Fill, height))
|
||||
container(Space::new().width(Length::Fill).height(height))
|
||||
.width(Length::FillPortion(1))
|
||||
.style(move |_| chart_bar_style(color)),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user