import React from 'react'; interface SnippetInputProps extends React.TextareaHTMLAttributes { value: string; onChange: (value: string) => void; } const SNIPPETS: Record = { ';daily': 'Daily standup', ';mtg': 'Meeting', ';review': 'Code review', ';bug': 'Bugfix ', }; export const SnippetInput: React.FC = ({ value, onChange, ...rest }) => { const handleChange = (e: React.ChangeEvent) => { const newValue = e.target.value; // Find the last occurrence of a semicolon to check for a snippet const lastSemicolonIndex = newValue.lastIndexOf(';'); if (lastSemicolonIndex !== -1) { const trailingText = newValue.slice(lastSemicolonIndex); // Check if the trailing text matches any of our snippet keys const snippetKey = Object.keys(SNIPPETS).find(key => trailingText === key); if (snippetKey) { const expandedValue = newValue.slice(0, lastSemicolonIndex) + SNIPPETS[snippetKey]; onChange(expandedValue); return; } } onChange(newValue); }; return (