2024-05-27 13:19:11 -04:00
|
|
|
import { ReactNode, FC } from 'react';
|
2022-06-06 23:39:03 +02:00
|
|
|
|
2024-05-12 15:45:26 -04:00
|
|
|
import { Export, findModuleExport } from '../webpack';
|
2024-06-26 22:28:58 -04:00
|
|
|
import { createPropListRegex } from '../utils';
|
2022-06-06 23:39:03 +02:00
|
|
|
|
2022-10-08 01:50:25 -04:00
|
|
|
export interface SidebarNavigationPage {
|
2023-06-18 13:15:18 -04:00
|
|
|
title: ReactNode;
|
2022-06-06 23:39:03 +02:00
|
|
|
content: ReactNode;
|
2022-10-01 19:33:02 -06:00
|
|
|
icon?: ReactNode;
|
|
|
|
|
visible?: boolean;
|
|
|
|
|
hideTitle?: boolean;
|
|
|
|
|
identifier?: string;
|
|
|
|
|
route?: string;
|
|
|
|
|
link?: string;
|
2022-10-24 20:33:40 -04:00
|
|
|
padding?: 'none' | 'compact';
|
2022-06-06 23:39:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SidebarNavigationProps {
|
|
|
|
|
title?: string;
|
2023-03-22 20:17:58 -05:00
|
|
|
pages: (SidebarNavigationPage | 'separator')[];
|
2022-06-06 23:39:03 +02:00
|
|
|
showTitle?: boolean;
|
|
|
|
|
disableRouteReporting?: boolean;
|
2022-10-01 19:33:02 -06:00
|
|
|
page?: string;
|
|
|
|
|
onPageRequested?: (page: string) => void;
|
2022-06-06 23:39:03 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-26 22:28:58 -04:00
|
|
|
const sidebarNavigationRegex = createPropListRegex(["pages", "fnSetNavigateToPage", "disableRouteReporting"]);
|
2024-05-12 15:48:13 -04:00
|
|
|
export const SidebarNavigation = findModuleExport((e: Export) =>
|
2024-06-26 22:28:58 -04:00
|
|
|
e?.toString && sidebarNavigationRegex.test(e.toString()),
|
2024-05-27 13:19:11 -04:00
|
|
|
) as FC<SidebarNavigationProps>;
|