ui improvements and feature flags for AI integration
Continuous integration / build (push) Failing after 4m9s
Continuous integration / build (push) Failing after 4m9s
This commit is contained in:
+17
-19
@@ -1,4 +1,7 @@
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
use itertools::Itertools;
|
||||
use std::fs::{self, DirEntry};
|
||||
|
||||
// use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
use crate::{
|
||||
PROJECT_FOLDER, RightPanelContent,
|
||||
@@ -249,24 +252,22 @@ impl Explorer {
|
||||
});
|
||||
})
|
||||
.body(|ui| {
|
||||
let entries: Vec<_> = WalkDir::new(PROJECT_FOLDER.join("assets"))
|
||||
.min_depth(1)
|
||||
.max_depth(1) // Only immediate children
|
||||
.sort_by(|a, b| {
|
||||
let entries = fs::read_dir(PROJECT_FOLDER.join("assets"))
|
||||
.unwrap()
|
||||
.filter_map(Result::ok)
|
||||
.sorted_by(|a, b| {
|
||||
// Directories first, then files
|
||||
let a_is_dir = a.file_type().is_dir();
|
||||
let b_is_dir = b.file_type().is_dir();
|
||||
let a_is_dir = a.file_type().unwrap().is_dir();
|
||||
let b_is_dir = b.file_type().unwrap().is_dir();
|
||||
if a_is_dir == b_is_dir {
|
||||
a.file_name().cmp(b.file_name())
|
||||
a.file_name().cmp(&b.file_name())
|
||||
} else if a_is_dir {
|
||||
std::cmp::Ordering::Less
|
||||
} else {
|
||||
std::cmp::Ordering::Greater
|
||||
}
|
||||
})
|
||||
.into_iter()
|
||||
.filter_map(Result::ok)
|
||||
.collect();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for entry in entries {
|
||||
Self::render_entry(ui, to_load, &entry);
|
||||
@@ -275,19 +276,16 @@ impl Explorer {
|
||||
}
|
||||
|
||||
fn render_entry(ui: &mut egui::Ui, to_load: &mut Option<RightPanelContent>, entry: &DirEntry) {
|
||||
let file_type = entry.file_type();
|
||||
let file_type = entry.file_type().unwrap();
|
||||
let is_dir = file_type.is_dir();
|
||||
let file_name = entry.file_name().to_string_lossy();
|
||||
let file_name = entry.file_name().to_str().unwrap().to_string();
|
||||
let path = entry.path();
|
||||
|
||||
if is_dir {
|
||||
let entries: Vec<_> = WalkDir::new(path)
|
||||
.min_depth(1)
|
||||
.max_depth(1)
|
||||
.sort_by(|a, b| a.file_name().cmp(b.file_name()))
|
||||
.into_iter()
|
||||
let entries = fs::read_dir(path)
|
||||
.unwrap()
|
||||
.filter_map(Result::ok)
|
||||
.collect();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
egui::collapsing_header::CollapsingState::load_with_default_open(
|
||||
ui.ctx(),
|
||||
|
||||
Reference in New Issue
Block a user