35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { PageTitle } from "@common/components";
|
|
|
|
import { findMenuItemByUrlPath } from "@/shared/lib/stats-cd-input-navigation";
|
|
import { STATISTICS_DASHBOARD_TAB_ID } from "@/shared/lib/statistics-tab-url";
|
|
|
|
import { TabBar } from "./tab-bar";
|
|
|
|
import { useTabStore } from "@/store/tab-store";
|
|
|
|
function StatisticsPageLayout({ children }: { children: React.ReactNode }) {
|
|
const { activeTabId, tabs, menuList } = useTabStore();
|
|
|
|
const pageTitle = tabs.find((t) => t.id === activeTabId);
|
|
const dashboardMenu =
|
|
!pageTitle && menuList
|
|
? findMenuItemByUrlPath(menuList, STATISTICS_DASHBOARD_TAB_ID)
|
|
: null;
|
|
|
|
const menuPaths = pageTitle?.path?.split(">").map((path) => path.trim());
|
|
|
|
return (
|
|
<div className="h-auto min-h-full bg-container pb-2 flex-1">
|
|
<TabBar />
|
|
<PageTitle
|
|
title={pageTitle?.label ?? ""}
|
|
menuCd={pageTitle?.menuItem?.menuCd ?? dashboardMenu?.menuCd}
|
|
menuPaths={menuPaths ?? []}
|
|
/>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export { StatisticsPageLayout };
|