Sidebar polish: search copy, dividers, project reorder, fix DnD (#8568)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -384,6 +384,20 @@ pub fn delete_project(id: String) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn reorder_projects(order: Vec<(String, i32)>) -> Result<(), String> {
|
||||
for (id, new_order) in order {
|
||||
let (dir, mut stored) = find_project_by_id(&id)?;
|
||||
stored.order = new_order;
|
||||
let project_path = dir.join("project.json");
|
||||
let json = serde_json::to_string_pretty(&stored)
|
||||
.map_err(|e| format!("Failed to serialize project: {}", e))?;
|
||||
fs::write(&project_path, json)
|
||||
.map_err(|e| format!("Failed to write project.json: {}", e))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_project(id: String) -> Result<ProjectInfo, String> {
|
||||
let (dir, info) = find_project_by_id(&id)?;
|
||||
|
||||
@@ -73,6 +73,7 @@ pub fn run() {
|
||||
commands::projects::update_project,
|
||||
commands::projects::delete_project,
|
||||
commands::projects::get_project,
|
||||
commands::projects::reorder_projects,
|
||||
commands::projects::list_archived_projects,
|
||||
commands::projects::archive_project,
|
||||
commands::projects::restore_project,
|
||||
|
||||
Reference in New Issue
Block a user