28 lines
712 B
TypeScript
28 lines
712 B
TypeScript
"use client";
|
|
|
|
import { usePathname, useRouter } from "next/navigation";
|
|
import { BaseLayout } from "@common/components/ui";
|
|
import type { MenuItem } from "@common/components/api";
|
|
import { useMenuStore } from "@/shared/lib/use-menu-store";
|
|
|
|
export default function WithBaseLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const router = useRouter();
|
|
const pathname = usePathname();
|
|
const { setCurrentMenuInfo } = useMenuStore((state) => state);
|
|
|
|
const handleMenuClick = (item: MenuItem) => {
|
|
setCurrentMenuInfo(item);
|
|
router.push(item.urlPath);
|
|
};
|
|
|
|
return (
|
|
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleMenuClick}>
|
|
{children}
|
|
</BaseLayout>
|
|
);
|
|
}
|