mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 10:57:37 +01:00
app/globals.css defines the identity -- editorial ink, one ochre accent --
and says so in a comment: "No generic AI gradient blue/purple." The bot
pages ignored it and ran a parallel palette, so a single viewport of
/bots/legal-expert showed a blue logo, a blue nav button and an ochre CTA
at the same time.
There were four colour sources, not two:
lib/config/colors.ts 16-colour accent sets
lib/hooks/navigationConfig its own 5-colour NAV_COLOR_CLASSES
ACCENT_HERO_CLASSES a fifth set (whose green and indigo entries
both set chatBg to 'bg-blue-50' -- it was not
even self-consistent)
raw Tailwind greys text-gray-900 / bg-white / border-gray-200
The six professional bots are Botsmann, so they now wear the brand:
BRAND_ACCENT and BRAND_HERO, plus a single NAV_COLORS scheme. 113 raw
grey/white classes became semantic tokens (text-ink, text-ink-muted,
bg-surface, bg-paper, border-edge). The page ground is bg-paper, matching
the homepage instead of flat white.
The 'B' mark in BotNavigation was literally
`bg-gradient-to-r from-blue-600 to-purple-600` -- the exact thing globals.css
forbids by name. It now renders the shared <Logo>, so it cannot drift again.
Per-bot accentColor is gone from the first-party config and its plumbing.
The per-colour sets STAY for user-created bots: custom_bots.accent_color is
a real column with a CHECK constraint and the owner picks it. That is user
data, not a design token.
Also deleted components/shared/BotPageTemplate.tsx -- nothing imported it.
Not in this change: /try, /enterprise, /bots and /knowledge still carry
blue/purple gradients (72 files match the raw palette). Same class, separate
pass, so this one stays reviewable.
verify: format, lint, typecheck, 240 tests, build -- all green. Verified
visually against a local production build.
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
246 lines
7.8 KiB
TypeScript
246 lines
7.8 KiB
TypeScript
'use client';
|
|
|
|
import { type FC, type ReactNode } from 'react';
|
|
import { BRAND_HERO } from '@/lib/config/colors';
|
|
|
|
/**
|
|
* Chat message for the hero preview
|
|
*/
|
|
export interface HeroChatMessage {
|
|
role: 'bot' | 'user';
|
|
content: string;
|
|
}
|
|
|
|
/**
|
|
* Badge/label configuration for hero section
|
|
*/
|
|
export interface HeroBadge {
|
|
text: string;
|
|
emoji?: string;
|
|
}
|
|
|
|
/**
|
|
* Key benefit/feature displayed in hero
|
|
*/
|
|
export interface HeroKeyBenefit {
|
|
emoji: string;
|
|
text: string;
|
|
}
|
|
|
|
/**
|
|
* CTA button configuration
|
|
*/
|
|
export interface HeroCTA {
|
|
text: string;
|
|
href: string;
|
|
external?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Configuration for the hero section
|
|
*/
|
|
export interface BotHeroConfig {
|
|
/** Badge shown above the title */
|
|
badge?: HeroBadge;
|
|
/** Main title (bot name will be added automatically if titleSuffix is provided) */
|
|
title: string;
|
|
/** Optional suffix added after title (e.g., "- AI Legal Assistant") */
|
|
titleSuffix?: string;
|
|
/** Subtitle/overview text */
|
|
subtitle: string;
|
|
/** Primary CTA button */
|
|
primaryCTA: HeroCTA;
|
|
/** Secondary CTA button */
|
|
secondaryCTA?: HeroCTA;
|
|
/** Bot info for chat preview */
|
|
botInfo: {
|
|
name: string;
|
|
emoji: string;
|
|
description: string;
|
|
};
|
|
/** Chat messages to display in preview */
|
|
chatMessages: HeroChatMessage[];
|
|
/** Key benefits to display (optional) */
|
|
keyBenefits?: HeroKeyBenefit[];
|
|
/** Whether to show key benefits on mobile separately */
|
|
showMobileBenefits?: boolean;
|
|
}
|
|
|
|
interface BotHeroSectionProps {
|
|
config: BotHeroConfig;
|
|
/** Optional custom content for the right panel instead of chat preview */
|
|
rightPanel?: ReactNode;
|
|
}
|
|
|
|
/**
|
|
* Shared Hero Section component for bot pages
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* <BotHeroSection
|
|
* config={{
|
|
* badge: { emoji: '⚖️', text: 'Private AI Node' },
|
|
* title: 'Lex',
|
|
* titleSuffix: 'Your AI Legal Assistant',
|
|
* subtitle: 'Comprehensive legal research and analysis support.',
|
|
* primaryCTA: { text: 'Chat with Lex', href: tryLink, external: true },
|
|
* secondaryCTA: { text: 'Try Demo', href: '#demo' },
|
|
* botInfo: { name: 'Lex', emoji: '⚖️', description: 'AI Legal Assistant' },
|
|
* chatMessages: [
|
|
* { role: 'bot', content: 'How can I help with your legal research today?' },
|
|
* { role: 'user', content: 'I need a summary of recent data privacy cases.' },
|
|
* ],
|
|
* }}
|
|
* />
|
|
* ```
|
|
*/
|
|
export const BotHeroSection: FC<BotHeroSectionProps> = ({ config, rightPanel }) => {
|
|
const colors = BRAND_HERO;
|
|
const {
|
|
badge,
|
|
title,
|
|
titleSuffix,
|
|
subtitle,
|
|
primaryCTA,
|
|
secondaryCTA,
|
|
botInfo,
|
|
chatMessages,
|
|
keyBenefits,
|
|
showMobileBenefits = false,
|
|
} = config;
|
|
|
|
return (
|
|
<section className="mb-12 sm:mb-16 pt-8 sm:pt-12">
|
|
<div className="grid md:grid-cols-2 gap-6 sm:gap-8 lg:gap-12 items-center">
|
|
{/* Left side - Content */}
|
|
<div>
|
|
{badge && (
|
|
<div
|
|
className={`mb-3 sm:mb-4 inline-flex items-center px-3 py-1 ${colors.badge} rounded-full text-xs sm:text-sm font-medium`}
|
|
>
|
|
{badge.emoji && <span className="mr-1">{badge.emoji}</span>}
|
|
{badge.text}
|
|
</div>
|
|
)}
|
|
|
|
<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold text-ink mb-3 sm:mb-4">
|
|
{title}
|
|
{titleSuffix && (
|
|
<>
|
|
{title.endsWith(':') ? ' ' : ': '}
|
|
{titleSuffix}
|
|
</>
|
|
)}
|
|
</h1>
|
|
|
|
<p className="text-base sm:text-lg lg:text-xl text-ink mb-4 sm:mb-6">{subtitle}</p>
|
|
|
|
<div className="flex flex-col sm:flex-row gap-3 sm:gap-4">
|
|
<a
|
|
href={primaryCTA.href}
|
|
className="btn-primary flex items-center justify-center px-5 py-3 text-base"
|
|
{...(primaryCTA.external && { target: '_blank', rel: 'noopener noreferrer' })}
|
|
>
|
|
<span>{primaryCTA.text}</span>
|
|
<svg className="w-5 h-5 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth="2"
|
|
d="M13 5l7 7-7 7M5 12h15"
|
|
/>
|
|
</svg>
|
|
</a>
|
|
{secondaryCTA && (
|
|
<a
|
|
href={secondaryCTA.href}
|
|
className="btn-secondary flex items-center justify-center px-5 py-3 text-base"
|
|
>
|
|
{secondaryCTA.text}
|
|
</a>
|
|
)}
|
|
</div>
|
|
|
|
{/* Mobile key benefits */}
|
|
{showMobileBenefits && keyBenefits && keyBenefits.length > 0 && (
|
|
<div className="mt-8 md:hidden">
|
|
<h3 className="text-lg font-semibold text-ink mb-3">Key Benefits:</h3>
|
|
<ul className="space-y-2">
|
|
{keyBenefits.slice(0, 3).map((benefit, idx) => (
|
|
<li key={idx} className="flex items-start">
|
|
<span className="text-green-500 mr-2">✓</span>
|
|
<span className="text-ink">{benefit.text}</span>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)}
|
|
|
|
{/* Desktop key benefits (when not showing mobile separately) */}
|
|
{!showMobileBenefits && keyBenefits && keyBenefits.length > 0 && (
|
|
<div className="mt-8 grid grid-cols-2 gap-3">
|
|
{keyBenefits.map((benefit, idx) => (
|
|
<div key={idx} className="flex items-start">
|
|
<span className={`${colors.benefitIcon} mr-2`}>{benefit.emoji}</span>
|
|
<span className="text-sm">{benefit.text}</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Right side - Chat preview or custom content */}
|
|
{rightPanel || (
|
|
<div
|
|
className={`${colors.chatBg} p-4 md:p-6 rounded-xl border ${colors.chatBorder} shadow-sm`}
|
|
>
|
|
{/* Bot header */}
|
|
<div className="flex items-center gap-3 mb-4">
|
|
<div
|
|
className={`w-10 h-10 md:w-12 md:h-12 ${colors.iconBg} rounded-full flex items-center justify-center`}
|
|
>
|
|
<span className="text-xl md:text-2xl">{botInfo.emoji}</span>
|
|
</div>
|
|
<div>
|
|
<h3 className="font-semibold text-ink">{botInfo.name}</h3>
|
|
<p className="text-sm text-ink-muted">{botInfo.description}</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Chat messages */}
|
|
<div className="space-y-3">
|
|
{chatMessages.map((message, idx) => (
|
|
<div
|
|
key={idx}
|
|
className={`p-3 rounded-lg shadow-sm ${
|
|
message.role === 'bot'
|
|
? 'bg-surface ml-auto max-w-[85%]'
|
|
: `${colors.userBubble} max-w-[85%]`
|
|
}`}
|
|
>
|
|
<p className="text-ink text-sm md:text-base">{message.content}</p>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
{/* Desktop key benefits inside chat panel */}
|
|
{showMobileBenefits && keyBenefits && keyBenefits.length > 0 && (
|
|
<div className="mt-6 hidden md:block">
|
|
<h4 className="font-medium text-ink mb-2">Key Benefits:</h4>
|
|
<div className="grid grid-cols-2 gap-2">
|
|
{keyBenefits.slice(0, 4).map((benefit, idx) => (
|
|
<div key={idx} className="bg-surface p-2 rounded-md flex items-center">
|
|
<span className="text-green-500 mr-2">✓</span>
|
|
<span className="text-sm text-ink">{benefit.text}</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|