'use client'; /** * Step 1: Basic Information * - Bot title * - URL slug * - Description */ import { useEffect } from 'react'; import { TextBox } from '@/components/forms/TextBox'; interface StepBasicInfoProps { title: string; slug: string; description: string; onChange: (data: { title?: string; slug?: string; description?: string }) => void; errors: string[]; } /** * Convert title to URL-friendly slug */ function titleToSlug(title: string): string { return title .toLowerCase() .trim() .replace(/[^a-z0-9\s-]/g, '') .replace(/\s+/g, '-') .replace(/-+/g, '-') .replace(/^-|-$/g, ''); } export function StepBasicInfo({ title, slug, description, onChange, errors }: StepBasicInfoProps) { // Auto-generate slug from title if slug is empty or matches previous auto-generated value useEffect(() => { if (title && !slug) { onChange({ slug: titleToSlug(title) }); } }, [title, slug, onChange]); return (

Basic Information

Give your bot a name and identity. This is how users will find and recognize it.

{/* Error display */} {errors.length > 0 && (
)} {/* Title */}
Bot Name * } multiline={false} id="title" value={title} onValueChange={(newTitle) => { onChange({ title: newTitle, // Auto-update slug if it was auto-generated ...(slug === titleToSlug(title) ? { slug: titleToSlug(newTitle) } : {}), }); }} placeholder="e.g., HR Strategy Advisor" maxLength={100} required hint={`${title.length}/100 characters`} />
{/* Slug */}
/bots/ onChange({ slug: e.target.value.toLowerCase() })} placeholder="hr-strategy-advisor" className="block w-full rounded-r-lg border border-gray-300 px-4 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:ring-blue-500" maxLength={50} />

Lowercase letters, numbers, and hyphens only

{/* Description */}
onChange({ description: next })} placeholder="A brief description of what your bot does and who it's for..." rows={3} maxLength={500} hint={`${description.length}/500 characters`} />
); }