various: simplify code; work on security and performance

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I9a5114addcab5fbff430ab2b919b83466a6a6964
This commit is contained in:
raf 2026-02-02 17:32:11 +03:00
commit c4adc4e3e0
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
75 changed files with 12921 additions and 358 deletions

View file

@ -22,6 +22,7 @@ pub fn Import(
preview_files: Vec<DirectoryPreviewFile>,
preview_total_size: u64,
scan_progress: Option<ScanStatusResponse>,
#[props(default = false)] is_importing: bool,
) -> Element {
let mut import_mode = use_signal(|| 0usize);
let mut file_path = use_signal(String::new);
@ -44,6 +45,19 @@ pub fn Import(
let current_mode = *import_mode.read();
rsx! {
// Import status panel (shown when import is in progress)
if is_importing {
div { class: "import-status-panel",
div { class: "import-status-header",
div { class: "status-dot checking" }
span { "Import in progress..." }
}
div { class: "progress-bar",
div { class: "progress-fill indeterminate" }
}
}
}
// Tab bar
div { class: "import-tabs",
button {
@ -114,6 +128,7 @@ pub fn Import(
}
button {
class: "btn btn-primary",
disabled: is_importing,
onclick: {
let mut file_path = file_path;
let mut selected_tags = selected_tags;
@ -133,7 +148,7 @@ pub fn Import(
}
}
},
"Import"
if is_importing { "Importing..." } else { "Import" }
}
}
}
@ -494,7 +509,7 @@ pub fn Import(
rsx! {
button {
class: "btn btn-primary",
disabled: !has_selected,
disabled: !has_selected || is_importing,
onclick: {
let mut selected_file_paths = selected_file_paths;
let mut selected_tags = selected_tags;
@ -514,7 +529,9 @@ pub fn Import(
}
}
},
if has_selected {
if is_importing {
"Importing..."
} else if has_selected {
"Import Selected ({sel_count})"
} else {
"Import Selected"
@ -526,6 +543,7 @@ pub fn Import(
// Import entire directory
button {
class: "btn btn-secondary",
disabled: is_importing,
onclick: {
let mut dir_path = dir_path;
let mut selected_tags = selected_tags;
@ -547,7 +565,7 @@ pub fn Import(
}
}
},
"Import Entire Directory"
if is_importing { "Importing..." } else { "Import Entire Directory" }
}
}
}
@ -569,8 +587,9 @@ pub fn Import(
div { class: "mb-16", style: "text-align: center;",
button {
class: "btn btn-primary",
disabled: is_importing,
onclick: move |_| on_scan.call(()),
"Scan All Roots"
if is_importing { "Scanning..." } else { "Scan All Roots" }
}
}