Refine project panel styling
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::{project::Project, theme, Settings};
|
||||
use gpui::{
|
||||
action,
|
||||
elements::{Label, MouseEventHandler, UniformList, UniformListState},
|
||||
platform::CursorStyle,
|
||||
Element, ElementBox, Entity, ModelHandle, MutableAppContext, ReadModel, View, ViewContext,
|
||||
WeakViewHandle,
|
||||
};
|
||||
@@ -165,10 +166,16 @@ impl ProjectPanel {
|
||||
MouseEventHandler::new::<Self, _, _, _>(
|
||||
(entry.worktree_ix, entry.entry_id),
|
||||
cx,
|
||||
|state, cx| {
|
||||
Label::new(details.filename, theme.entry.clone())
|
||||
|state, _| {
|
||||
let style = if state.hovered {
|
||||
&theme.hovered_entry
|
||||
} else {
|
||||
&theme.entry
|
||||
};
|
||||
Label::new(details.filename, style.text.clone())
|
||||
.contained()
|
||||
.with_margin_left(details.depth as f32 * 20.)
|
||||
.with_style(style.container)
|
||||
.with_padding_left(theme.entry_base_padding + details.depth as f32 * 20.)
|
||||
.boxed()
|
||||
},
|
||||
)
|
||||
@@ -179,6 +186,7 @@ impl ProjectPanel {
|
||||
cx.dispatch_action(Open(entry))
|
||||
}
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -111,7 +111,9 @@ pub struct ChatPanel {
|
||||
pub struct ProjectPanel {
|
||||
#[serde(flatten)]
|
||||
pub container: ContainerStyle,
|
||||
pub entry: TextStyle,
|
||||
pub entry_base_padding: f32,
|
||||
pub entry: ContainedText,
|
||||
pub hovered_entry: ContainedText,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
||||
+5
-4
@@ -1592,7 +1592,6 @@ impl Snapshot {
|
||||
}
|
||||
|
||||
fn insert_entry(&mut self, mut entry: Entry, fs: &dyn Fs) -> Entry {
|
||||
println!("insert entry {:?}", entry.path);
|
||||
if !entry.is_dir() && entry.path.file_name() == Some(&GITIGNORE) {
|
||||
let abs_path = self.abs_path.join(&entry.path);
|
||||
match build_gitignore(&abs_path, fs) {
|
||||
@@ -1665,10 +1664,8 @@ impl Snapshot {
|
||||
|
||||
fn reuse_entry_id(&mut self, entry: &mut Entry) {
|
||||
if let Some(removed_entry_id) = self.removed_entry_ids.remove(&entry.inode) {
|
||||
log::info!("reusing removed entry id {}", removed_entry_id);
|
||||
entry.id = removed_entry_id;
|
||||
} else if let Some(existing_entry) = self.entry_for_path(&entry.path) {
|
||||
log::info!("reusing removed entry id {}", existing_entry.id);
|
||||
entry.id = existing_entry.id;
|
||||
}
|
||||
}
|
||||
@@ -2234,7 +2231,11 @@ impl BackgroundScanner {
|
||||
new_ignore = Some(ignore);
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("error loading .gitignore file {:?} - {:?}", child_name, error);
|
||||
log::error!(
|
||||
"error loading .gitignore file {:?} - {:?}",
|
||||
child_name,
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user