MCPcopy Index your code
hub / github.com/bytebase/bytebase / useSidebarItems

Function useSidebarItems

frontend/src/react/components/ProjectSidebar.tsx:72–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70// ---------------------------------------------------------------------------
71
72function useSidebarItems(): SidebarItem[] {
73 const { t } = useTranslation();
74 const defaultProject = useAppStore((s) => s.serverInfo?.defaultProject ?? "");
75
76 const sidebarRoute = useCurrentRoute();
77 const sidebarProjectId =
78 (sidebarRoute.params.projectId as string | undefined) ?? "";
79 const sidebarProjectName = sidebarProjectId
80 ? `${projectNamePrefix}${sidebarProjectId}`
81 : "";
82 const isDefault = !!defaultProject && sidebarProjectName === defaultProject;
83
84 return useMemo(
85 (): SidebarItem[] => [
86 {
87 title: t("common.issues"),
88 path: PROJECT_V1_ROUTE_ISSUES,
89 icon: CircleDot,
90 type: "div",
91 hide: isDefault,
92 },
93 {
94 title: "CI/CD",
95 icon: Workflow,
96 type: "div",
97 expand: true,
98 hide: isDefault,
99 children: [
100 {
101 title: t("plan.plans"),
102 path: PROJECT_V1_ROUTE_PLANS,
103 type: "div",
104 },
105 {
106 title: t("release.releases"),
107 path: PROJECT_V1_ROUTE_RELEASES,
108 type: "div",
109 },
110 {
111 title: t("gitops.self"),
112 path: PROJECT_V1_ROUTE_GITOPS,
113 type: "div",
114 },
115 ],
116 },
117 {
118 title: t("common.database"),
119 icon: Database,
120 type: "div",
121 expand: true,
122 children: [
123 {
124 title: t("common.databases"),
125 path: PROJECT_V1_ROUTE_DATABASES,
126 type: "div",
127 },
128 {
129 title: t("common.groups"),

Callers 1

ProjectSidebarFunction · 0.70

Calls 3

useCurrentRouteFunction · 0.90
useAppStoreFunction · 0.70
tFunction · 0.50

Tested by

no test coverage detected