Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { DocsSidebar } from "~/application/sidebar/DocsSidebar";
|
||||
import { SideBarItem } from "~/application/sidebar/SidebarItem";
|
||||
import type { CommandAction } from "~/services/command-registry/commandRegistry";
|
||||
|
||||
export function getDocCommands(): CommandAction[] {
|
||||
const commands: CommandAction[] = [];
|
||||
DocsSidebar().forEach((item) => {
|
||||
commands.push(...getCommandsFromItem(item, [], []));
|
||||
});
|
||||
return commands;
|
||||
}
|
||||
|
||||
function getCommandsFromItem(item: SideBarItem, commands: CommandAction[], parent: string[]) {
|
||||
if (item.path && item.title) {
|
||||
let description = item.description ?? "";
|
||||
if (parent.length > 0) {
|
||||
description = parent.join(" / ");
|
||||
}
|
||||
commands.push({
|
||||
id: item.path,
|
||||
name: item.title,
|
||||
shortcut: [],
|
||||
subtitle: description,
|
||||
});
|
||||
}
|
||||
item.items?.forEach((subItem) => {
|
||||
return getCommandsFromItem(subItem, commands, [...parent, item.title]);
|
||||
});
|
||||
|
||||
return commands;
|
||||
}
|
||||
Reference in new issue
Block a user