From c10748ceff19fc3cda395391da54fc4a72e588ca Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Tue, 13 Jan 2026 19:49:20 +0100 Subject: [PATCH] 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 --- app/bots/artistic-advisor/page.tsx | 442 ++++++++++++-------------- app/bots/medical-expert/page.tsx | 82 ++--- app/bots/research-assistant/page.tsx | 99 +++--- components/shared/BotPageTemplate.tsx | 150 +++++++++ components/shared/index.ts | 1 + lib/knowledge.ts | 34 +- 6 files changed, 463 insertions(+), 345 deletions(-) create mode 100644 components/shared/BotPageTemplate.tsx diff --git a/app/bots/artistic-advisor/page.tsx b/app/bots/artistic-advisor/page.tsx index 52aa967..fb0b88d 100644 --- a/app/bots/artistic-advisor/page.tsx +++ b/app/bots/artistic-advisor/page.tsx @@ -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 ; - } - - const { nav } = bot; - return ( -
- - -
- {/* Title and Overview */} -
-

- {nav.navTitle} -

-

{bot.overview}

-
- - {/* Features Section */} - -
-
-

- Features -

-
    - {bot.features.map((feature, index) => ( -
  • - - - - {feature} -
  • - ))} -
-
- -
-

- How It Works -

-
    -
  1. -
    - 1 -
    -
    -

    - Describe your artistic vision -

    -

    - Share details about your creative project or style - preferences. -

    -
    -
  2. -
  3. -
    - 2 -
    -
    -

    AI Analysis

    -

    - Our AI processes your input using art knowledge and - creative principles. -

    -
    -
  4. -
  5. -
    - 3 -
    -
    -

    - Get Creative Insights -

    -

    - Receive tailored advice, inspiration, and techniques for - your artistic endeavors. -

    -
    -
  6. -
-
+ + {({ bot, tryLink }) => ( + <> + {/* Title and Overview */} +
+

+ {bot.nav!.navTitle} +

+

{bot.overview}

- - {/* Style Analysis Tool */} - -

- Analyze Your Style -

-
-

- Describe your artistic work or upload an image for style analysis. -

- -
-