generated from nisabmohd/Aria-Docs
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathroutes-config.ts
62 lines (56 loc) · 1.78 KB
/
routes-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// for page navigation & to sort on leftbar
export type EachRoute = {
title: string;
href: string;
noLink?: true; // noLink will create a route segment (section) but cannot be navigated
items?: EachRoute[];
};
export const ROUTES: EachRoute[] = [
{
title: "Getting Started",
href: "/getting-started",
noLink: true,
items: [
{ title: "Introduction", href: "/introduction" },
{
title: "Setup",
href: "/setup",
},
{
title: "Components",
href: "/components",
items: [
{
title: "Project Structure",
href: "/project-structure",
},
{ title: "Node", href: "/node" },
{ title: "Connection", href: "/connection" },
{ title: "Graph", href: "/graph" },
{ title: "Parser", href: "/parser" },
],
},
],
},
];
export const EXAMPLE_ROUTES : EachRoute[] = [
{ title: "Example - hello-dagrs", href: "/hello-dagrs" },
{ title: "Example - custom-node", href: "/custom-node" },
{ title: "Example - macro `auto-node`", href: "/macro-auto-node" },
{ title: "Example - macro `dependencies!`", href: "/macro-auto-relay" },
{ title: "Example - compute dag", href: "/compute-dag" },
]
type Page = { title: string; href: string };
function getRecurrsiveAllLinks(node: EachRoute) {
const ans: Page[] = [];
if (!node.noLink) {
ans.push({ title: node.title, href: node.href });
}
node.items?.forEach((subNode) => {
const temp = { ...subNode, href: `${node.href}${subNode.href}` };
ans.push(...getRecurrsiveAllLinks(temp));
});
return ans;
}
export const page_routes = ROUTES.map((it) => getRecurrsiveAllLinks(it)).flat();
export const example_page_routes = EXAMPLE_ROUTES.map((it) => getRecurrsiveAllLinks(it)).flat();