116 lines
3.2 KiB
TypeScript
116 lines
3.2 KiB
TypeScript
/**
|
|
* Routes Configuration
|
|
* Defines menu hierarchy, breadcrumbs, and routing structure
|
|
*/
|
|
|
|
export interface RouteConfig {
|
|
path: string;
|
|
label: string;
|
|
icon?: string;
|
|
children?: RouteConfig[];
|
|
breadcrumb?: string;
|
|
}
|
|
|
|
export const routes: RouteConfig[] = [
|
|
{
|
|
path: '/',
|
|
label: 'Dashboard',
|
|
icon: 'Dashboard',
|
|
},
|
|
{
|
|
path: '/planner',
|
|
label: 'Planner',
|
|
icon: 'Planner',
|
|
children: [
|
|
{ path: '/planner', label: 'Dashboard', breadcrumb: 'Planner Dashboard' },
|
|
{ path: '/planner/keywords', label: 'Keywords', breadcrumb: 'Keywords' },
|
|
{ path: '/planner/clusters', label: 'Clusters', breadcrumb: 'Clusters' },
|
|
{ path: '/planner/ideas', label: 'Ideas', breadcrumb: 'Ideas' },
|
|
{ path: '/planner/mapping', label: 'Mapping', breadcrumb: 'Mapping' },
|
|
],
|
|
},
|
|
{
|
|
path: '/writer',
|
|
label: 'Writer',
|
|
icon: 'Writer',
|
|
children: [
|
|
{ path: '/writer', label: 'Dashboard', breadcrumb: 'Writer Dashboard' },
|
|
{ path: '/writer/tasks', label: 'Tasks', breadcrumb: 'Tasks' },
|
|
{ path: '/writer/content', label: 'Content', breadcrumb: 'Content' },
|
|
{ path: '/writer/approved', label: 'Approved', breadcrumb: 'Approved' },
|
|
],
|
|
},
|
|
{
|
|
path: '/thinker',
|
|
label: 'Thinker',
|
|
icon: 'Thinker',
|
|
children: [
|
|
{ path: '/thinker', label: 'Dashboard', breadcrumb: 'Thinker Dashboard' },
|
|
{ path: '/thinker/prompts', label: 'Prompts', breadcrumb: 'Prompts' },
|
|
{ path: '/thinker/strategies', label: 'Strategies', breadcrumb: 'Strategies' },
|
|
{ path: '/thinker/profile', label: 'Profile', breadcrumb: 'Profile' },
|
|
],
|
|
},
|
|
{
|
|
path: '/linker',
|
|
label: 'Linker',
|
|
icon: 'Link2',
|
|
children: [
|
|
{ path: '/linker', label: 'Dashboard', breadcrumb: 'Linker Dashboard' },
|
|
{ path: '/linker/content', label: 'Content', breadcrumb: 'Link Content' },
|
|
],
|
|
},
|
|
{
|
|
path: '/optimizer',
|
|
label: 'Optimizer',
|
|
icon: 'Zap',
|
|
children: [
|
|
{ path: '/optimizer', label: 'Dashboard', breadcrumb: 'Optimizer Dashboard' },
|
|
{ path: '/optimizer/content', label: 'Content', breadcrumb: 'Optimize Content' },
|
|
],
|
|
},
|
|
{
|
|
path: '/sites',
|
|
label: 'Sites',
|
|
icon: 'Sites',
|
|
children: [
|
|
{ path: '/sites', label: 'All Sites', breadcrumb: 'All Sites' },
|
|
],
|
|
},
|
|
];
|
|
|
|
export const getBreadcrumbs = (pathname: string): Array<{ label: string; path: string }> => {
|
|
const breadcrumbs: Array<{ label: string; path: string }> = [
|
|
{ label: 'Home', path: '/' },
|
|
];
|
|
|
|
// Find matching route
|
|
const findRoute = (routes: RouteConfig[], path: string): RouteConfig | null => {
|
|
for (const route of routes) {
|
|
if (route.path === path) {
|
|
return route;
|
|
}
|
|
if (route.children) {
|
|
const child = route.children.find((r) => r.path === path);
|
|
if (child) {
|
|
return { ...child, path: route.path };
|
|
}
|
|
const found = findRoute(route.children, path);
|
|
if (found) {
|
|
breadcrumbs.push({ label: route.label, path: route.path });
|
|
return found;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
|
|
const route = findRoute(routes, pathname);
|
|
if (route) {
|
|
breadcrumbs.push({ label: route.breadcrumb || route.label, path: route.path });
|
|
}
|
|
|
|
return breadcrumbs;
|
|
};
|
|
|