-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathroutes-config.ts
More file actions
92 lines (86 loc) · 2.94 KB
/
routes-config.ts
File metadata and controls
92 lines (86 loc) · 2.94 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// 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" },
{
title: "Advanced features",
href: "/advanced-features",
items: [
{
title: "Conditional Execution",
href: "/conditional-execution",
},
{
title: "Loop Subgraph",
href: "/loop-subgraph",
},
{
title: "Send & Recv without id",
href: "/send-recv-without-id",
},
{
title: "Typed Action",
href: "/typed-action",
},
],
},
],
},
],
},
];
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" },
{ title: "Example - Conditional Execution", href: "/conditional-execution" },
{ title: "Example - Dynamic Router", href: "/dynamic-router" },
{ title: "Example - Loop Subgraph", href: "/loop-subgraph" },
{ title: "Example - Loop Node", href: "/loop-node" },
{ title: "Example - Checkpoint", href: "/checkpoint" },
{ title: "Example - Execution Hooks", href: "/execution-hooks" },
{ title: "Example - State Subscription", href: "/state-subscription" },
{ title: "Example - receive any & broadcast & typed action", href: "/receive-any-typed-action" },
]
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();