Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d80a6437e | |||
| 9c976684cd |
@@ -29,7 +29,7 @@ export function Chat({ dialog, typing, statusMessage, onSend }: ChatProps): Reac
|
||||
/>
|
||||
{statusMessage && <div className={b('statusMessage')}>{statusMessage}</div>}
|
||||
<Input
|
||||
loading={typing}
|
||||
typing={typing}
|
||||
onSend={onSend}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -7,17 +7,17 @@ import styles from './Input.module.css';
|
||||
const b = block(styles, 'Input');
|
||||
|
||||
interface InputProps {
|
||||
loading?: boolean;
|
||||
typing?: boolean;
|
||||
onSend?: (text: string) => void;
|
||||
}
|
||||
|
||||
export function Input({ loading, onSend }: InputProps): ReactNode {
|
||||
export function Input({ typing, onSend }: InputProps): ReactNode {
|
||||
const [input, setInput] = useState('');
|
||||
|
||||
const handleSend = () => {
|
||||
const text = input.trim();
|
||||
|
||||
if (!text || loading) {
|
||||
if (!text || typing) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ export function Input({ loading, onSend }: InputProps): ReactNode {
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="Type your message here..."
|
||||
rows={1}
|
||||
disabled={loading}
|
||||
disabled={typing}
|
||||
/>
|
||||
<button
|
||||
className={b('send')}
|
||||
onClick={handleSend}
|
||||
disabled={loading || !input.trim()}
|
||||
disabled={typing || !input.trim()}
|
||||
>
|
||||
<PaperPlaneIcon />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user