mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-05 00:18:29 +01:00
Reduces files needed to add a new bot from 7-8 to 3-4 by eliminating hardcoded bot lists in multiple locations: - Add `display` field to Bot interface for bots list page metadata - Footer.tsx: Generate AI Assistants links from bots array - app/bots/page.tsx: Remove 100-line botDetails Record, derive from bot.display - menuItems.ts: Generate Professionals menu children from bots array Adding a new bot now automatically updates the footer, navigation menu, and bots list page without any additional code changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
95 lines
2.6 KiB
TypeScript
95 lines
2.6 KiB
TypeScript
import type { MenuItem, MenuChildItem } from '@/types/navigation';
|
|
import type { Route } from 'next';
|
|
import bots from '@/data/bots';
|
|
|
|
/**
|
|
* Map bot slug to professional category path
|
|
* This mapping allows bots to link to their corresponding professional page
|
|
*/
|
|
const BOT_TO_PROFESSIONAL_PATH: Record<string, string> = {
|
|
'legal-expert': 'legal',
|
|
'medical-expert': 'health',
|
|
'research-assistant': 'research',
|
|
'swiss-german-teacher': 'language',
|
|
'artistic-advisor': 'creative',
|
|
'product-manager': 'business',
|
|
};
|
|
|
|
/**
|
|
* Generate professional menu children from bots.ts
|
|
* SSOT: Bot data drives navigation
|
|
*/
|
|
const generateProfessionalChildren = (): MenuChildItem[] => {
|
|
const allProfessionals: MenuChildItem = {
|
|
label: 'All Professionals',
|
|
path: '/professionals' as Route,
|
|
description: 'Browse all AI professionals.',
|
|
icon: '👥',
|
|
};
|
|
|
|
const botItems: MenuChildItem[] = bots
|
|
.filter((b) => b.nav)
|
|
.map((bot) => {
|
|
const professionalPath = BOT_TO_PROFESSIONAL_PATH[bot.slug] || bot.slug;
|
|
// Extract short category from navDescription (e.g., "AI Legal Assistant" -> "Legal")
|
|
const category =
|
|
bot.nav!.navDescription?.replace(/^AI\s+/, '').replace(/\s+Assistant$/, '') || 'Assistant';
|
|
return {
|
|
label: `${bot.nav!.navTitle} (${category})`,
|
|
path: `/professionals/${professionalPath}` as Route,
|
|
description: bot.description,
|
|
icon: bot.nav!.emoji,
|
|
};
|
|
});
|
|
|
|
return [allProfessionals, ...botItems];
|
|
};
|
|
|
|
/**
|
|
* Main site navigation menu items
|
|
* SSOT for navigation structure across desktop and mobile
|
|
*
|
|
* Botsmann: Your Private AI Professionals
|
|
* - AI Professionals (specialized advisors)
|
|
* - Enterprise (for businesses)
|
|
* - About
|
|
*/
|
|
export const menuItems: MenuItem[] = [
|
|
{
|
|
label: 'Professionals',
|
|
path: '/professionals' as Route,
|
|
children: generateProfessionalChildren(),
|
|
megaMenu: {
|
|
columns: 2,
|
|
header: {
|
|
title: 'AI Professionals',
|
|
subtitle: 'Expert advisors for every need',
|
|
gradient: 'bg-gradient-to-r from-blue-50 to-purple-50',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
label: 'Enterprise',
|
|
path: '/enterprise' as Route,
|
|
},
|
|
{
|
|
label: 'About',
|
|
path: '/about' as Route,
|
|
},
|
|
{
|
|
label: 'Get Started',
|
|
path: '/professionals' as Route,
|
|
isButton: true,
|
|
},
|
|
];
|
|
|
|
/**
|
|
* Get menu items without button items (for desktop nav)
|
|
*/
|
|
export const getNavItems = () => menuItems.filter((item) => !item.isButton);
|
|
|
|
/**
|
|
* Get button items only (for CTA section)
|
|
*/
|
|
export const getButtonItems = () => menuItems.filter((item) => item.isButton);
|