diff --git a/components/entry/entry.tsx b/components/entry/entry.tsx index c6ec96b94..de4574c56 100644 --- a/components/entry/entry.tsx +++ b/components/entry/entry.tsx @@ -502,6 +502,19 @@ export function Entry({ const rootLabel = schema.label || schema.name || name; if (!path) { + const rootPath = normalizePath(schema.path); + const parentPath = parent ? normalizePath(parent) : null; + const relativePath = parentPath ? getRelativePath(parentPath, rootPath) : null; + const segments = relativePath ? relativePath.split("/").filter(Boolean) : []; + + const parentEntries = segments.map((segment, index) => ({ + name: segment, + path: joinPathSegments([rootPath, segments.slice(0, index + 1).join("/")]), + })); + + const immediateParent = parentEntries.length > 0 ? parentEntries[parentEntries.length - 1] : null; + const middleEntries = parentEntries.length > 1 ? parentEntries.slice(0, -1) : []; + return ( <> {groupTrail.map((group) => ( @@ -520,6 +533,43 @@ export function Entry({ + + {middleEntries.length > 0 && ( + <> + + + + + Show hidden segments + + + {middleEntries.map((entry) => ( + + + {entry.name} + + + ))} + + + + + + )} + + {immediateParent && ( + <> + + + + {immediateParent.name} + + + + + + )} + {displayTitle} @@ -600,7 +650,7 @@ export function Entry({ ); - }, [config.branch, config.owner, config.repo, displayTitle, name, path, schema, schemaType]); + }, [config.branch, config.owner, config.repo, displayTitle, name, path, parent, schema, schemaType]); const isCreationBlocked = !path && schemaType === "collection" && !canCreate; const showHeaderActions = error !== "Not found" && !isCreationBlocked; const headerActionsNode = useMemo(() => {