import MarkdownContent from './MarkdownContent';
function truncateText(text: string, maxLength: number = 100): string {
if (text.length <= maxLength) return text;
return text.slice(0, maxLength) + '...';
}
interface SplashPillProps {
content: string;
append: (text: string) => void;
className?: string;
}
function SplashPill({ content, append, className = '' }: SplashPillProps) {
const displayText = truncateText(content);
return (
{
// Always use the full text (longForm or original content) when clicked
await append(content);
}}
title={content.length > 100 ? content : undefined} // Show full text on hover if truncated
>
{displayText}
);
}
interface ContextBlockProps {
content: string;
}
function ContextBlock({ content }: ContextBlockProps) {
// Remove the "message:" prefix and trim whitespace
const displayText = content.replace(/^message:/i, '').trim();
return (
);
}
interface SplashPillsProps {
append: (text: string) => void;
activities: string[] | null;
}
export default function SplashPills({ append, activities = null }: SplashPillsProps) {
// If custom activities are provided, use those instead of the default ones
const defaultPills = [
'What can you do?',
'Demo writing and reading files',
'Make a snake game in a new folder',
'List files in my current directory',
'Take a screenshot and summarize',
];
const pills = activities || defaultPills;
// Find any pill that starts with "message:"
const messagePillIndex = pills.findIndex((pill) => pill.toLowerCase().startsWith('message:'));
// Extract the message pill and the remaining pills
const messagePill = messagePillIndex >= 0 ? pills[messagePillIndex] : null;
const remainingPills =
messagePillIndex >= 0
? [...pills.slice(0, messagePillIndex), ...pills.slice(messagePillIndex + 1)]
: pills;
return (
{messagePill &&
}
{remainingPills.map((content, index) => (
))}
);
}