Files
smartchat/ts_cli/components.inputarea.ts
jkunz dd04edb420 feat(initial): scaffold @push.rocks/smartchat with core, CLI, and web layers
Three-layer architecture built on @push.rocks/smartagent:
- ts/ — ChatSession wrapping runAgent() with conversation state management
- ts_cli/ — ink-based terminal chat TUI (React.createElement, no JSX)
- ts_web/ — Lit web components (smartchat-window, smartchat-message, smartchat-input)
2026-03-06 23:20:12 +00:00

30 lines
841 B
TypeScript

import { React, h, Box, Text, TextInput } from './plugins.js';
interface IInputAreaProps {
disabled: boolean;
onSubmit: (text: string) => void;
}
export function InputArea({ disabled, onSubmit }: IInputAreaProps): React.ReactElement {
const [value, setValue] = React.useState('');
const handleSubmit = (text: string) => {
if (!text.trim()) return;
onSubmit(text.trim());
setValue('');
};
return h(
Box,
{ borderStyle: 'single' as const, borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, paddingX: 1 },
h(Text, { bold: true, color: disabled ? 'gray' : 'cyan' }, '> '),
h(TextInput, {
value,
onChange: setValue,
onSubmit: handleSubmit,
placeholder: disabled ? 'Waiting for response...' : 'Type a message...',
focus: !disabled,
}),
);
}