fix(folder-picker): address QoL issues from PR review
- Fix chevron tooltip: was "Open folder" in both branches; now shows "No subfolders" when the entry has no children (consistent with the existing opacity-45 visual cue on the same chevron icon) - Fix Unix breadcrumb root label: was always "Home" even for non-home paths like /mnt/data — now labelled "/" which is always accurate - Fix partial-failure staging: on a mixed add result, successfully-added entries are now removed from the staging panel so only genuinely failed folders remain for the user to retry (index-pairing is safe because the backend returns results in input order via a preserved .map())
This commit is contained in:
@@ -36,7 +36,7 @@ function buildBreadcrumbs(path: string | null): { label: string; path: string |
|
|||||||
const parts = normalized.split(/[\\/]+/).filter(Boolean);
|
const parts = normalized.split(/[\\/]+/).filter(Boolean);
|
||||||
let current = separator === "/" ? "" : "";
|
let current = separator === "/" ? "" : "";
|
||||||
return [
|
return [
|
||||||
{ label: "Home", path: null },
|
{ label: "/", path: null },
|
||||||
...parts.map((part) => {
|
...parts.map((part) => {
|
||||||
current = `${current}/${part}`;
|
current = `${current}/${part}`;
|
||||||
return { label: part, path: current };
|
return { label: part, path: current };
|
||||||
@@ -117,7 +117,7 @@ function FolderRow({
|
|||||||
type="button"
|
type="button"
|
||||||
className="rounded-md p-1 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-white light-theme:hover:bg-gray-900 light-theme:hover:text-white"
|
className="rounded-md p-1 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-white light-theme:hover:bg-gray-900 light-theme:hover:text-white"
|
||||||
onClick={onNavigate}
|
onClick={onNavigate}
|
||||||
title={entry.has_children ? "Open folder" : "Open folder"}
|
title={entry.has_children ? "Open folder" : "No subfolders"}
|
||||||
>
|
>
|
||||||
<svg className={`h-4 w-4 ${entry.has_children ? "" : "opacity-45"}`} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
<svg className={`h-4 w-4 ${entry.has_children ? "" : "opacity-45"}`} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||||
@@ -300,6 +300,7 @@ export function FolderPickerModal() {
|
|||||||
const failed = addResults.filter((result) => result.status === "error");
|
const failed = addResults.filter((result) => result.status === "error");
|
||||||
setResults(addResults);
|
setResults(addResults);
|
||||||
if (failed.length > 0) {
|
if (failed.length > 0) {
|
||||||
|
setStagedPaths(stagedPaths.filter((_, i) => addResults[i]?.status === "error"));
|
||||||
setError(failed.map((failure) => failure.data).join("; "));
|
setError(failed.map((failure) => failure.data).join("; "));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user