Skip to content

Commit

Permalink
Merge branch 'main' into update/use-submission
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 24, 2024
2 parents f8b2732 + c827a4c commit b9c7a33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion scripts/collections/build-file-tree.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ export async function buildFileTree(entry = COLLECTIONS_ROOT) {
})
);

const children = entryPath.includes("/reference/")
? nested
.filter(Boolean)
.sort((firstChild, secondChild) =>
firstChild.title
.toLowerCase()
.localeCompare(secondChild.title.toLowerCase())
)
: nested.filter(Boolean);

return {
type: "section",
title: info.title,
pages: info.pages,
children: nested.filter(Boolean),
children,
};
} else if (!entryPath.includes("data.json")) {
const file = await fs.readFile(entryPath, "utf-8");
Expand Down
3 changes: 1 addition & 2 deletions src/ui/docs-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ interface DocsLayoutProps {
export const DocsLayout = (props: DocsLayoutProps) => {
const location = useLocation();

const lastSegmentPath = () => location.pathname.split("/").reverse()[0];
const collection = () =>
location.pathname.includes("/reference/")
? props.entries.reference
: props.entries.learn;

const entryIndex = () =>
collection()!.findIndex((element) => lastSegmentPath() === element.slug);
collection()!.findIndex((element) => location.pathname === element.path);

const titles = () => {
const fullEntry = collection
Expand Down

0 comments on commit b9c7a33

Please sign in to comment.