diff --git a/app/[lang]/(live)/(protected)/my-pages/layout.tsx b/app/[lang]/(live)/(protected)/my-pages/layout.tsx index c9cb2e5d6..09f39ce78 100644 --- a/app/[lang]/(live)/(protected)/my-pages/layout.tsx +++ b/app/[lang]/(live)/(protected)/my-pages/layout.tsx @@ -6,16 +6,36 @@ import Sidebar from "@/components/MyPages/Sidebar" import styles from "./layout.module.css" import type { LangParams, LayoutArgs } from "@/types/params" +import { request } from "@/lib/graphql/request" +import { GetNavigationMyPagesData } from "@/types/requests/myPages/navigation" +import { GetNavigationMyPages } from "@/lib/graphql/Query/NavigationMyPages.graphql" -export default function MyPagesLayout({ +export default async function MyPagesLayout({ children, params, }: React.PropsWithChildren>) { + const response = await request( + GetNavigationMyPages, + { + locale: params.lang, + } + ) + const navigation = response.data.all_navigation_my_pages.items[0] + + const menuItems = navigation.items.map(({ item }) => { + const { title, uid } = item.pageConnection.edges[0].node + return { + title, + uid, + linkText: item.link_text, + } + }) + return (
- + {children}
diff --git a/components/MyPages/Sidebar/index.tsx b/components/MyPages/Sidebar/index.tsx index 6462ae68b..19c80655b 100644 --- a/components/MyPages/Sidebar/index.tsx +++ b/components/MyPages/Sidebar/index.tsx @@ -2,29 +2,22 @@ import { LogOut } from "react-feather" import Link from "next/link" import styles from "./sidebar.module.css" +import { SidebarProps } from "@/types/requests/myPages/navigation" -export default function Sidebar() { +export default function Sidebar({ menuItems }: SidebarProps) { return (