1 import type { SectionConfig, SubSectionConfig } from './interface';
3 export const getIsSubsectionAvailable = (section: SubSectionConfig) => {
4 return section.available !== false;
7 export const getIsSectionAvailable = (section: SectionConfig) => {
8 const subsectionsAvailable = (() => {
9 const { subsections = [] } = section;
11 if (!subsections.length) {
15 return subsections.some((subsection) => getIsSubsectionAvailable(subsection));
18 return section.available !== false && subsectionsAvailable;
21 export const getSectionPath = (path: string, section: SectionConfig) => {
22 return `${path}${section.to}`;
25 export const getRoutePaths = (prefix: string, sectionConfigs: SectionConfig[]) => {
26 return sectionConfigs.map((section) => getSectionPath(prefix, section));