fix: better sidebar layout

This commit is contained in:
Georg Bauer
2026-07-28 19:40:31 +02:00
parent eaa2fcfe42
commit 1f028950b3
2 changed files with 21 additions and 16 deletions

View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none" stroke="#fff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<path d="M2.75 6V5.75A1.75 1.75 0 0 1 4.5 4h3l1.7 1.75h6.3A1.75 1.75 0 0 1 17.25 7.5v.5"/>
<path d="M3.75 8h13.5a1 1 0 0 1 .95 1.3l-1.65 5.1A2.25 2.25 0 0 1 14.4 16H5.25a2.25 2.25 0 0 1-2.2-1.8L2 9.75A1.43 1.43 0 0 1 3.4 8z"/>
</svg>

After

Width:  |  Height:  |  Size: 391 B

View File

@@ -29,6 +29,7 @@ use std::collections::VecDeque;
use std::path::Path; use std::path::Path;
const ICON_FOLDER: &[u8] = include_bytes!("../../assets/icons/folder.svg"); const ICON_FOLDER: &[u8] = include_bytes!("../../assets/icons/folder.svg");
const ICON_FOLDER_OPEN: &[u8] = include_bytes!("../../assets/icons/folder-open.svg");
const ICON_FOLDER_PLUS: &[u8] = include_bytes!("../../assets/icons/folder-plus.svg"); const ICON_FOLDER_PLUS: &[u8] = include_bytes!("../../assets/icons/folder-plus.svg");
const ICON_NEW_SESSION: &[u8] = include_bytes!("../../assets/icons/new-session.svg"); const ICON_NEW_SESSION: &[u8] = include_bytes!("../../assets/icons/new-session.svg");
const ICON_SETTINGS: &[u8] = include_bytes!("../../assets/icons/settings.svg"); const ICON_SETTINGS: &[u8] = include_bytes!("../../assets/icons/settings.svg");
@@ -52,11 +53,9 @@ const TITLE_BAR_HEIGHT: f32 = 30.0;
const TITLE_BAR_CONTROL: f32 = 24.0; const TITLE_BAR_CONTROL: f32 = 24.0;
/// Space the macOS traffic lights need before our own controls start. /// Space the macOS traffic lights need before our own controls start.
const TRAFFIC_LIGHT_WIDTH: f32 = 78.0; const TRAFFIC_LIGHT_WIDTH: f32 = 78.0;
const PROJECT_DISCLOSURE_WIDTH: f32 = 12.0;
const PROJECT_ICON_WIDTH: u16 = 17; const PROJECT_ICON_WIDTH: u16 = 17;
const PROJECT_LABEL_SPACING: f32 = 9.0; const PROJECT_LABEL_SPACING: f32 = 9.0;
const SESSION_INDENT: f32 = const SESSION_INDENT: f32 = PROJECT_ICON_WIDTH as f32 + PROJECT_LABEL_SPACING;
PROJECT_DISCLOSURE_WIDTH + PROJECT_ICON_WIDTH as f32 + PROJECT_LABEL_SPACING * 2.0;
impl App { impl App {
pub(crate) fn view(&self, id: window::Id) -> Element<'_, Message> { pub(crate) fn view(&self, id: window::Id) -> Element<'_, Message> {
@@ -332,10 +331,14 @@ impl App {
row![ row![
button( button(
row![ row![
text(if project.collapsed { "" } else { "" }) icon(
.size(12) if project.collapsed {
.width(PROJECT_DISCLOSURE_WIDTH), ICON_FOLDER
icon(ICON_FOLDER, PROJECT_ICON_WIDTH), } else {
ICON_FOLDER_OPEN
},
PROJECT_ICON_WIDTH,
),
text(&project.name).size(14) text(&project.name).size(14)
] ]
.spacing(PROJECT_LABEL_SPACING) .spacing(PROJECT_LABEL_SPACING)
@@ -376,7 +379,6 @@ impl App {
.on_press(Message::DiscardSession(project.id)) .on_press(Message::DiscardSession(project.id))
.style(button::text), .style(button::text),
] ]
.spacing(3)
.align_y(Alignment::Center), .align_y(Alignment::Center),
); );
} }
@@ -398,14 +400,14 @@ impl App {
let expanded = self.expanded_archives.contains(&project.id); let expanded = self.expanded_archives.contains(&project.id);
projects = projects.push( projects = projects.push(
row![ row![
Space::new().width(26), Space::new().width(SESSION_INDENT),
button( button(
text(format!( text(if expanded {
"{} Archived sessions ({})", "Hide archived sessions"
if expanded { "" } else { "" }, } else {
archived.len() "Show archived sessions"
)) })
.size(12) .size(13)
.color(muted_text()), .color(muted_text()),
) )
.width(Length::Fill) .width(Length::Fill)
@@ -472,7 +474,6 @@ impl App {
.on_press(Message::RequestDeleteSession(session.id)) .on_press(Message::RequestDeleteSession(session.id))
.style(button::text), .style(button::text),
] ]
.spacing(3)
.align_y(Alignment::Center) .align_y(Alignment::Center)
.into() .into()
} }