fix: root label not applied for non-root dirs

fix breadcrumb root label not correctly displayed when breadcrumb is
displaying path for non-root dirs
This commit is contained in:
2025-10-05 00:54:22 +00:00
parent b43a88c6fc
commit 9149243e95

View File

@@ -30,7 +30,10 @@ export function FilePathBreadcrumb({ rootLabel }: { rootLabel: string }) {
breadcrumbItems.push(
<Fragment key={directory.path[i]?.handle.id}>
<BreadcrumbSeparator />
<FilePathBreadcrumbItem component={directory.path[i]!} />
<FilePathBreadcrumbItem
component={directory.path[i]!}
rootLabel={rootLabel}
/>
</Fragment>,
)
}
@@ -43,7 +46,10 @@ export function FilePathBreadcrumb({ rootLabel }: { rootLabel: string }) {
<BreadcrumbPage>{rootLabel}</BreadcrumbPage>
</BreadcrumbItem>
) : (
<FilePathBreadcrumbItem component={directory.path[0]!} />
<FilePathBreadcrumbItem
component={directory.path[0]!}
rootLabel={rootLabel}
/>
)}
{breadcrumbItems}
<BreadcrumbSeparator />
@@ -55,13 +61,19 @@ export function FilePathBreadcrumb({ rootLabel }: { rootLabel: string }) {
)
}
function FilePathBreadcrumbItem({ component }: { component: PathComponent }) {
function FilePathBreadcrumbItem({
component,
rootLabel,
}: {
component: PathComponent
rootLabel: string
}) {
const { isDraggedOver, dropHandlers } = useFileDrop({
destItem: component.handle as DirectoryHandle,
dragInfoAtom,
})
const dirName = component.name || "All Files"
const dirName = component.name || rootLabel
return (
<Tooltip open={isDraggedOver}>