mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-05 14:02:18 +01:00
refactor: add BotPageTemplate and fix MDX sanitization
- Add sanitizeMdxContent() in lib/knowledge.ts to escape < followed by numbers (fixes MDX compilation error in production-deployment guide) - Create BotPageTemplate component for bot page deduplication - Refactor medical-expert, research-assistant, artistic-advisor pages to use new template pattern - Template handles: bot lookup, fallback, navigation, layout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5676b87a35
commit
c10748ceff
6 files changed
+463
-345
No files matched your search
+211
-231
@@ -1,244 +1,224 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { getBotBySlug, getBotTryLink } from '@/data/bots';
|
||||
import BotNavigation from '../BotNavigation';
|
||||
import { BotSection, BotNotFoundFallback } from '@/components/shared';
|
||||
import { BotPageTemplate, BotSection } from '@/components/shared';
|
||||
|
||||
export default function ArtisticAdvisor() {
|
||||
const bot = getBotBySlug('artistic-advisor');
|
||||
const tryLink = getBotTryLink(bot);
|
||||
|
||||
if (!bot || !bot.nav) {
|
||||
return <BotNotFoundFallback botName="Muse" />;
|
||||
}
|
||||
|
||||
const { nav } = bot;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white">
|
||||
<BotNavigation
|
||||
botSlug={bot.slug}
|
||||
botTitle={nav.navTitle}
|
||||
botEmoji={nav.emoji}
|
||||
botDescription={nav.navDescription}
|
||||
accentColor={nav.accentColor}
|
||||
menuItems={nav.menuItems}
|
||||
chatLink={tryLink}
|
||||
/>
|
||||
|
||||
<main className="mx-auto max-w-screen-xl px-6 pt-24">
|
||||
{/* Title and Overview */}
|
||||
<div className="mb-16">
|
||||
<h1 className="mb-4 text-4xl font-semibold tracking-tight text-gray-900">
|
||||
{nav.navTitle}
|
||||
</h1>
|
||||
<p className="mb-8 text-lg text-gray-600">{bot.overview}</p>
|
||||
</div>
|
||||
|
||||
{/* Features Section */}
|
||||
<BotSection id="features">
|
||||
<div className="grid gap-8 md:grid-cols-2">
|
||||
<div className="rounded-2xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<h2 className="mb-4 text-2xl font-semibold text-gray-900">
|
||||
Features
|
||||
</h2>
|
||||
<ul className="space-y-4">
|
||||
{bot.features.map((feature, index) => (
|
||||
<li key={index} className="flex items-start">
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 flex-shrink-0 text-amber-500"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M5 13l4 4L19 7"
|
||||
/>
|
||||
</svg>
|
||||
<span className="text-gray-600">{feature}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="how-it-works"
|
||||
className="rounded-2xl border border-gray-200 bg-white p-8 shadow-sm scroll-mt-24"
|
||||
>
|
||||
<h2 className="mb-4 text-2xl font-semibold text-gray-900">
|
||||
How It Works
|
||||
</h2>
|
||||
<ol className="space-y-4">
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
1
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">
|
||||
Describe your artistic vision
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Share details about your creative project or style
|
||||
preferences.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
2
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">AI Analysis</h3>
|
||||
<p className="text-gray-600">
|
||||
Our AI processes your input using art knowledge and
|
||||
creative principles.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
3
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">
|
||||
Get Creative Insights
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Receive tailored advice, inspiration, and techniques for
|
||||
your artistic endeavors.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<BotPageTemplate botSlug="artistic-advisor" botDisplayName="Muse">
|
||||
{({ bot, tryLink }) => (
|
||||
<>
|
||||
{/* Title and Overview */}
|
||||
<div className="mb-16">
|
||||
<h1 className="mb-4 text-4xl font-semibold tracking-tight text-gray-900">
|
||||
{bot.nav!.navTitle}
|
||||
</h1>
|
||||
<p className="mb-8 text-lg text-gray-600">{bot.overview}</p>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Style Analysis Tool */}
|
||||
<BotSection id="style-analysis">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Analyze Your Style
|
||||
</h2>
|
||||
<div className="rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<p className="mb-4 text-gray-600">
|
||||
Describe your artistic work or upload an image for style analysis.
|
||||
</p>
|
||||
|
||||
<div className="mb-6">
|
||||
<textarea
|
||||
className="w-full rounded-md border-gray-300 shadow-sm focus:border-amber-500 focus:ring-amber-500"
|
||||
rows={4}
|
||||
placeholder="Example: I create abstract landscapes using bold colors and geometric shapes..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<button className="rounded-md bg-amber-500 px-6 py-3 text-white hover:bg-opacity-90 transition-opacity">
|
||||
Analyze Style
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Art Styles Exploration */}
|
||||
<BotSection id="art-styles">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Explore Art Styles
|
||||
</h2>
|
||||
|
||||
<div className="grid gap-6 md:grid-cols-3">
|
||||
{[
|
||||
{
|
||||
style: 'Impressionism',
|
||||
description:
|
||||
'Characterized by small, thin brush strokes and emphasis on light and movement.',
|
||||
},
|
||||
{
|
||||
style: 'Cubism',
|
||||
description:
|
||||
'Objects are analyzed, broken up and reassembled in an abstracted form.',
|
||||
},
|
||||
{
|
||||
style: 'Surrealism',
|
||||
description:
|
||||
'Juxtaposition of uncommon imagery to activate the unconscious mind.',
|
||||
},
|
||||
].map((artStyle, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="rounded-xl overflow-hidden border border-gray-200 bg-white shadow-sm"
|
||||
>
|
||||
<div className="h-48 bg-gray-200">
|
||||
<div className="h-full w-full flex items-center justify-center bg-gray-300">
|
||||
<span className="text-gray-600">{artStyle.style}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-6">
|
||||
<h3 className="mb-2 text-xl font-medium text-gray-900">
|
||||
{artStyle.style}
|
||||
</h3>
|
||||
<p className="text-gray-600">{artStyle.description}</p>
|
||||
</div>
|
||||
{/* Features Section */}
|
||||
<BotSection id="features">
|
||||
<div className="grid gap-8 md:grid-cols-2">
|
||||
<div className="rounded-2xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<h2 className="mb-4 text-2xl font-semibold text-gray-900">
|
||||
Features
|
||||
</h2>
|
||||
<ul className="space-y-4">
|
||||
{bot.features.map((feature, index) => (
|
||||
<li key={index} className="flex items-start">
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 flex-shrink-0 text-amber-500"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M5 13l4 4L19 7"
|
||||
/>
|
||||
</svg>
|
||||
<span className="text-gray-600">{feature}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Creative Prompt Generator */}
|
||||
<BotSection id="prompt-generator">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Creative Prompt Generator
|
||||
</h2>
|
||||
<div className="rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<p className="mb-4 text-gray-600">
|
||||
Get a random creative prompt to inspire your next project.
|
||||
</p>
|
||||
|
||||
<div className="mb-6 p-4 bg-gray-50 rounded-md border border-gray-200">
|
||||
<p className="text-lg text-center italic text-gray-700">
|
||||
"Create a piece that represents the feeling of nostalgia using
|
||||
only three colors."
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<button className="rounded-md bg-amber-500 px-6 py-3 text-white hover:bg-opacity-90 transition-opacity">
|
||||
Generate New Prompt
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* CTA Section */}
|
||||
<BotSection id="get-started" isLast>
|
||||
<div className="rounded-xl bg-gray-50 p-8 text-center">
|
||||
<h2 className="text-3xl font-bold text-gray-900 mb-4">
|
||||
Ready to Get Started?
|
||||
</h2>
|
||||
<p className="text-lg text-gray-600 mb-6 max-w-2xl mx-auto">
|
||||
Unlock your creative potential with our AI-powered artistic
|
||||
advisor.
|
||||
</p>
|
||||
<div className="flex justify-center gap-4">
|
||||
<a
|
||||
href={tryLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="rounded-md bg-amber-500 px-6 py-3 text-lg font-medium text-white hover:bg-opacity-90 transition-opacity"
|
||||
<div
|
||||
id="how-it-works"
|
||||
className="rounded-2xl border border-gray-200 bg-white p-8 shadow-sm scroll-mt-24"
|
||||
>
|
||||
Try {nav.navTitle} Now
|
||||
</a>
|
||||
<button className="rounded-md border-2 border-amber-500 px-6 py-3 text-lg font-medium text-amber-500 hover:bg-gray-50 transition-colors">
|
||||
Learn More
|
||||
</button>
|
||||
<h2 className="mb-4 text-2xl font-semibold text-gray-900">
|
||||
How It Works
|
||||
</h2>
|
||||
<ol className="space-y-4">
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
1
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">
|
||||
Describe your artistic vision
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Share details about your creative project or style
|
||||
preferences.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
2
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">AI Analysis</h3>
|
||||
<p className="text-gray-600">
|
||||
Our AI processes your input using art knowledge and
|
||||
creative principles.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<div className="mr-4 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500 text-white">
|
||||
3
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-medium text-gray-900">
|
||||
Get Creative Insights
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Receive tailored advice, inspiration, and techniques for
|
||||
your artistic endeavors.
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
</main>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Style Analysis Tool */}
|
||||
<BotSection id="style-analysis">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Analyze Your Style
|
||||
</h2>
|
||||
<div className="rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<p className="mb-4 text-gray-600">
|
||||
Describe your artistic work or upload an image for style analysis.
|
||||
</p>
|
||||
|
||||
<div className="mb-6">
|
||||
<textarea
|
||||
className="w-full rounded-md border-gray-300 shadow-sm focus:border-amber-500 focus:ring-amber-500"
|
||||
rows={4}
|
||||
placeholder="Example: I create abstract landscapes using bold colors and geometric shapes..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<button className="rounded-md bg-amber-500 px-6 py-3 text-white hover:bg-opacity-90 transition-opacity">
|
||||
Analyze Style
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Art Styles Exploration */}
|
||||
<BotSection id="art-styles">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Explore Art Styles
|
||||
</h2>
|
||||
|
||||
<div className="grid gap-6 md:grid-cols-3">
|
||||
{[
|
||||
{
|
||||
style: 'Impressionism',
|
||||
description:
|
||||
'Characterized by small, thin brush strokes and emphasis on light and movement.',
|
||||
},
|
||||
{
|
||||
style: 'Cubism',
|
||||
description:
|
||||
'Objects are analyzed, broken up and reassembled in an abstracted form.',
|
||||
},
|
||||
{
|
||||
style: 'Surrealism',
|
||||
description:
|
||||
'Juxtaposition of uncommon imagery to activate the unconscious mind.',
|
||||
},
|
||||
].map((artStyle, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="rounded-xl overflow-hidden border border-gray-200 bg-white shadow-sm"
|
||||
>
|
||||
<div className="h-48 bg-gray-200">
|
||||
<div className="h-full w-full flex items-center justify-center bg-gray-300">
|
||||
<span className="text-gray-600">{artStyle.style}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-6">
|
||||
<h3 className="mb-2 text-xl font-medium text-gray-900">
|
||||
{artStyle.style}
|
||||
</h3>
|
||||
<p className="text-gray-600">{artStyle.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* Creative Prompt Generator */}
|
||||
<BotSection id="prompt-generator">
|
||||
<h2 className="mb-8 text-3xl font-semibold text-gray-900">
|
||||
Creative Prompt Generator
|
||||
</h2>
|
||||
<div className="rounded-xl border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<p className="mb-4 text-gray-600">
|
||||
Get a random creative prompt to inspire your next project.
|
||||
</p>
|
||||
|
||||
<div className="mb-6 p-4 bg-gray-50 rounded-md border border-gray-200">
|
||||
<p className="text-lg text-center italic text-gray-700">
|
||||
"Create a piece that represents the feeling of nostalgia using
|
||||
only three colors."
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<button className="rounded-md bg-amber-500 px-6 py-3 text-white hover:bg-opacity-90 transition-opacity">
|
||||
Generate New Prompt
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
|
||||
{/* CTA Section */}
|
||||
<BotSection id="get-started" isLast>
|
||||
<div className="rounded-xl bg-gray-50 p-8 text-center">
|
||||
<h2 className="text-3xl font-bold text-gray-900 mb-4">
|
||||
Ready to Get Started?
|
||||
</h2>
|
||||
<p className="text-lg text-gray-600 mb-6 max-w-2xl mx-auto">
|
||||
Unlock your creative potential with our AI-powered artistic
|
||||
advisor.
|
||||
</p>
|
||||
<div className="flex justify-center gap-4">
|
||||
<a
|
||||
href={tryLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="rounded-md bg-amber-500 px-6 py-3 text-lg font-medium text-white hover:bg-opacity-90 transition-opacity"
|
||||
>
|
||||
Try {bot.nav!.navTitle} Now
|
||||
</a>
|
||||
<button className="rounded-md border-2 border-amber-500 px-6 py-3 text-lg font-medium text-amber-500 hover:bg-gray-50 transition-colors">
|
||||
Learn More
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BotSection>
|
||||
</>
|
||||
)}
|
||||
</BotPageTemplate>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { getBotBySlug, getBotTryLink } from '@/data/bots';
|
||||
import BotNavigation from '../BotNavigation';
|
||||
import { BotSection, BotNotFoundFallback } from '@/components/shared';
|
||||
import { BotPageTemplate, BotSection } from '@/components/shared';
|
||||
import './styles.css';
|
||||
|
||||
import HeroSection from './components/hero/HeroSection';
|
||||
@@ -15,59 +12,42 @@ import FutureProductsSection from './components/future/FutureProductsSection';
|
||||
import VisionAndJoinSection from './components/vision/VisionAndJoinSection';
|
||||
|
||||
export default function MedicalExpert() {
|
||||
const bot = getBotBySlug('medical-expert');
|
||||
const tryLink = getBotTryLink(bot);
|
||||
|
||||
if (!bot || !bot.nav) {
|
||||
return <BotNotFoundFallback botName="Imhotep" />;
|
||||
}
|
||||
|
||||
const { nav } = bot;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white">
|
||||
<BotNavigation
|
||||
botSlug={bot.slug}
|
||||
botTitle={nav.navTitle}
|
||||
botEmoji={nav.emoji}
|
||||
botDescription={nav.navDescription}
|
||||
accentColor={nav.accentColor}
|
||||
menuItems={nav.menuItems}
|
||||
chatLink={tryLink}
|
||||
/>
|
||||
|
||||
<main className="mx-auto max-w-screen-xl px-6 pt-24">
|
||||
<HeroSection
|
||||
title={nav.navTitle}
|
||||
overview="Your AI health companion for evidence-based wellness"
|
||||
getTryLink={() => tryLink}
|
||||
/>
|
||||
|
||||
<DisclaimerSection />
|
||||
|
||||
<BotSection id="patient-features">
|
||||
<PatientFeaturesSection
|
||||
features={bot.features}
|
||||
<BotPageTemplate botSlug="medical-expert" botDisplayName="Imhotep">
|
||||
{({ bot, tryLink }) => (
|
||||
<>
|
||||
<HeroSection
|
||||
title={bot.nav!.navTitle}
|
||||
overview="Your AI health companion for evidence-based wellness"
|
||||
getTryLink={() => tryLink}
|
||||
/>
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="for-professionals">
|
||||
<HealthcareProfessionalsSection />
|
||||
</BotSection>
|
||||
<DisclaimerSection />
|
||||
|
||||
<BotSection id="health-education">
|
||||
<HealthEducationSection getTryLink={() => tryLink} />
|
||||
</BotSection>
|
||||
<BotSection id="patient-features">
|
||||
<PatientFeaturesSection
|
||||
features={bot.features}
|
||||
getTryLink={() => tryLink}
|
||||
/>
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="coming-soon">
|
||||
<FutureProductsSection />
|
||||
</BotSection>
|
||||
<BotSection id="for-professionals">
|
||||
<HealthcareProfessionalsSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="vision-and-join" isLast>
|
||||
<VisionAndJoinSection />
|
||||
</BotSection>
|
||||
</main>
|
||||
</div>
|
||||
<BotSection id="health-education">
|
||||
<HealthEducationSection getTryLink={() => tryLink} />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="coming-soon">
|
||||
<FutureProductsSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="vision-and-join" isLast>
|
||||
<VisionAndJoinSection />
|
||||
</BotSection>
|
||||
</>
|
||||
)}
|
||||
</BotPageTemplate>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { getBotBySlug, getBotTryLink } from '@/data/bots';
|
||||
import BotNavigation from '../BotNavigation';
|
||||
import { BotSection, BotNotFoundFallback } from '@/components/shared';
|
||||
import { BotPageTemplate, BotSection } from '@/components/shared';
|
||||
import './styles.css';
|
||||
|
||||
import HeroSection from './components/hero/HeroSection';
|
||||
@@ -16,68 +13,56 @@ import DiscoverySection from './components/discovery/DiscoverySection';
|
||||
import IntegrationSection from './components/integration/IntegrationSection';
|
||||
import DevelopmentRoadmap from './components/integration/DevelopmentRoadmap';
|
||||
|
||||
const WAITLIST_LINK = 'https://nerd.ai/waitlist';
|
||||
|
||||
export default function ResearchAssistant() {
|
||||
const bot = getBotBySlug('research-assistant');
|
||||
const tryLink = getBotTryLink(bot);
|
||||
const waitlistLink = 'https://nerd.ai/waitlist';
|
||||
|
||||
if (!bot || !bot.nav) {
|
||||
return <BotNotFoundFallback botName="Nerd" />;
|
||||
}
|
||||
|
||||
const { nav } = bot;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white">
|
||||
<BotNavigation
|
||||
botSlug={bot.slug}
|
||||
botTitle={nav.navTitle}
|
||||
botEmoji={nav.emoji}
|
||||
botDescription={nav.navDescription}
|
||||
accentColor={nav.accentColor}
|
||||
menuItems={nav.menuItems}
|
||||
chatLink={tryLink}
|
||||
/>
|
||||
<BotPageTemplate
|
||||
botSlug="research-assistant"
|
||||
botDisplayName="Nerd"
|
||||
overrideTryLink={WAITLIST_LINK}
|
||||
>
|
||||
{({ bot }) => (
|
||||
<>
|
||||
<HeroSection
|
||||
title={bot.nav!.navTitle}
|
||||
overview="Your AI companion for organized research, real-time updates, and groundbreaking discoveries"
|
||||
getTryLink={() => WAITLIST_LINK}
|
||||
/>
|
||||
|
||||
<main className="mx-auto max-w-screen-xl px-6 pt-24">
|
||||
<HeroSection
|
||||
title={nav.navTitle}
|
||||
overview="Your AI companion for organized research, real-time updates, and groundbreaking discoveries"
|
||||
getTryLink={() => waitlistLink}
|
||||
/>
|
||||
<BotSection id="core-features" className="mt-16">
|
||||
<FeaturesSection features={bot.features || []} />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="core-features" className="mt-16">
|
||||
<FeaturesSection features={bot.features || []} />
|
||||
</BotSection>
|
||||
<BotSection id="research-system">
|
||||
<ResearchSystemSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="research-system">
|
||||
<ResearchSystemSection />
|
||||
</BotSection>
|
||||
<BotSection id="web-scraping">
|
||||
<WebScrapingSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="web-scraping">
|
||||
<WebScrapingSection />
|
||||
</BotSection>
|
||||
<BotSection id="draft-generation">
|
||||
<DraftGenerationSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="draft-generation">
|
||||
<DraftGenerationSection />
|
||||
</BotSection>
|
||||
<BotSection id="daily-questions">
|
||||
<QuestionsSection getTryLink={() => WAITLIST_LINK} />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="daily-questions">
|
||||
<QuestionsSection getTryLink={() => waitlistLink} />
|
||||
</BotSection>
|
||||
<BotSection id="discovery-mode">
|
||||
<DiscoverySection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="discovery-mode">
|
||||
<DiscoverySection />
|
||||
</BotSection>
|
||||
<BotSection id="integration">
|
||||
<IntegrationSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="integration">
|
||||
<IntegrationSection />
|
||||
</BotSection>
|
||||
|
||||
<BotSection id="roadmap" isLast>
|
||||
<DevelopmentRoadmap />
|
||||
</BotSection>
|
||||
</main>
|
||||
</div>
|
||||
<BotSection id="roadmap" isLast>
|
||||
<DevelopmentRoadmap />
|
||||
</BotSection>
|
||||
</>
|
||||
)}
|
||||
</BotPageTemplate>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
'use client';
|
||||
|
||||
import { type FC, type ReactNode, useEffect, useRef } from 'react';
|
||||
import { getBotBySlug, getBotTryLink, type Bot } from '@/data/bots';
|
||||
import BotNavigation from '@/app/bots/BotNavigation';
|
||||
import { BotNotFoundFallback } from './BotNotFoundFallback';
|
||||
|
||||
interface BotPageTemplateProps {
|
||||
/** The bot slug to load from data/bots.ts */
|
||||
botSlug: string;
|
||||
/** Display name for fallback if bot not found */
|
||||
botDisplayName: string;
|
||||
/** The main content of the page */
|
||||
children: (props: BotPageRenderProps) => ReactNode;
|
||||
/** Optional: Override the try/chat link */
|
||||
overrideTryLink?: string;
|
||||
/** Optional: Custom CSS file imported by the page */
|
||||
className?: string;
|
||||
/** Optional: Include scroll-to-hash behavior */
|
||||
enableHashScrolling?: boolean;
|
||||
/** Optional: Include footer */
|
||||
showFooter?: boolean;
|
||||
}
|
||||
|
||||
export interface BotPageRenderProps {
|
||||
bot: Bot;
|
||||
tryLink: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template wrapper for bot detail pages
|
||||
* Handles common patterns: bot lookup, fallback, navigation, and layout
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* export default function MyBotPage() {
|
||||
* return (
|
||||
* <BotPageTemplate botSlug="my-bot" botDisplayName="MyBot">
|
||||
* {({ bot, tryLink }) => (
|
||||
* <>
|
||||
* <HeroSection getTryLink={() => tryLink} />
|
||||
* <BotSection id="features">
|
||||
* <FeaturesSection />
|
||||
* </BotSection>
|
||||
* </>
|
||||
* )}
|
||||
* </BotPageTemplate>
|
||||
* );
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export const BotPageTemplate: FC<BotPageTemplateProps> = ({
|
||||
botSlug,
|
||||
botDisplayName,
|
||||
children,
|
||||
overrideTryLink,
|
||||
className = '',
|
||||
enableHashScrolling = false,
|
||||
showFooter = false,
|
||||
}) => {
|
||||
const bot = getBotBySlug(botSlug);
|
||||
const tryLink = overrideTryLink ?? getBotTryLink(bot);
|
||||
const hasScrolledToTop = useRef(false);
|
||||
|
||||
// Handle scroll to section if hash is present in URL
|
||||
useEffect(() => {
|
||||
if (!enableHashScrolling) return;
|
||||
|
||||
const handleHashChange = () => {
|
||||
const hash = window.location.hash;
|
||||
if (hash) {
|
||||
const element = document.querySelector(hash);
|
||||
if (element) {
|
||||
setTimeout(() => {
|
||||
element.scrollIntoView({ behavior: 'smooth' });
|
||||
}, 100);
|
||||
}
|
||||
} else if (!hasScrolledToTop.current) {
|
||||
window.scrollTo(0, 0);
|
||||
hasScrolledToTop.current = true;
|
||||
}
|
||||
};
|
||||
|
||||
handleHashChange();
|
||||
window.addEventListener('hashchange', handleHashChange);
|
||||
return () => window.removeEventListener('hashchange', handleHashChange);
|
||||
}, [enableHashScrolling]);
|
||||
|
||||
// Return fallback if bot or nav config not found
|
||||
if (!bot || !bot.nav) {
|
||||
return <BotNotFoundFallback botName={botDisplayName} />;
|
||||
}
|
||||
|
||||
const { nav } = bot;
|
||||
|
||||
return (
|
||||
<div className={`min-h-screen bg-white ${className}`.trim()}>
|
||||
<BotNavigation
|
||||
botSlug={bot.slug}
|
||||
botTitle={nav.navTitle}
|
||||
botEmoji={nav.emoji}
|
||||
botDescription={nav.navDescription}
|
||||
accentColor={nav.accentColor}
|
||||
menuItems={nav.menuItems}
|
||||
chatLink={tryLink}
|
||||
/>
|
||||
|
||||
<main className="mx-auto max-w-screen-xl px-6 pt-24">
|
||||
{children({ bot, tryLink })}
|
||||
</main>
|
||||
|
||||
{showFooter && (
|
||||
<footer className="bg-gray-50 border-t border-gray-200">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div className="flex flex-col md:flex-row items-center justify-between">
|
||||
<div className="flex items-center mb-4 md:mb-0">
|
||||
<span className="text-2xl mr-2">{nav.emoji}</span>
|
||||
<span className="font-bold text-xl text-gray-900">
|
||||
{nav.navTitle}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-8">
|
||||
<a href="#" className="text-gray-500 hover:text-gray-700">
|
||||
Terms of Service
|
||||
</a>
|
||||
<a href="#" className="text-gray-500 hover:text-gray-700">
|
||||
Privacy Policy
|
||||
</a>
|
||||
<a
|
||||
href="mailto:hello@botsmann.com"
|
||||
className="text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
Contact Us
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-8 text-center text-gray-500 text-sm">
|
||||
<p>© {new Date().getFullYear()} Botsmann. All rights reserved.</p>
|
||||
<p className="mt-1">
|
||||
"{nav.navTitle}" is an AI GPT powered by OpenAI's technology.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -1,2 +1,3 @@
|
||||
export { BotSection } from './BotSection';
|
||||
export { BotNotFoundFallback } from './BotNotFoundFallback';
|
||||
export { BotPageTemplate, type BotPageRenderProps } from './BotPageTemplate';
|
||||
+28
-6
@@ -52,6 +52,22 @@ function calculateReadTime(content: string): string {
|
||||
return `${minutes} min`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize MDX content by fixing problematic patterns
|
||||
* - Escapes `<` followed by numbers (MDX tries to parse as JSX tag)
|
||||
* - Removes broken Unicode characters
|
||||
*/
|
||||
function sanitizeMdxContent(content: string): string {
|
||||
return content
|
||||
// Escape < followed by numbers (e.g., "<1%" becomes "<1%")
|
||||
// This prevents MDX from interpreting it as JSX
|
||||
.replace(/<(\d)/g, '<$1')
|
||||
// Remove replacement character (U+FFFD) and other broken Unicode
|
||||
.replace(/\uFFFD/g, ' ')
|
||||
// Remove other common problematic Unicode ranges (surrogate pairs)
|
||||
.replace(/[\uD800-\uDFFF]/g, ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all guides from the knowledge repository
|
||||
*/
|
||||
@@ -154,13 +170,16 @@ export async function fetchGuideBySlug(slug: string): Promise<Guide | null> {
|
||||
// Skip unpublished
|
||||
if (data.published !== true) continue;
|
||||
|
||||
// Sanitize content to fix broken Unicode characters
|
||||
const sanitizedContent = sanitizeMdxContent(content);
|
||||
|
||||
return {
|
||||
metadata: {
|
||||
slug,
|
||||
title: data.title || slug,
|
||||
description: data.description || '',
|
||||
difficulty: data.difficulty || 'Beginner',
|
||||
readTime: data.readTime || calculateReadTime(content),
|
||||
readTime: data.readTime || calculateReadTime(sanitizedContent),
|
||||
author: data.author,
|
||||
publishedAt: data.publishedAt || new Date().toISOString().split('T')[0],
|
||||
updatedAt: data.updatedAt,
|
||||
@@ -170,8 +189,8 @@ export async function fetchGuideBySlug(slug: string): Promise<Guide | null> {
|
||||
category: data.category || 'getting-started',
|
||||
published: true,
|
||||
},
|
||||
content,
|
||||
tableOfContents: extractTableOfContents(content),
|
||||
content: sanitizedContent,
|
||||
tableOfContents: extractTableOfContents(sanitizedContent),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -316,12 +335,15 @@ export async function fetchInfrastructureGuideBySlug(
|
||||
|
||||
if (data.published !== true) return null;
|
||||
|
||||
// Sanitize content to fix broken Unicode characters
|
||||
const sanitizedContent = sanitizeMdxContent(content);
|
||||
|
||||
return {
|
||||
slug,
|
||||
title: data.title || slug,
|
||||
description: data.description || '',
|
||||
difficulty: data.difficulty || 'Intermediate',
|
||||
readTime: data.readTime || calculateReadTime(content),
|
||||
readTime: data.readTime || calculateReadTime(sanitizedContent),
|
||||
publishedAt: data.publishedAt || new Date().toISOString().split('T')[0],
|
||||
tags: data.tags || [],
|
||||
category: 'infrastructure',
|
||||
@@ -329,8 +351,8 @@ export async function fetchInfrastructureGuideBySlug(
|
||||
comparisonType: data.comparisonType || 'tools',
|
||||
options: data.options || [],
|
||||
recommendation: data.recommendation,
|
||||
content,
|
||||
tableOfContents: extractTableOfContents(content),
|
||||
content: sanitizedContent,
|
||||
tableOfContents: extractTableOfContents(sanitizedContent),
|
||||
};
|
||||
} catch (error) {
|
||||
console.info(`Failed to fetch infrastructure guide ${slug}:`, error);
|
||||
|
||||
Reference in new issue
Block a user