mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-05 00:58:21 +01:00
refactor(bots): make bots.ts SSOT for footer, menu, and bots page
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>
This commit is contained in:
1 parent
b6f1361d0d
commit
ea7baec755
4 files changed
+166
-203
No files matched your search
+25
-122
@@ -3,108 +3,6 @@ import Link from 'next/link';
|
||||
import bots from '@/data/bots';
|
||||
import { getChatPathFromBotSlug } from '@/data/professionals';
|
||||
|
||||
// Bot display data with detailed explanations
|
||||
const botDetails: Record<
|
||||
string,
|
||||
{
|
||||
name: string;
|
||||
type: string;
|
||||
emoji: string;
|
||||
tagline: string;
|
||||
whatItDoes: string;
|
||||
inputData: string;
|
||||
output: string;
|
||||
useCases: string[];
|
||||
}
|
||||
> = {
|
||||
'legal-expert': {
|
||||
name: 'Lex',
|
||||
type: 'Legal Assistant',
|
||||
emoji: '⚖️',
|
||||
tagline: 'Your AI-powered legal companion',
|
||||
whatItDoes:
|
||||
'Analyzes legal cases, matches you with expert lawyers, and provides secure collaborative workspaces',
|
||||
inputData: 'Legal documents, case descriptions, jurisdiction info',
|
||||
output: 'AI case analysis, lawyer matches, secure data room',
|
||||
useCases: ['Immigration cases', 'Employment disputes', 'Real estate contracts', 'Business law'],
|
||||
},
|
||||
'swiss-german-teacher': {
|
||||
name: 'Heidi',
|
||||
type: 'Swiss German Teacher',
|
||||
emoji: '🇨🇭',
|
||||
tagline: 'Master Schwyzerdütsch naturally',
|
||||
whatItDoes:
|
||||
'Provides contextual Swiss German learning with cultural insights and canton-specific variations',
|
||||
inputData: 'Your German level, target canton, learning goals',
|
||||
output: 'Personalized lessons, pronunciation guides, cultural context',
|
||||
useCases: [
|
||||
'Moving to Switzerland',
|
||||
'Work in Swiss companies',
|
||||
'Connect with locals',
|
||||
'Canton-specific dialects',
|
||||
],
|
||||
},
|
||||
'research-assistant': {
|
||||
name: 'Nerd',
|
||||
type: 'Research Assistant',
|
||||
emoji: '🧠',
|
||||
tagline: 'Accelerate your research workflow',
|
||||
whatItDoes:
|
||||
'Organizes research materials, tracks citations, finds relevant papers, and synthesizes findings',
|
||||
inputData: 'Research papers, notes, queries, data sets',
|
||||
output: 'Literature reviews, citation networks, summaries, insights',
|
||||
useCases: [
|
||||
'Academic research',
|
||||
'Market analysis',
|
||||
'Patent research',
|
||||
'Technical documentation',
|
||||
],
|
||||
},
|
||||
'medical-expert': {
|
||||
name: 'Imhotep',
|
||||
type: 'Medical Expert',
|
||||
emoji: '⚕️',
|
||||
tagline: 'Evidence-based health insights',
|
||||
whatItDoes:
|
||||
'Analyzes medical literature, symptoms, and data to provide evidence-based health information',
|
||||
inputData: 'Symptoms, medical history, lab results, research papers',
|
||||
output: 'Evidence-based insights, specialist recommendations, treatment options',
|
||||
useCases: [
|
||||
'Second opinions',
|
||||
'Research rare conditions',
|
||||
'Treatment comparisons',
|
||||
'Clinical studies',
|
||||
],
|
||||
},
|
||||
'artistic-advisor': {
|
||||
name: 'Artr',
|
||||
type: 'Creative Assistant',
|
||||
emoji: '🎨',
|
||||
tagline: 'Your creative co-pilot',
|
||||
whatItDoes:
|
||||
'Analyzes art styles, generates creative concepts, and provides artistic feedback and guidance',
|
||||
inputData: 'Art references, style preferences, project briefs',
|
||||
output: 'Style analysis, creative concepts, technical feedback',
|
||||
useCases: [
|
||||
'Style exploration',
|
||||
'Concept development',
|
||||
'Art history research',
|
||||
'Portfolio review',
|
||||
],
|
||||
},
|
||||
'product-manager': {
|
||||
name: 'Trident',
|
||||
type: 'Product Manager',
|
||||
emoji: '🔱',
|
||||
tagline: 'Strategic product development',
|
||||
whatItDoes:
|
||||
'Analyzes market data, user feedback, and competitive landscape to guide product strategy',
|
||||
inputData: 'User feedback, market data, feature requests, analytics',
|
||||
output: 'Product roadmaps, prioritization, competitive analysis',
|
||||
useCases: ['Feature prioritization', 'Market analysis', 'User research', 'Roadmap planning'],
|
||||
},
|
||||
};
|
||||
|
||||
export default function BotsList() {
|
||||
// Only mark bots as "ready" if they have actual working try links
|
||||
// Currently only Heidi (swiss-german-teacher) has a GPT link
|
||||
@@ -160,19 +58,24 @@ export default function BotsList() {
|
||||
{/* Bots Grid */}
|
||||
<div className="grid gap-8 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{bots.map((bot) => {
|
||||
const details = botDetails[bot.slug] || {
|
||||
name: bot.title,
|
||||
type: bot.slug
|
||||
// Derive display data from bot.display with sensible fallbacks
|
||||
const display = bot.display || {
|
||||
tagline: bot.description,
|
||||
whatItDoes: bot.overview,
|
||||
inputData: 'Your data',
|
||||
output: 'AI insights',
|
||||
useCases: bot.features.slice(0, 4),
|
||||
};
|
||||
|
||||
// Derive name/type/emoji from nav or fallback
|
||||
const name = bot.nav?.navTitle || bot.title;
|
||||
const type =
|
||||
bot.nav?.navDescription?.replace(/^AI\s+/, '') ||
|
||||
bot.slug
|
||||
.split('-')
|
||||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' '),
|
||||
emoji: '🤖',
|
||||
tagline: 'AI-powered assistant',
|
||||
whatItDoes: 'Helps with various tasks',
|
||||
inputData: 'Your data',
|
||||
output: 'Helpful insights',
|
||||
useCases: [],
|
||||
};
|
||||
.join(' ');
|
||||
const emoji = bot.nav?.emoji || '🤖';
|
||||
|
||||
const isReady = readyBots.includes(bot.slug);
|
||||
|
||||
@@ -192,14 +95,14 @@ export default function BotsList() {
|
||||
<div className="p-6 pb-4">
|
||||
<div className="flex items-center mb-3">
|
||||
<div className="w-14 h-14 rounded-full flex items-center justify-center mr-4 bg-gradient-to-br from-gray-100 to-gray-200">
|
||||
<span className="text-3xl">{details.emoji}</span>
|
||||
<span className="text-3xl">{emoji}</span>
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold text-gray-900">{details.name}</h2>
|
||||
<p className="text-sm text-gray-500">{details.type}</p>
|
||||
<h2 className="text-2xl font-bold text-gray-900">{name}</h2>
|
||||
<p className="text-sm text-gray-500">{type}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-gray-600 italic text-sm mb-4">"{details.tagline}"</p>
|
||||
<p className="text-gray-600 italic text-sm mb-4">"{display.tagline}"</p>
|
||||
</div>
|
||||
|
||||
{/* What It Does */}
|
||||
@@ -207,7 +110,7 @@ export default function BotsList() {
|
||||
<h3 className="text-xs font-semibold text-gray-500 uppercase mb-2">
|
||||
What it does
|
||||
</h3>
|
||||
<p className="text-sm text-gray-700 leading-relaxed">{details.whatItDoes}</p>
|
||||
<p className="text-sm text-gray-700 leading-relaxed">{display.whatItDoes}</p>
|
||||
</div>
|
||||
|
||||
{/* Data Flow */}
|
||||
@@ -216,24 +119,24 @@ export default function BotsList() {
|
||||
<div className="grid grid-cols-2 gap-3 text-xs">
|
||||
<div>
|
||||
<div className="font-semibold text-gray-700 mb-1">📥 Input</div>
|
||||
<div className="text-gray-600">{details.inputData}</div>
|
||||
<div className="text-gray-600">{display.inputData}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="font-semibold text-gray-700 mb-1">📤 Output</div>
|
||||
<div className="text-gray-600">{details.output}</div>
|
||||
<div className="text-gray-600">{display.output}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Use Cases */}
|
||||
{details.useCases && details.useCases.length > 0 && (
|
||||
{display.useCases && display.useCases.length > 0 && (
|
||||
<div className="px-6 pb-4">
|
||||
<h3 className="text-xs font-semibold text-gray-500 uppercase mb-2">
|
||||
Perfect for
|
||||
</h3>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{details.useCases.slice(0, 3).map((useCase, idx) => (
|
||||
{display.useCases.slice(0, 3).map((useCase, idx) => (
|
||||
<span
|
||||
key={idx}
|
||||
className="inline-block bg-gray-100 text-gray-700 text-xs px-2 py-1 rounded"
|
||||
|
||||
+19
-36
@@ -4,6 +4,7 @@ import { FaGithub, FaTwitter } from 'react-icons/fa';
|
||||
import { Logo } from '@/components/shared/Logo';
|
||||
import { site } from '@/lib/site';
|
||||
import { ROUTES } from '@/lib/routes';
|
||||
import bots from '@/data/bots';
|
||||
|
||||
export function Footer() {
|
||||
return (
|
||||
@@ -23,42 +24,24 @@ export function Footer() {
|
||||
<div>
|
||||
<h2 className="mb-4 font-semibold text-gray-800">AI Assistants</h2>
|
||||
<ul className="space-y-2 text-gray-600">
|
||||
<li>
|
||||
<Link href="/bots/legal-expert" className="hover:text-blue-600 transition-colors">
|
||||
Lex (Legal)
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/bots/medical-expert" className="hover:text-blue-600 transition-colors">
|
||||
Imhotep (Health)
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
href="/bots/research-assistant"
|
||||
className="hover:text-blue-600 transition-colors"
|
||||
>
|
||||
Nerd (Research)
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
href="/bots/swiss-german-teacher"
|
||||
className="hover:text-blue-600 transition-colors"
|
||||
>
|
||||
Heidi (Language)
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/bots/artistic-advisor" className="hover:text-blue-600 transition-colors">
|
||||
Muse (Creative)
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/bots/product-manager" className="hover:text-blue-600 transition-colors">
|
||||
Trident (Business)
|
||||
</Link>
|
||||
</li>
|
||||
{bots
|
||||
.filter((b) => b.nav)
|
||||
.map((bot) => {
|
||||
// Extract short category from navDescription (e.g., "AI Legal Assistant" -> "Legal")
|
||||
const category =
|
||||
bot.nav!.navDescription?.replace(/^AI\s+/, '').replace(/\s+Assistant$/, '') ||
|
||||
'Assistant';
|
||||
return (
|
||||
<li key={bot.slug}>
|
||||
<Link
|
||||
href={`/bots/${bot.slug}`}
|
||||
className="hover:text-blue-600 transition-colors"
|
||||
>
|
||||
{bot.nav!.navTitle} ({category})
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -16,6 +16,14 @@ export interface Bot {
|
||||
accentColor: BotAccentColor;
|
||||
menuItems: BotMenuItem[];
|
||||
};
|
||||
// Display metadata for bots list page (optional with fallbacks)
|
||||
display?: {
|
||||
tagline: string;
|
||||
whatItDoes: string;
|
||||
inputData: string;
|
||||
output: string;
|
||||
useCases: string[];
|
||||
};
|
||||
}
|
||||
|
||||
const bots: Bot[] = [
|
||||
@@ -49,6 +57,19 @@ const bots: Bot[] = [
|
||||
{ id: 'waitlist', label: 'Join Waitlist', icon: '📝', section: 'waitlist' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Master Schwyzerdütsch naturally',
|
||||
whatItDoes:
|
||||
'Provides contextual Swiss German learning with cultural insights and canton-specific variations',
|
||||
inputData: 'Your German level, target canton, learning goals',
|
||||
output: 'Personalized lessons, pronunciation guides, cultural context',
|
||||
useCases: [
|
||||
'Moving to Switzerland',
|
||||
'Work in Swiss companies',
|
||||
'Connect with locals',
|
||||
'Canton-specific dialects',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'research-assistant',
|
||||
@@ -84,6 +105,19 @@ const bots: Bot[] = [
|
||||
{ id: 'roadmap', label: 'Roadmap', icon: '🗺️', section: 'roadmap' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Accelerate your research workflow',
|
||||
whatItDoes:
|
||||
'Organizes research materials, tracks citations, finds relevant papers, and synthesizes findings',
|
||||
inputData: 'Research papers, notes, queries, data sets',
|
||||
output: 'Literature reviews, citation networks, summaries, insights',
|
||||
useCases: [
|
||||
'Academic research',
|
||||
'Market analysis',
|
||||
'Patent research',
|
||||
'Technical documentation',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'medical-expert',
|
||||
@@ -113,6 +147,19 @@ const bots: Bot[] = [
|
||||
{ id: 'vision', label: 'Vision', icon: '🚀', section: 'vision' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Evidence-based health insights',
|
||||
whatItDoes:
|
||||
'Analyzes medical literature, symptoms, and data to provide evidence-based health information',
|
||||
inputData: 'Symptoms, medical history, lab results, research papers',
|
||||
output: 'Evidence-based insights, specialist recommendations, treatment options',
|
||||
useCases: [
|
||||
'Second opinions',
|
||||
'Research rare conditions',
|
||||
'Treatment comparisons',
|
||||
'Clinical studies',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'legal-expert',
|
||||
@@ -142,6 +189,14 @@ const bots: Bot[] = [
|
||||
{ id: 'get-started', label: 'Join Waitlist', icon: '✨', section: 'get-started' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Your AI-powered legal companion',
|
||||
whatItDoes:
|
||||
'Analyzes legal cases, matches you with expert lawyers, and provides secure collaborative workspaces',
|
||||
inputData: 'Legal documents, case descriptions, jurisdiction info',
|
||||
output: 'AI case analysis, lawyer matches, secure data room',
|
||||
useCases: ['Immigration cases', 'Employment disputes', 'Real estate contracts', 'Business law'],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'artistic-advisor',
|
||||
@@ -171,6 +226,19 @@ const bots: Bot[] = [
|
||||
{ id: 'get-started', label: 'Get Started', icon: '🚀', section: 'get-started' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Your creative co-pilot',
|
||||
whatItDoes:
|
||||
'Analyzes art styles, generates creative concepts, and provides artistic feedback and guidance',
|
||||
inputData: 'Art references, style preferences, project briefs',
|
||||
output: 'Style analysis, creative concepts, technical feedback',
|
||||
useCases: [
|
||||
'Style exploration',
|
||||
'Concept development',
|
||||
'Art history research',
|
||||
'Portfolio review',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'product-manager',
|
||||
@@ -205,6 +273,14 @@ const bots: Bot[] = [
|
||||
{ id: 'get-started', label: 'Get Started', icon: '🚀', section: 'get-started' },
|
||||
],
|
||||
},
|
||||
display: {
|
||||
tagline: 'Strategic product development',
|
||||
whatItDoes:
|
||||
'Analyzes market data, user feedback, and competitive landscape to guide product strategy',
|
||||
inputData: 'User feedback, market data, feature requests, analytics',
|
||||
output: 'Product roadmaps, prioritization, competitive analysis',
|
||||
useCases: ['Feature prioritization', 'Market analysis', 'User research', 'Roadmap planning'],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
+46
-45
@@ -1,5 +1,49 @@
|
||||
import type { MenuItem } from '@/types/navigation';
|
||||
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
|
||||
@@ -14,50 +58,7 @@ export const menuItems: MenuItem[] = [
|
||||
{
|
||||
label: 'Professionals',
|
||||
path: '/professionals' as Route,
|
||||
children: [
|
||||
{
|
||||
label: 'All Professionals',
|
||||
path: '/professionals' as Route,
|
||||
description: 'Browse all AI professionals.',
|
||||
icon: '👥',
|
||||
},
|
||||
{
|
||||
label: 'Dr. Lex (Legal)',
|
||||
path: '/professionals/legal' as Route,
|
||||
description: 'AI legal advisor for contracts and legal questions.',
|
||||
icon: '⚖️',
|
||||
},
|
||||
{
|
||||
label: 'Dr. Imhotep (Health)',
|
||||
path: '/professionals/health' as Route,
|
||||
description: 'AI health advisor for wellness guidance.',
|
||||
icon: '⚕️',
|
||||
},
|
||||
{
|
||||
label: 'Prof. Nerd (Research)',
|
||||
path: '/professionals/research' as Route,
|
||||
description: 'AI research assistant for academic work.',
|
||||
icon: '🔬',
|
||||
},
|
||||
{
|
||||
label: 'Heidi (Language)',
|
||||
path: '/professionals/language' as Route,
|
||||
description: 'AI language coach for German learning.',
|
||||
icon: '🇨🇭',
|
||||
},
|
||||
{
|
||||
label: 'Artr (Creative)',
|
||||
path: '/professionals/creative' as Route,
|
||||
description: 'AI creative advisor for artistic projects.',
|
||||
icon: '🎨',
|
||||
},
|
||||
{
|
||||
label: 'Trident (Business)',
|
||||
path: '/professionals/business' as Route,
|
||||
description: 'AI business strategist for planning.',
|
||||
icon: '🔱',
|
||||
},
|
||||
],
|
||||
children: generateProfessionalChildren(),
|
||||
megaMenu: {
|
||||
columns: 2,
|
||||
header: {
|
||||
|
||||
Reference in new issue
Block a user